From 80c5c2f5f774213064dbcce79ca446e8b008f66a Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 30 Mar 2015 23:09:55 +0200 Subject: [PATCH] [Companion] Hide items in Switches Lists rather than disable them --- companion/src/helpers.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index f52aa506d..4640f298f 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -413,12 +413,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) { item = RawSwitch(SWITCH_TYPE_SWITCH, i); - b->addItem(item.toString(), item.toValue()); if (IS_TARANIS(GetCurrentFirmware()->getBoard()) && !generalSettings.switchPositionAllowedTaranis(i)){ - QModelIndex index = b->model()->index(b->count()-1, 0); - QVariant v(0); - b->model()->setData(index, v, Qt::UserRole - 1); + continue; } + b->addItem(item.toString(), item.toValue()); if (item == value) b->setCurrentIndex(b->count()-1); } @@ -437,12 +435,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) { item = RawSwitch(SWITCH_TYPE_SWITCH, i); - b->addItem(item.toString(), item.toValue()); if (IS_TARANIS(GetCurrentFirmware()->getBoard()) && !generalSettings.switchPositionAllowedTaranis(i)){ - QModelIndex index = b->model()->index(b->count()-1, 0); - QVariant v(0); - b->model()->setData(index, v, Qt::UserRole - 1); + continue; } + b->addItem(item.toString(), item.toValue()); if (item == value) b->setCurrentIndex(b->count()-1); }