summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
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;
}