summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
authordeva <deva>2010-08-13 08:24:46 +0000
committerdeva <deva>2010-08-13 08:24:46 +0000
commitdb2fdbe872cc6c1b224a1c4c735fac4369b3802e (patch)
treecb85d03da44b457c97c2595f8550d91ea7bb6a6d /client/widgets
parentbc229dbfabdf6a59453605e7652f04a268605b3a (diff)
Add missing children widgets to actual layouts.
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/altcombobox.cc8
-rw-r--r--client/widgets/frame.cc2
-rw-r--r--client/widgets/groupbox.cc2
-rw-r--r--client/widgets/metawidget.cc5
-rw-r--r--client/widgets/multilist.cc2
-rw-r--r--client/widgets/widget.cc14
-rw-r--r--client/widgets/widget.h5
-rw-r--r--client/widgets/window.cc2
8 files changed, 24 insertions, 16 deletions
diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc
index 66eb444..a4f5e76 100644
--- a/client/widgets/altcombobox.cc
+++ b/client/widgets/altcombobox.cc
@@ -97,7 +97,7 @@ AltComboBox::AltComboBox(QDomNode &node, MacroWindow *macrowindow)
altframe->setLayout(layout);
}
- addChildren(item);
+ addChildren(item, altframe->layout());
}
@@ -177,7 +177,13 @@ void AltComboBox::setValue(QString value, QString source)
void AltComboBox::onValueChange(int index)
{
+
QComboBox *cmb = (QComboBox*)combobox->qwidget();
+
+ printf("Value changed: %s altvalue: %s\n",
+ cmb->itemData(index).toString().toStdString().c_str(),
+ altvalue.toStdString().c_str());
+
if(cmb->itemData(index).toString() == altvalue) {
// altframe->setEnabled(true);
altframerepl->setVisible(false);
diff --git a/client/widgets/frame.cc b/client/widgets/frame.cc
index e117467..d6f8187 100644
--- a/client/widgets/frame.cc
+++ b/client/widgets/frame.cc
@@ -43,7 +43,7 @@ Frame::Frame(QDomNode &node, MacroWindow *macrowindow)
frame->layout()->setContentsMargins(0,0,0,0);
- addChildren(node);
+ addChildren(node, frame->layout());
}
Frame::~Frame()
diff --git a/client/widgets/groupbox.cc b/client/widgets/groupbox.cc
index 085a876..3c00fa4 100644
--- a/client/widgets/groupbox.cc
+++ b/client/widgets/groupbox.cc
@@ -49,7 +49,7 @@ GroupBox::GroupBox(QDomNode &node, MacroWindow *macrowindow)
groupbox->setTitle(elem.attribute("caption"));
}
- addChildren(node);
+ addChildren(node, groupbox->layout());
}
GroupBox::~GroupBox()
diff --git a/client/widgets/metawidget.cc b/client/widgets/metawidget.cc
index 9634c76..ff359f4 100644
--- a/client/widgets/metawidget.cc
+++ b/client/widgets/metawidget.cc
@@ -50,12 +50,15 @@ MetaWidget::MetaWidget(QDomNode &node, MacroWindow *macrowindow)
QDomElement elem = node.toElement();
storechildren = elem.attribute("storechildren", "false") == "true";
+ /*
// Create children
QDomNodeList children = node.childNodes();
for (int i=0; i<children.count();i++) {
QDomNode child = children.at(i);
widgetBuilder(child);
}
+ */
+ // addChildren(node);
// Setup format string
if(elem.hasAttribute("formatlanguage")) {
@@ -76,7 +79,7 @@ MetaWidget::MetaWidget(QDomNode &node, MacroWindow *macrowindow)
}
}
- addChildren(node);
+ addChildren(node, frame->layout());
// Connect all children wasChanged signal, to catch changes.
QVector< Widget* >::iterator i = widgets.begin();
diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc
index 2c4438f..cccad5a 100644
--- a/client/widgets/multilist.cc
+++ b/client/widgets/multilist.cc
@@ -95,7 +95,7 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow)
inputbox->layout()->setContentsMargins(0,0,0,0);
- addChildren(node);
+ addChildren(node, inputbox->layout());
innerwidget = NULL;
if(elem.hasAttribute("innerwidget")) {
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index 2205beb..93deb31 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -90,12 +90,12 @@ Widget::~Widget()
}
}
-void Widget::addChildren(QDomNode &node)
+void Widget::addChildren(QDomNode &node, QLayout *layout)
{
QDomNodeList children = node.childNodes();
for (int i=0; i<children.count();i++) {
QDomNode child = children.at(i);
- widgetBuilder(child);
+ widgetBuilder(child, layout);
}
}
@@ -236,7 +236,7 @@ void Widget::addChild(Widget *widget)
connect(widget, SIGNAL(wasChanged()), this, SLOT(childWasChanged()));
}
-void Widget::widgetBuilder(QDomNode &xml_node)
+void Widget::widgetBuilder(QDomNode &xml_node, QLayout *layout)
{
QDomElement xml_elem = xml_node.toElement();
@@ -250,9 +250,8 @@ void Widget::widgetBuilder(QDomNode &xml_node)
Widget *widget = NULL;
if(xml_elem.tagName() == "spacer") {
- if(qwidget() && qwidget()->layout()) {
- ((QBoxLayout*)qwidget()->layout())->addStretch();
- }
+ if(layout) ((QBoxLayout*)layout)->addStretch();
+
return; // This is not a real widget.
} else if(xml_elem.tagName() == "frame") {
@@ -333,8 +332,7 @@ void Widget::widgetBuilder(QDomNode &xml_node)
addChild(widget);
- if(qwidget() && qwidget()->layout())
- qwidget()->layout()->addWidget(widget->qwidget());
+ if(layout) layout->addWidget(widget->qwidget());
if(widget && widget->qwidget()) widget->qwidget()->show();
}
diff --git a/client/widgets/widget.h b/client/widgets/widget.h
index 9e493d0..960dca9 100644
--- a/client/widgets/widget.h
+++ b/client/widgets/widget.h
@@ -35,6 +35,7 @@
#include "lua.h"
+class QLayout;
class MacroWindow;
class LUA;
class Widget;
@@ -95,8 +96,8 @@ protected:
QWidget *widget;
bool hideChildren;
- void widgetBuilder(QDomNode &xml_node);
- void addChildren(QDomNode &xml_node);
+ void widgetBuilder(QDomNode &xml_node, QLayout *layout);
+ void addChildren(QDomNode &xml_node, QLayout *layout);
private:
QVector< Widget* > children;
diff --git a/client/widgets/window.cc b/client/widgets/window.cc
index f51cfd9..4d9253d 100644
--- a/client/widgets/window.cc
+++ b/client/widgets/window.cc
@@ -55,7 +55,7 @@ Window::Window(QDomNode &node, MacroWindow *macrowindow)
widget->setWindowTitle(elem.attribute("caption"));
}
- addChildren(node);
+ addChildren(node, widget->layout());
}
Window::~Window()