summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/lineedit.cc5
-rw-r--r--client/widgets/widget.cc22
2 files changed, 15 insertions, 12 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc
index 918f152..6b231f3 100644
--- a/client/widgets/lineedit.cc
+++ b/client/widgets/lineedit.cc
@@ -89,8 +89,9 @@ void LineEdit::setValue(QString value, QString source)
{
if(isUserSource(source)) emit wasChanged();
- if(lineedit->text() == value)
- lineedit->setText(value + " "); // Hack to make sure the textChanged signal is emitted.
+ // Hack to make sure the textChanged signal is emitted.
+ if(lineedit->text() == value) lineedit->setText(value + " ");
+
lineedit->setText(value);
setInitialValue(value);
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index af03843..2205beb 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -75,12 +75,6 @@ Widget::~Widget()
name().toStdString().c_str(),
type().toStdString().c_str());
- /* // This is done by Qt
- if(widget) {
- delete widget;
- widget = NULL;
- }
- */
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
if(*i) delete *i;
@@ -88,6 +82,12 @@ Widget::~Widget()
}
children.clear();
+
+ // This MUST be done after the deletion of the children Widget list.
+ if(widget) {
+ delete widget;
+ widget = NULL;
+ }
}
void Widget::addChildren(QDomNode &node)
@@ -121,7 +121,7 @@ bool Widget::valid()
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- if((*i)->valid() == false) return false;
+ if(*i && (*i)->valid() == false) return false;
i++;
}
@@ -194,8 +194,10 @@ Widget *Widget::findWidget(QString n, bool deep)
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- Widget *w = (*i)->findWidget(n, deep);
- if(w) return w;
+ if(*i) {
+ Widget *w = (*i)->findWidget(n, deep);
+ if(w) return w;
+ }
i++;
}
@@ -212,7 +214,7 @@ QVector< Widget* > Widget::widgetList(bool deep)
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- lst += (*i)->widgetList(deep);
+ if(*i) lst += (*i)->widgetList(deep);
i++;
}