summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/widgets/common.cc10
-rw-r--r--client/widgets/multilist.cc28
2 files changed, 22 insertions, 16 deletions
diff --git a/client/widgets/common.cc b/client/widgets/common.cc
index 3d4458d..c545ed8 100644
--- a/client/widgets/common.cc
+++ b/client/widgets/common.cc
@@ -82,14 +82,18 @@ void setCommonLayout(QWidget *widget, QDomNode &node)
if(elem.hasAttribute("layout")) {
if(elem.attribute("layout") == "hbox") {
- QHBoxLayout *layout = new QHBoxLayout();
+ QHBoxLayout *layout = new QHBoxLayout(widget);
widget->setLayout(layout);
} else if (elem.attribute("layout") == "vbox") {
- QVBoxLayout *layout = new QVBoxLayout();
+ QVBoxLayout *layout = new QVBoxLayout(widget);
+ widget->setLayout(layout);
+ } else { // Illigal layout choosen.
+ QVBoxLayout *layout = new QVBoxLayout(widget);
widget->setLayout(layout);
}
+
} else {
- QHBoxLayout *layout = new QHBoxLayout();
+ QHBoxLayout *layout = new QHBoxLayout(widget);
widget->setLayout(layout);
}
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;