19 #include <QHBoxLayout> 21 #include "ui_arginfogui.h" 28 m_valueType(valueType),
37 QHBoxLayout *layout =
ui->argLayout;
42 ui->argEdit->setAlignment(Qt::AlignRight);
44 ui->argCombo->setLayoutDirection(Qt::RightToLeft);
50 layout->removeWidget(
ui->argCheck);
56 layout->removeWidget(
ui->argEdit);
62 layout->removeWidget(
ui->argCombo);
81 ui->argLabel->setText(text);
87 ui->argCheck->setToolTip(text);
89 ui->argEdit->setToolTip(text);
91 ui->argCombo->setToolTip(text);
97 ui->argUnits->setText(units);
127 ui->argCombo->addItem(text, QVariant(value));
202 int intValue = atoi(value.toStdString().c_str());
208 double doubleValue = atof(value.toStdString().c_str());
222 ui->argCombo->addItem(text, QVariant(value));
229 return value < round(m_minValue) ? round(m_minValue) : value > round(
m_maxValue) ? round(
m_maxValue) : value;
248 ui->argCheck->blockSignals(
true);
250 ui->argCheck->blockSignals(
false);
254 ui->argEdit->blockSignals(
true);
255 ui->argEdit->setText(QString(
m_boolValue ?
"true" :
"false"));
256 ui->argEdit->blockSignals(
false);
260 if (
ui->argCombo->count() > 1)
262 ui->argCombo->blockSignals(
true);
264 ui->argCombo->blockSignals(
false);
273 ui->argCheck->blockSignals(
true);
274 ui->argCheck->setChecked(
m_intValue == 0 ?
false :
true);
275 ui->argCheck->blockSignals(
false);
279 ui->argEdit->blockSignals(
true);
281 ui->argEdit->blockSignals(
false);
285 for (
int i = 0;
i <
ui->argCombo->count();
i++)
287 if (
ui->argCombo->itemData(
i).type() == QVariant::Int)
290 QVariant v =
ui->argCombo->itemData(
i);
294 ui->argCombo->blockSignals(
true);
295 ui->argCombo->setCurrentIndex(
i);
296 ui->argCombo->blockSignals(
false);
308 ui->argCheck->blockSignals(
true);
310 ui->argCheck->blockSignals(
false);
314 ui->argEdit->blockSignals(
true);
316 ui->argEdit->blockSignals(
false);
320 for (
int i = 0;
i <
ui->argCombo->count();
i++)
322 if (
ui->argCombo->itemData(
i).type() == QVariant::Double)
325 QVariant v =
ui->argCombo->itemData(
i);
329 ui->argCombo->blockSignals(
true);
330 ui->argCombo->setCurrentIndex(
i);
331 ui->argCombo->blockSignals(
false);
343 ui->argCheck->blockSignals(
true);
345 ui->argCheck->blockSignals(
false);
349 ui->argEdit->blockSignals(
true);
351 ui->argEdit->blockSignals(
false);
355 for (
int i = 0;
i <
ui->argCombo->count();
i++)
357 if (
ui->argCombo->itemData(
i).type() == QVariant::String)
359 QVariant v =
ui->argCombo->itemData(
i);
363 ui->argCombo->blockSignals(
true);
364 ui->argCombo->setCurrentIndex(
i);
365 ui->argCombo->blockSignals(
false);
388 QVariant v =
ui->argCombo->currentData();
391 if (v.type() == QVariant::Bool)
396 else if (v.type() == QVariant::Int)
404 else if (v.type() == QVariant::Double)
412 else if (v.type() ==QVariant::String)
void on_argCheck_toggled(bool checked)
void setUnits(const QString &units)
ArgInfoValueType m_valueType
void setRange(double min, double max)
void updateUIFromString()
double setDoubleValue(double value)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
ArgInfoGUI(ArgInfoType type, ArgInfoValueType valueType, QWidget *parent=0)
void on_argCombo_currentIndexChanged(int index)
int setIntegerValue(int value)
void setIntValue(int value)
void addIntValue(const QString &text, int value)
void on_argEdit_editingFinished()
void addFloatValue(const QString &text, double value)
void setToolTip(const QString &text)
void setBoolValue(bool value)
void addBoolValue(const QString &text, bool value)
void setFloatValue(double value)
void setLabel(const QString &text)
T max(const T &x, const T &y)
void addStringValue(const QString &text, const QString &value)
void setStringValue(const QString &value)
T min(const T &x, const T &y)