CurveAxisScaleConfigWidget.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
19 #include <QDoubleValidator>
20 
21 #include <ui_CurveAxisScaleConfigWidget.h>
22 
24 
25 namespace rqt_multiplot {
26 
27 /*****************************************************************************/
28 /* Constructors and Destructor */
29 /*****************************************************************************/
30 
32  QWidget(parent),
33  ui_(new Ui::CurveAxisScaleConfigWidget()),
34  config_(0) {
35  ui_->setupUi(this);
36 
37  ui_->lineEditAbsoluteMinimum->setEnabled(false);
38  ui_->lineEditAbsoluteMaximum->setEnabled(false);
39  ui_->lineEditRelativeMinimum->setEnabled(false);
40  ui_->lineEditRelativeMaximum->setEnabled(false);
41 
42  ui_->lineEditAbsoluteMinimum->setValidator(
43  new QDoubleValidator(ui_->lineEditAbsoluteMinimum));
44  ui_->lineEditAbsoluteMaximum->setValidator(
45  new QDoubleValidator(ui_->lineEditAbsoluteMaximum));
46  ui_->lineEditRelativeMinimum->setValidator(
47  new QDoubleValidator(ui_->lineEditRelativeMinimum));
48  ui_->lineEditRelativeMaximum->setValidator(
49  new QDoubleValidator(ui_->lineEditRelativeMaximum));
50 
51  connect(ui_->radioButtonAbsolute, SIGNAL(toggled(bool)), this,
52  SLOT(radioButtonAbsoluteToggled(bool)));
53  connect(ui_->radioButtonRelative, SIGNAL(toggled(bool)), this,
54  SLOT(radioButtonRelativeToggled(bool)));
55  connect(ui_->radioButtonAuto, SIGNAL(toggled(bool)), this,
56  SLOT(radioButtonAutoToggled(bool)));
57 
58  connect(ui_->lineEditAbsoluteMinimum, SIGNAL(editingFinished()),
60  connect(ui_->lineEditAbsoluteMaximum, SIGNAL(editingFinished()),
62  connect(ui_->lineEditRelativeMinimum, SIGNAL(editingFinished()),
64  connect(ui_->lineEditRelativeMaximum, SIGNAL(editingFinished()),
66 }
67 
69  delete ui_;
70 }
71 
72 /*****************************************************************************/
73 /* Accessors */
74 /*****************************************************************************/
75 
77  if (config != config_) {
78  if (config_) {
79  disconnect(config_, SIGNAL(typeChanged(int)), this,
80  SLOT(configTypeChanged(int)));
81  disconnect(config_, SIGNAL(absoluteMinimumChanged(double)), this,
82  SLOT(configAbsoluteMinimumChanged(double)));
83  disconnect(config_, SIGNAL(absoluteMaximumChanged(double)), this,
84  SLOT(configAbsoluteMaximumChanged(double)));
85  disconnect(config_, SIGNAL(relativeMinimumChanged(double)), this,
86  SLOT(configRelativeMinimumChanged(double)));
87  disconnect(config_, SIGNAL(relativeMaximumChanged(double)), this,
88  SLOT(configRelativeMaximumChanged(double)));
89  }
90 
91  config_ = config;
92 
93  if (config) {
94  connect(config, SIGNAL(typeChanged(int)), this,
95  SLOT(configTypeChanged(int)));
96  connect(config, SIGNAL(absoluteMinimumChanged(double)), this,
97  SLOT(configAbsoluteMinimumChanged(double)));
98  connect(config, SIGNAL(absoluteMaximumChanged(double)), this,
99  SLOT(configAbsoluteMaximumChanged(double)));
100  connect(config, SIGNAL(relativeMinimumChanged(double)), this,
101  SLOT(configRelativeMinimumChanged(double)));
102  connect(config, SIGNAL(relativeMaximumChanged(double)), this,
103  SLOT(configRelativeMaximumChanged(double)));
104 
105  configTypeChanged(config->getType());
110  }
111  }
112 }
113 
115  return config_;
116 }
117 
118 /*****************************************************************************/
119 /* Slots */
120 /*****************************************************************************/
121 
123  if (type == CurveAxisScaleConfig::Absolute)
124  ui_->radioButtonAbsolute->setChecked(true);
125  else if (type == CurveAxisScaleConfig::Relative)
126  ui_->radioButtonRelative->setChecked(true);
127  else
128  ui_->radioButtonAuto->setChecked(true);
129 }
130 
132  ui_->lineEditAbsoluteMinimum->setText(QString::number(minimum));
133 }
134 
136  ui_->lineEditAbsoluteMaximum->setText(QString::number(maximum));
137 }
138 
140  ui_->lineEditRelativeMinimum->setText(QString::number(minimum));
141 }
142 
144  ui_->lineEditRelativeMaximum->setText(QString::number(maximum));
145 }
146 
148  ui_->lineEditAbsoluteMinimum->setEnabled(checked);
149  ui_->lineEditAbsoluteMaximum->setEnabled(checked);
150 
151  if (config_ && checked)
153 }
154 
156  ui_->lineEditRelativeMinimum->setEnabled(checked);
157  ui_->lineEditRelativeMaximum->setEnabled(checked);
158 
159  if (config_ && checked)
161 }
162 
164  if (config_ && checked)
166 }
167 
169  if (config_)
170  config_->setAbsoluteMinimum(ui_->lineEditAbsoluteMinimum->text().
171  toDouble());
172 }
173 
175  if (config_)
176  config_->setAbsoluteMaximum(ui_->lineEditAbsoluteMaximum->text().
177  toDouble());
178 }
179 
181  if (config_)
182  config_->setRelativeMinimum(ui_->lineEditRelativeMinimum->text().
183  toDouble());
184 }
185 
187  if (config_)
188  config_->setRelativeMaximum(ui_->lineEditRelativeMaximum->text().
189  toDouble());
190 }
191 
192 }


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Wed Jul 10 2019 03:49:44