33 #include <QErrorMessage>
38 #include <QDoubleSpinBox>
47 , defaultHWSettingsWidget(new Ui_DefaultHwSettings)
49 Q_ASSERT(settingsObj);
51 defaultHWSettingsWidget->setupUi(
this);
54 qobject_cast<QFormLayout *>(defaultHWSettingsWidget->portSettingsFrame->layout());
59 for (
int i = 0;
i < fields.size();
i++) {
60 switch (fields[
i]->getType()) {
63 wdg =
new QComboBox(
this);
70 QSpinBox *sbx =
new QSpinBox(
this);
71 if (fields[
i]->getUnits().length())
72 sbx->setSuffix(QString(
" %1").arg(fields[
i]->getUnits()));
73 sbx->setDisplayIntegerBase(fields[
i]->getDisplayIntegerBase());
74 sbx->setPrefix(fields[
i]->getDisplayPrefix());
80 if (fields[
i]->getUnits().length())
81 sbx->
setSuffix(QString(
" %1").arg(fields[
i]->getUnits()));
88 QDoubleSpinBox *sbx =
new QDoubleSpinBox(
this);
89 if (fields[
i]->getUnits().length())
90 sbx->setSuffix(QString(
" %1").arg(fields[
i]->getUnits()));
95 wdg =
new QLineEdit(
this);
101 QStringList objRelation;
102 objRelation.append(QString(
"objname:%1").arg(settingsObj->
getName()));
103 objRelation.append(QString(
"fieldname:%1").arg(fields[
i]->getName()));
104 objRelation.append(QString(
"buttongroup:1"));
105 objRelation.append(QString(
"haslimits:yes"));
107 wdg->setProperty(
"objrelation", objRelation);
109 lbl =
new QLabel(fields[
i]->getName(),
this);
110 layout->addRow(lbl, wdg);
128 delete defaultHWSettingsWidget;
void setPrefix(const QString &prefix)
void setDisplayIntegerBase(int base)
DefaultHwSettingsWidget(UAVObject *settingsObj, QWidget *parent=nullptr)
DefaultHwSettingsWidget::DefaultHwSettingsWidget Constructed when either a new board connection is es...
~DefaultHwSettingsWidget()
void setSuffix(const QString &suffix)
QList< UAVObjectField * > getFields()