diff options
author | deva <deva> | 2010-08-13 13:53:41 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-13 13:53:41 +0000 |
commit | 843221d0826ed0a53a94e84772f89c482f80776a (patch) | |
tree | 551b414c756d428e205a99bd7f51b075bd5107f3 /client/widgets/multilist.cc | |
parent | 37cd747953facf8c4ffed40dcef175391d15c388 (diff) |
Add default layout, if illigal type is specified (crash bug).
Diffstat (limited to 'client/widgets/multilist.cc')
-rw-r--r-- | client/widgets/multilist.cc | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc index 8544e06..92cdf29 100644 --- a/client/widgets/multilist.cc +++ b/client/widgets/multilist.cc @@ -39,6 +39,9 @@ #include "common.h" #include "macrowindow.h" +//#define DEBUG(fmt...) printf("MultiList (%p)",this);printf(fmt);fflush(stdout) +#define DEBUG(ftm...) + MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { @@ -48,10 +51,9 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) hideChildren = true; innerwidget_has_changes = false; - setCommonAttributes(frame, node); - QGridLayout *layout = new QGridLayout(); + QGridLayout *layout = new QGridLayout(frame); frame->setLayout(layout); list = new QListWidget(frame); @@ -81,14 +83,17 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) QDomElement elem = node.toElement(); if(elem.hasAttribute("layout")) { if(elem.attribute("layout") == "hbox") { - QHBoxLayout *layout = new QHBoxLayout(); + QHBoxLayout *layout = new QHBoxLayout(inputbox); inputbox->setLayout(layout); } else if (elem.attribute("layout") == "vbox") { - QVBoxLayout *layout = new QVBoxLayout(); + QVBoxLayout *layout = new QVBoxLayout(inputbox); + inputbox->setLayout(layout); + } else { // layout not set + QVBoxLayout *layout = new QVBoxLayout(inputbox); inputbox->setLayout(layout); } } else { - QHBoxLayout *layout = new QHBoxLayout(); + QHBoxLayout *layout = new QHBoxLayout(inputbox); inputbox->setLayout(layout); } @@ -102,11 +107,11 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) if(innerwidget) { connect(innerwidget, SIGNAL(wasChanged()), this, SLOT(changed())); } else { - printf("ERROR: Inner Widget %s not found (in multilist)!\n", - elem.attribute("innerwidget").toStdString().c_str()); + DEBUG("ERROR: Inner Widget %s not found (in multilist)!\n", + elem.attribute("innerwidget").toStdString().c_str()); } } else { - printf("ERROR: Missing 'innerwidget' attribute on multilist!\n"); + DEBUG("ERROR: Missing 'innerwidget' attribute on multilist!\n"); } layout->setContentsMargins(0,0,0,0); @@ -120,7 +125,7 @@ MultiList::~MultiList() void MultiList::changed() { innerwidget_has_changes = true; - printf("Multilist innerwidget was changed\n"); + DEBUG("Multilist innerwidget was changed\n"); } @@ -183,8 +188,6 @@ void MultiList::setValue(QString values, QString source) idx++; } while(value != ""); - // setInitialValue(values); - eventOnChange(); } @@ -201,11 +204,10 @@ void MultiList::remove() void MultiList::add() { - if(innerwidget && innerwidget->valid()) { + if(innerwidget && innerwidget->valid(true)) { list->addItem(innerwidget->value()); emit wasChanged(); - // innerwidget->reset(); innerwidget->setValues(); innerwidget_has_changes = false; |