From 37cd747953facf8c4ffed40dcef175391d15c388 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 13 Aug 2010 12:18:14 +0000 Subject: Child recursion setValue fix. Missing initialisation of hideChildren and missing check on valid(). --- client/widgets/altcombobox.cc | 2 +- client/widgets/checkbox.cc | 2 +- client/widgets/combobox.cc | 2 +- client/widgets/datetime.cc | 2 +- client/widgets/dbwidget.cc | 2 +- client/widgets/lineedit.cc | 2 +- client/widgets/listbox.cc | 2 +- client/widgets/metawidget.cc | 4 ++-- client/widgets/metawidget.h | 2 +- client/widgets/multilist.cc | 5 +++-- client/widgets/radiobuttons.cc | 2 +- client/widgets/textedit.cc | 2 +- client/widgets/widget.cc | 28 ++++++---------------------- client/widgets/widget.h | 6 +++++- 14 files changed, 26 insertions(+), 37 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc index 88ce376..e18fb59 100644 --- a/client/widgets/altcombobox.cc +++ b/client/widgets/altcombobox.cc @@ -171,7 +171,7 @@ void AltComboBox::setValue(QString value, QString source) } } - setInitialValue(value); + // setInitialValue(value); } void AltComboBox::onValueChange(int index) diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index af7d68f..6448298 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -91,7 +91,7 @@ void CheckBox::setValue(QString value, QString source) // If set operation did not change the value we must invocate the code manually. if(old == checkbox->isChecked()) state_change(0); - setInitialValue(value); + // setInitialValue(value); changedByUser = true; } diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index a167e29..c426e41 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -177,7 +177,7 @@ void ComboBox::setValue(QString value, QString source) combobox->setCurrentIndex(idx); ischangingbyuser = true; - setInitialValue(value); + // setInitialValue(value); } diff --git a/client/widgets/datetime.cc b/client/widgets/datetime.cc index b97178f..43977e3 100644 --- a/client/widgets/datetime.cc +++ b/client/widgets/datetime.cc @@ -118,7 +118,7 @@ void DateTime::setValue(QString value, QString source) datetimeedit->setDateTime(QDateTime::fromTime_t(value.toUInt())); - setInitialValue(value); + // setInitialValue(value); changedByUser = true; } diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc index 3852b21..4d6240c 100644 --- a/client/widgets/dbwidget.cc +++ b/client/widgets/dbwidget.cc @@ -126,7 +126,7 @@ void DBWidget::setValue(QString value, QString source) combobox->setEditText(value); - setInitialValue(value); + // setInitialValue(value); changedByUser = true; } diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index cddd59e..dbd0ca6 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -93,7 +93,7 @@ void LineEdit::setValue(QString value, QString source) lineedit->setText(value); - setInitialValue(value); + // setInitialValue(value); } bool LineEdit::eventFilter(QObject *, QEvent *event) diff --git a/client/widgets/listbox.cc b/client/widgets/listbox.cc index da234ab..b691650 100644 --- a/client/widgets/listbox.cc +++ b/client/widgets/listbox.cc @@ -123,7 +123,7 @@ void ListBox::setValue(QString value, QString source) listwidget->setCurrentRow(sel); - setInitialValue(value); + // setInitialValue(value); valueIsChangingByComputer = false; } diff --git a/client/widgets/metawidget.cc b/client/widgets/metawidget.cc index 55a8bd4..a179138 100644 --- a/client/widgets/metawidget.cc +++ b/client/widgets/metawidget.cc @@ -140,7 +140,7 @@ bool MetaWidget::setKeyboardFocus() } return false; } - +/* void MetaWidget::reset() { // If children are stored they will be reset individually. @@ -153,7 +153,7 @@ void MetaWidget::reset() } } } - +*/ void MetaWidget::setWdgValid(bool valid) { QPalette palette; diff --git a/client/widgets/metawidget.h b/client/widgets/metawidget.h index dd32adf..f44fd79 100644 --- a/client/widgets/metawidget.h +++ b/client/widgets/metawidget.h @@ -50,7 +50,7 @@ public: bool setKeyboardFocus(); - void reset(); + // void reset(); public slots: void changed(); diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc index 0160440..8544e06 100644 --- a/client/widgets/multilist.cc +++ b/client/widgets/multilist.cc @@ -183,7 +183,7 @@ void MultiList::setValue(QString values, QString source) idx++; } while(value != ""); - setInitialValue(values); + // setInitialValue(values); eventOnChange(); } @@ -205,7 +205,8 @@ void MultiList::add() list->addItem(innerwidget->value()); emit wasChanged(); - innerwidget->reset(); + // innerwidget->reset(); + innerwidget->setValues(); innerwidget_has_changes = false; eventOnChange(); diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc index 7f1bda7..5d9abb4 100644 --- a/client/widgets/radiobuttons.cc +++ b/client/widgets/radiobuttons.cc @@ -127,7 +127,7 @@ void RadioButtons::setValue(QString value, QString source) } } - setInitialValue(value); + // setInitialValue(value); } bool RadioButtons::setKeyboardFocus() diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc index 0b7ddde..b5d62e5 100644 --- a/client/widgets/textedit.cc +++ b/client/widgets/textedit.cc @@ -78,7 +78,7 @@ void TextEdit::setValue(QString value, QString source) { if(isUserSource(source)) emit wasChanged(); textedit->setText(value); - setInitialValue(value); + // setInitialValue(value); } bool TextEdit::eventFilter(QObject *, QEvent *event) diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index cd29d0a..e5ec498 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -55,14 +55,14 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow) widget_local = elem.hasAttribute("local") && elem.attribute("local") == "true"; - + /* if(elem.hasAttribute("prefilled")) { prefilled = elem.attribute("prefilled"); } - - has_initial_value = elem.hasAttribute("name") && elem.hasAttribute("value"); + */ + has_lazy = elem.hasAttribute("name") && elem.hasAttribute("value"); lazy_value = elem.attribute("value", ""); - lazy_source = elem.attribute("prefilled", ""); + lazy_source = elem.attribute("prefilled", "pracro"); if((hasOnChangeEvent = elem.hasAttribute("onChange"))) { onChangeEventScript = elem.attribute("onChange"); @@ -116,6 +116,8 @@ bool Widget::valid() if(preValid() == false) return false; if(is_valid == false) return false; + if(hideChildren) return true; + QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { if(*i && (*i)->valid() == false) return false; @@ -131,24 +133,6 @@ void Widget::setValid(bool valid) setWdgValid(valid); } -void Widget::setInitialValue(QString value) -{ - if(!has_initial_value) { - initial_value = value; - has_initial_value = true; - } -} - -bool Widget::hasInitialValue() -{ - return has_initial_value; -} - -void Widget::reset() -{ - setValue(initial_value, ""); -} - void Widget::eventOnChange() { if(enabled() && hasOnChangeEvent) diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 2a95294..ef22c18 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -69,9 +69,11 @@ public: virtual bool setKeyboardFocus(); + /* void setInitialValue(QString value); bool hasInitialValue(); virtual void reset(); + */ QWidget *qwidget() { return widget; } @@ -119,11 +121,13 @@ private: bool hasOnChangeEvent; QString onChangeEventScript; + /* QString initial_value; QString initial_source; bool has_initial_value; - QString prefilled; + */ + }; #endif/*__PRACRO_WIDGET_H__*/ -- cgit v1.2.3