From da6e5427b1275d9bbaed9ddb3dbc15b09be99bb1 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 25 Aug 2008 14:04:04 +0000 Subject: Fixed regexp problem in combobox. --- client/widgets/combobox.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index 81995c6..8cf2c6b 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -68,6 +68,9 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) } } + // Hack to force currentIndexChanged event. + setCurrentIndex(-1); + /* // This is done later if(elem.hasAttribute("value")) { setValue(elem.attribute("value")); @@ -85,18 +88,12 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) case SELECT: setEditable(false); - // Hack to force currentIndexChanged event. - setCurrentIndex(-1); - connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(changed())); break; case EDIT: setEditable(true); - // Hack to force currentIndexChanged event. - setCurrentIndex(-1); - connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(changed())); //setEditText(elem.attribute("value")); break; @@ -107,7 +104,7 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) QString rxs = "("; for(int i = 0; i < itemlist.size(); i++) { if(rxs != "(") rxs += "|"; - rxs += itemlist.at(i); + rxs += QRegExp::escape(itemlist.at(i)); } rxs += ")"; rx = QRegExp(rxs); @@ -120,13 +117,12 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) setValidator(new QRegExpValidator(rx, this)); } - // Hack to force currentIndexChanged event. - setCurrentIndex(-1); - connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(changed())); //setEditText(elem.attribute("value")); break; } + + changed(); } QString ComboBox::getValue() -- cgit v1.2.3