Use item models for ui lists

This commit is contained in:
elecpower
2021-12-17 17:08:49 +01:00
committed by Raphael Coeffic
parent 83b676b4dd
commit 9a07b83b00
3 changed files with 103 additions and 8 deletions
+5 -8
View File
@@ -990,6 +990,9 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
{
ui->setupUi(this);
AbstractStaticItemModel *fsConfig = ModelData::funcSwitchConfigItemModel();
AbstractStaticItemModel *fsStart = ModelData::funcSwitchStartItemModel();
lock = true;
QRegExp rx(CHAR_FOR_NAMES_REGEX);
@@ -1005,19 +1008,13 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
aleName->setValidator(new QRegExpValidator(rx, this));
aleName->setField((char *)model.functionSwitchNames[i], 3);
// TODO itemmodel
QComboBox * cboConfig = new QComboBox(this);
cboConfig->setProperty("index", i);
cboConfig->addItem(tr("NONE"));
cboConfig->addItem(tr("TOGGLE"));
cboConfig->addItem(tr("2POS"));
cboConfig->setModel(fsConfig);
// TODO itemmodel
QComboBox * cboStartPosn = new QComboBox(this);
cboStartPosn->setProperty("index", i);
cboStartPosn->addItem(CPN_STR_SW_INDICATOR_UP);
cboStartPosn->addItem(CPN_STR_SW_INDICATOR_DN);
cboStartPosn->addItem("=");
cboStartPosn->setModel(fsStart);
QSpinBox * sbGroup = new QSpinBox(this);
sbGroup->setProperty("index", i);