9 #include "guiQt/config.hpp" 11 #include <fwGui/editor/IEditor.hpp> 13 #include <QGridLayout> 17 #include <QPushButton> 18 #include <QSignalMapper> 129 GUIQT_API
void configuring() override;
132 GUIQT_API
void starting() override;
135 GUIQT_API
void stopping() override;
138 GUIQT_API
void updating() override;
143 void onChangeBoolean(
int value);
146 void onColorButton();
149 void onChangeInteger(
int value);
152 void onChangeDouble(
double value);
155 void onChangeDoubleSlider(
int value);
158 void onChangeEnum(
int value);
161 void onSliderMapped(QLabel* label, QSlider* slider);
164 void onDoubleSliderMapped(QLabel* label, QSlider* slider);
167 void onResetBooleanMapped(QWidget* widget);
170 void onResetColorMapped(QWidget* widget);
173 void onResetIntegerMapped(QWidget* widget);
176 void onResetDoubleMapped(QWidget* widget);
179 void onSliderRangeMapped(QLabel* minLabel, QLabel* maxLabel, QSlider* slider);
182 void onDoubleSliderRangeMapped(QLabel* minLabel, QLabel* maxLabel, QSlider* slider);
187 QPushButton* createResetButton();
190 void createBoolWidget(QGridLayout& layout,
int row, const
std::
string& key, const
std::
string& defaultValue);
193 void createColorWidget(QGridLayout& layout,
int row, const
std::
string& key, const
std::
string& defaultValue);
196 void createDoubleWidget(QGridLayout& layout,
int row, const
std::
string& key,
double defaultValue,
197 double min,
double max,
int count);
200 void createDoubleSliderWidget(QGridLayout& layout,
int row, const
std::
string& key,
double defaultValue,
201 double min,
double max,
std::uint8_t decimals);
204 void createIntegerSliderWidget(QGridLayout& layout,
int row, const
std::
string& key,
205 int defaultValue,
int min,
int max);
208 void createIntegerSpinWidget(QGridLayout& layout,
int row, const
std::
string& key,
209 int defaultValue,
int min,
int max,
int count);
212 void createEnumWidget(QGridLayout& layout,
int row, const
std::
string& key, const
std::
string& defaultValue,
213 const
std::vector<
std::
string>& values, const
std::vector<
std::
string>& data);
216 void emitIntegerSignal(QObject* widget);
219 void emitDoubleSignal(QObject* spinbox);
222 void emitColorSignal(const QColor color, const
std::
string& key);
228 void setBoolParameter(
bool val,
std::
string key);
232 void setColorParameter(
std::array<
std::uint8_t, 4> color,
std::
string key);
235 void setDoubleParameter(
double val,
std::
string key);
238 void setDouble2Parameter(
double val0,
double val1,
std::
string key);
241 void setDouble3Parameter(
double val0,
double val1,
double val2,
std::
string key);
244 void setIntParameter(
int val,
std::
string key);
247 void setInt2Parameter(
int val0,
int val1,
std::
string key);
250 void setInt3Parameter(
int val0,
int val1,
int val2,
std::
string key);
253 void setEnumParameter(
std::
string val,
std::
string key);
256 void setIntMinParameter(
int min,
std::
string key);
259 void setIntMaxParameter(
int max,
std::
string key);
262 void setDoubleMinParameter(
double min,
std::
string key);
265 void setDoubleMaxParameter(
double max,
std::
string key);
269 QWidget* getParamWidget(const
std::
string& key);
272 static
double getDoubleSliderValue(const QSlider* slider);
276 static
void setDoubleSliderRange(QSlider* slider,
double currentValue);
279 template <typename T>
280 static
void setLabelMinimumSize(QLabel* label, T min, T max,
std::uint8_t decimals = 0);
283 static QString valueToStringLabel(T value,
std::uint8_t decimals);
286 void blockSignals(
bool block);
294 template<> inline QString
SParameters::valueToStringLabel<
int>(
int value,
std::uint8_t)
296 return QString(
"%1").arg(value);
301 template<>
inline QString SParameters::valueToStringLabel<double>(
double value, std::uint8_t decimals)
303 return QString::number(value,
'f', decimals);
309 void SParameters::setLabelMinimumSize(QLabel* label, T min, T max, std::uint8_t decimals)
311 const auto minString = valueToStringLabel(min, decimals);
312 const auto maxString = valueToStringLabel(max, decimals);
316 dummyLabel.setFont(label->font());
317 dummyLabel.setStyleSheet(label->styleSheet());
320 dummyLabel.setText(maxString);
321 const QSize sizeWithMaxValue = dummyLabel.sizeHint();
324 dummyLabel.setText(minString);
325 const QSize sizeWithMinValue = dummyLabel.sizeHint();
328 const QSize maxSize = sizeWithMaxValue.expandedTo(sizeWithMinValue);
329 label->setMinimumSize(maxSize);
::fwCom::Signal< void(double, std::string) > DoubleChangedSignalType
Double changed signal type.
Defines the service interface managing the editor service for object.
::fwCom::Signal< void(int, std::string) > IntegerChangedSignalType
Integer changed signal type.
Generic editor to interact with parameters.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
::fwCom::Signal< void(std::string, std::string) > EnumChangedSignalType
Enum changed signal type.
The namespace guiQt contains the basic services to build the application IHM with Qt...