Fixes #2484
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user