CurveStyleConfigWidget.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_CurveStyleConfigWidget.h>
22 
24 
25 namespace rqt_multiplot {
26 
27 /*****************************************************************************/
28 /* Constructors and Destructor */
29 /*****************************************************************************/
30 
32  QWidget(parent),
33  ui_(new Ui::CurveStyleConfigWidget()),
34  buttonGroupSticksOrientation_(new QButtonGroup(this)),
35  config_(0) {
36  ui_->setupUi(this);
37 
38  ui_->lineEditSticksBaseline->setValidator(new QDoubleValidator(
39  ui_->lineEditSticksBaseline));
40 
41  ui_->checkBoxLinesInterpolate->setEnabled(false);
42  ui_->radioButtonSticksOrientationHorizontal->setEnabled(false);
43  ui_->radioButtonSticksOrientationVertical->setEnabled(false);
44  ui_->labelSticksBaseline->setEnabled(false);
45  ui_->lineEditSticksBaseline->setEnabled(false);
46  ui_->checkBoxStepsInvert->setEnabled(false);
47 
49  ui_->radioButtonSticksOrientationHorizontal);
51  ui_->radioButtonSticksOrientationVertical);
52 
53  connect(ui_->radioButtonLines, SIGNAL(toggled(bool)), this,
54  SLOT(radioButtonLinesToggled(bool)));
55  connect(ui_->radioButtonSticks, SIGNAL(toggled(bool)), this,
56  SLOT(radioButtonSticksToggled(bool)));
57  connect(ui_->radioButtonSteps, SIGNAL(toggled(bool)), this,
58  SLOT(radioButtonStepsToggled(bool)));
59  connect(ui_->radioButtonPoints, SIGNAL(toggled(bool)), this,
60  SLOT(radioButtonPointsToggled(bool)));
61 
62  connect(ui_->checkBoxLinesInterpolate, SIGNAL(stateChanged(int)),
63  this, SLOT(checkBoxLinesInterpolateStateChanged(int)));
64  connect(ui_->radioButtonSticksOrientationHorizontal, SIGNAL(toggled(bool)),
66  connect(ui_->radioButtonSticksOrientationVertical, SIGNAL(toggled(bool)),
68  connect(ui_->lineEditSticksBaseline, SIGNAL(editingFinished()),
70  connect(ui_->checkBoxStepsInvert, SIGNAL(stateChanged(int)),
71  this, SLOT(checkBoxStepsInvertStateChanged(int)));
72 
73  connect(ui_->spinBoxPenWidth, SIGNAL(valueChanged(int)),
74  this, SLOT(spinBoxPenWidthValueChanged(int)));
75  connect(ui_->comboBoxPenStyle, SIGNAL(currentStyleChanged(int)),
76  this, SLOT(comboBoxPenStyleCurrentStyleChanged(int)));
77  connect(ui_->checkBoxRenderAntialias, SIGNAL(stateChanged(int)),
78  this, SLOT(checkBoxRenderAntialiasStateChanged(int)));
79 }
80 
82  delete ui_;
83 }
84 
85 /*****************************************************************************/
86 /* Accessors */
87 /*****************************************************************************/
88 
90  if (config != config_) {
91  if (config_) {
92  disconnect(config_, SIGNAL(typeChanged(int)), this,
93  SLOT(styleTypeChanged(int)));
94 
95  disconnect(config_, SIGNAL(linesInterpolateChanged(bool)),
96  this, SLOT(configLinesInterpolateChanged(bool)));
97  disconnect(config_, SIGNAL(sticksOrientationChanged(int)),
98  this, SLOT(configSticksOrientationChanged(int)));
99  disconnect(config_, SIGNAL(sticksBaselineChanged(double)),
100  this, SLOT(configSticksBaselineChanged(double)));
101  disconnect(config_, SIGNAL(stepsInvertChanged(bool)),
102  this, SLOT(configStepsInvertChanged(bool)));
103 
104  disconnect(config_, SIGNAL(penWidthChanged(size_t)),
105  this, SLOT(configPenWidthChanged(size_t)));
106  disconnect(config_, SIGNAL(penStyleChanged(int)),
107  this, SLOT(configPenStyleChanged(int)));
108  disconnect(config_, SIGNAL(renderAntialiasChanged(bool)),
109  this, SLOT(configRenderAntialiasChanged(bool)));
110  }
111 
112  config_ = config;
113 
114  if (config) {
115  connect(config, SIGNAL(typeChanged(int)), this,
116  SLOT(configTypeChanged(int)));
117 
118  connect(config, SIGNAL(linesInterpolateChanged(bool)),
119  this, SLOT(configLinesInterpolateChanged(bool)));
120  connect(config, SIGNAL(sticksOrientationChanged(int)),
121  this, SLOT(configSticksOrientationChanged(int)));
122  connect(config, SIGNAL(sticksBaselineChanged(double)),
123  this, SLOT(configSticksBaselineChanged(double)));
124  connect(config, SIGNAL(stepsInvertChanged(bool)),
125  this, SLOT(configStepsInvertChanged(bool)));
126 
127  connect(config, SIGNAL(penWidthChanged(size_t)),
128  this, SLOT(configPenWidthChanged(size_t)));
129  connect(config, SIGNAL(penStyleChanged(int)),
130  this, SLOT(configPenStyleChanged(int)));
131  connect(config, SIGNAL(renderAntialiasChanged(bool)),
132  this, SLOT(configRenderAntialiasChanged(bool)));
133 
134  configTypeChanged(config->getType());
135 
140 
144  }
145  }
146 }
147 
149  return config_;
150 }
151 
152 /*****************************************************************************/
153 /* Slots */
154 /*****************************************************************************/
155 
157  if (type == CurveStyleConfig::Sticks)
158  ui_->radioButtonSticks->setChecked(true);
159  else if (type == CurveStyleConfig::Steps)
160  ui_->radioButtonSteps->setChecked(true);
161  else if (type == CurveStyleConfig::Points)
162  ui_->radioButtonPoints->setChecked(true);
163  else
164  ui_->radioButtonLines->setChecked(true);
165 }
166 
168  ui_->checkBoxLinesInterpolate->setCheckState(interpolate ? Qt::Checked :
169  Qt::Unchecked);
170 }
171 
173  ui_->radioButtonSticksOrientationHorizontal->setChecked(
174  orientation == Qt::Horizontal);
175  ui_->radioButtonSticksOrientationVertical->setChecked(
176  orientation == Qt::Vertical);
177 }
178 
180  ui_->lineEditSticksBaseline->setText(QString::number(baseline));
181 }
182 
184  ui_->checkBoxStepsInvert->setCheckState(invert ? Qt::Checked :
185  Qt::Unchecked);
186 }
187 
189  ui_->spinBoxPenWidth->setValue(width);
190 }
191 
193  ui_->comboBoxPenStyle->setCurrentStyle(static_cast<Qt::PenStyle>(style));
194 }
195 
197  ui_->checkBoxRenderAntialias->setCheckState(antialias ? Qt::Checked :
198  Qt::Unchecked);
199 }
200 
202  ui_->checkBoxLinesInterpolate->setEnabled(checked);
203 
204  if (config_ && checked)
206 }
207 
209  ui_->radioButtonSticksOrientationHorizontal->setEnabled(checked);
210  ui_->radioButtonSticksOrientationVertical->setEnabled(checked);
211  ui_->labelSticksBaseline->setEnabled(checked);
212  ui_->lineEditSticksBaseline->setEnabled(checked);
213 
214  if (config_ && checked)
216 }
217 
219  ui_->checkBoxStepsInvert->setEnabled(checked);
220 
221  if (config_ && checked)
223 }
224 
226  if (config_ && checked)
228 }
229 
231  if (config_)
232  config_->setLinesInterpolate(state == Qt::Checked);
233 }
234 
236  bool checked) {
237  if (config_ && checked)
238  config_->setSticksOrientation(Qt::Horizontal);
239 }
240 
242  bool checked) {
243  if (config_ && checked)
244  config_->setSticksOrientation(Qt::Vertical);
245 }
246 
248  if (config_)
249  config_->setSticksBaseline(ui_->lineEditSticksBaseline->text().
250  toDouble());
251 }
252 
254  if (config_)
255  config_->setStepsInvert(state == Qt::Checked);
256 }
257 
259  if (config_)
260  config_->setPenWidth(value);
261 }
262 
264  if (config_)
265  config_->setPenStyle(static_cast<Qt::PenStyle>(style));
266 }
267 
269  if (config_)
270  config_->setRenderAntialias(state == Qt::Checked);
271 }
272 
273 }
void radioButtonSticksOrientationHorizontalToggled(bool checked)
void setLinesInterpolate(bool interpolate)
void setSticksBaseline(double baseline)
void setConfig(CurveStyleConfig *config)
void setPenStyle(Qt::PenStyle style)
void setSticksOrientation(Qt::Orientation orientation)
Qt::Orientation getSticksOrientation() const
void setRenderAntialias(bool antialias)


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