summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
authordeva <deva>2010-08-31 09:34:19 +0000
committerdeva <deva>2010-08-31 09:34:19 +0000
commit43e82b32f2d812225e6d7ef76efdbf4873efc343 (patch)
treedf5ace9b3fb39b7e58145c185e63e2ce5a8d8466 /client/widgets
parentf3847624ee5f99a37cf60be52067ad19bcdb4446 (diff)
luaComboBox and luaDB fixes and improvements.
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/combobox.cc32
-rw-r--r--client/widgets/combobox.h4
2 files changed, 36 insertions, 0 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index b625848..9d783a2 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -64,6 +64,8 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow)
combobox = new MyQComboBox();
widget = combobox;
+ ignoreChangeEvents = false;
+
setCommonAttributes(combobox, node);
#ifdef STYLE_HACK
@@ -191,12 +193,18 @@ bool ComboBox::preValid()
void ComboBox::changed()
{
+ if(ignoreChangeEvents == true) return;
+
+ WARN(ComboBox, "changed");
if(ischangingbyuser) emit wasChanged();
emit eventOnChange();
}
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();
@@ -208,6 +216,9 @@ 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();
}
@@ -231,10 +242,31 @@ void ComboBox::setWdgValid(bool valid)
void ComboBox::clear()
{
+ ignoreChangeEvents = true;
+ WARN(ComboBox, "clear");
combobox->clear();
+ ignoreChangeEvents = false;
}
void ComboBox::addItem(QString item)
{
+ ignoreChangeEvents = true;
combobox->addItem(item, item);
+ ignoreChangeEvents = false;
+}
+
+QString ComboBox::lineEditValue()
+{
+ if(combobox->lineEdit()) return combobox->lineEdit()->text();
+ return "";
+
+}
+
+void ComboBox::setLineEditValue(QString value)
+{
+ if(combobox->lineEdit()) {
+ ignoreChangeEvents = true;
+ combobox->lineEdit()->setText(value);
+ ignoreChangeEvents = false;
+ }
}
diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h
index 02b4ccd..ec8c9ba 100644
--- a/client/widgets/combobox.h
+++ b/client/widgets/combobox.h
@@ -50,6 +50,9 @@ public:
QString value();
void setValue(QString value, QString source = "");
+ QString lineEditValue();
+ void setLineEditValue(QString value);
+
bool preValid();
void setWdgValid(bool valid);
@@ -71,6 +74,7 @@ private:
bool ischangingbyuser;
QComboBox *combobox;
+ bool ignoreChangeEvents;
};
#endif/*__PRACRO_COMBOBOX_H__*/