1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00
This commit is contained in:
bsongis 2015-07-18 13:08:45 +02:00
parent b04295ad44
commit 0cf3aeef57

View file

@ -3,7 +3,7 @@
#include <QComboBox>
#include "genericpanel.h"
#include <QDebug>
class AutoComboBox: public QComboBox
{
Q_OBJECT
@ -13,6 +13,7 @@ class AutoComboBox: public QComboBox
QComboBox(parent),
field(NULL),
panel(NULL),
next(0),
lock(false)
{
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
@ -22,10 +23,23 @@ class AutoComboBox: public QComboBox
{
lock = true;
QComboBox::clear();
next = 0;
lock = false;
}
void addItem(const QString & item, int value)
virtual void insertItems(int index, const QStringList & items)
{
foreach(QString item, items) {
addItem(item);
}
}
virtual void addItem(const QString & item)
{
addItem(item, next++);
}
virtual void addItem(const QString & item, int value)
{
lock = true;
QComboBox::addItem(item, value);
@ -78,6 +92,7 @@ class AutoComboBox: public QComboBox
protected:
int * field;
GenericPanel * panel;
int next;
bool lock;
};