summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2010-09-07 13:01:07 +0000
committerdeva <deva>2010-09-07 13:01:07 +0000
commitdb022622b6f98eeebc600e94829fb586583d61c7 (patch)
tree1ece39b0d3b138352bf22dc7e062a7f4d5bd1728 /client
parent49ecf45c89c4fea8ed9d041bf9f3fb508aa8e1f0 (diff)
Fix wierd behaviour in combobox, when used in colaboration with luadb.
Diffstat (limited to 'client')
-rw-r--r--client/widgets/combobox.cc44
1 files changed, 19 insertions, 25 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index 9d783a2..5eb9b9e 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -103,22 +103,29 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow)
switch(combotype) {
case SELECT:
- combobox->setEditable(false);
+ {
+ combobox->setEditable(false);
#ifndef STYLE_HACK
- combobox->setEditable(true);
- combobox->lineEdit()->setReadOnly(true);
- combobox->lineEdit()->installEventFilter(this);
+ combobox->setEditable(true);
+ combobox->lineEdit()->setReadOnly(true);
+ combobox->lineEdit()->installEventFilter(this);
#endif/*STYLE_HACK*/
- connect(combobox, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(changed()));
+ connect(combobox, SIGNAL(currentIndexChanged(QString)),
+ this, SLOT(changed()));
+ }
break;
case EDIT:
- combobox->setEditable(true);
-
- connect(combobox, SIGNAL(editTextChanged(QString)), this, SLOT(changed()));
+ {
+ combobox->setEditable(true);
+ connect(combobox, SIGNAL(editTextChanged(QString)),
+ this, SLOT(changed()));
+ QCompleter *completer = combobox->completer();
+ completer->setCaseSensitivity(Qt::CaseInsensitive);
+ completer->setCompletionMode(QCompleter::PopupCompletion);
+ }
break;
case SEARCH:
@@ -170,7 +177,6 @@ void ComboBox::setValue(QString value, QString source)
int idx = combobox->findData(value);
- // printf("setValue(\"%s\") - %d\n", value.toStdString().c_str(), idx);
if(combobox->currentIndex() != idx) {
ischangingbyuser = false;
combobox->setCurrentIndex(idx);
@@ -178,8 +184,6 @@ void ComboBox::setValue(QString value, QString source)
} else {
emit eventOnChange();
}
- // setInitialValue(value);
-
}
bool ComboBox::preValid()
@@ -194,8 +198,6 @@ bool ComboBox::preValid()
void ComboBox::changed()
{
if(ignoreChangeEvents == true) return;
-
- WARN(ComboBox, "changed");
if(ischangingbyuser) emit wasChanged();
emit eventOnChange();
}
@@ -203,8 +205,6 @@ void ComboBox::changed()
bool ComboBox::eventFilter(QObject *obj, QEvent *event)
{
if(ignoreChangeEvents == true) return false;
-
- WARN(ComboBox, "eventFilter");
if(combotype == SELECT) {
if(event->type() == QEvent::MouseButtonRelease) {
if(enabled()) combobox->showPopup();
@@ -216,12 +216,7 @@ bool ComboBox::eventFilter(QObject *obj, QEvent *event)
void ComboBox::changeEvent(QEvent *event)
{
- if(ignoreChangeEvents == true) return;
-
- WARN(ComboBox, "changeEvent");
- if(event->type() == QEvent::EnabledChange) {
- changed();
- }
+ if(event->type() == QEvent::EnabledChange) changed();
}
void ComboBox::setWdgValid(bool valid)
@@ -243,7 +238,6 @@ void ComboBox::setWdgValid(bool valid)
void ComboBox::clear()
{
ignoreChangeEvents = true;
- WARN(ComboBox, "clear");
combobox->clear();
ignoreChangeEvents = false;
}
@@ -264,9 +258,9 @@ QString ComboBox::lineEditValue()
void ComboBox::setLineEditValue(QString value)
{
+ ignoreChangeEvents = true;
if(combobox->lineEdit()) {
- ignoreChangeEvents = true;
combobox->lineEdit()->setText(value);
- ignoreChangeEvents = false;
}
+ ignoreChangeEvents = false;
}