mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 09:45:21 +03:00
Fixes #2484
This commit is contained in:
parent
b04295ad44
commit
0cf3aeef57
1 changed files with 17 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "genericpanel.h"
|
#include "genericpanel.h"
|
||||||
|
#include <QDebug>
|
||||||
class AutoComboBox: public QComboBox
|
class AutoComboBox: public QComboBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -13,6 +13,7 @@ class AutoComboBox: public QComboBox
|
||||||
QComboBox(parent),
|
QComboBox(parent),
|
||||||
field(NULL),
|
field(NULL),
|
||||||
panel(NULL),
|
panel(NULL),
|
||||||
|
next(0),
|
||||||
lock(false)
|
lock(false)
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
|
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
|
||||||
|
@ -22,10 +23,23 @@ class AutoComboBox: public QComboBox
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
QComboBox::clear();
|
QComboBox::clear();
|
||||||
|
next = 0;
|
||||||
lock = false;
|
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;
|
lock = true;
|
||||||
QComboBox::addItem(item, value);
|
QComboBox::addItem(item, value);
|
||||||
|
@ -78,6 +92,7 @@ class AutoComboBox: public QComboBox
|
||||||
protected:
|
protected:
|
||||||
int * field;
|
int * field;
|
||||||
GenericPanel * panel;
|
GenericPanel * panel;
|
||||||
|
int next;
|
||||||
bool lock;
|
bool lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue