diff options
Diffstat (limited to 'editor/editor.cc')
-rw-r--r-- | editor/editor.cc | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/editor/editor.cc b/editor/editor.cc index b2d418f..e7d8781 100644 --- a/editor/editor.cc +++ b/editor/editor.cc @@ -28,17 +28,58 @@ #include "toolbox.h" #include "macrowindow.h" +#include "propertieseditor.h" -#include "widgetwrapper.h" +#include <QDomDocument> +#include <QFile> + +#define OFFSET_X 300 +#define OFFSET_Y 300 +#define SPACING 10 int main(int argc, char *argv[]) { QApplication app(argc, argv); - Toolbox toolbox; - MacroWindow macrowindow(Qt::Horizontal); + + // + // Load xml data + // + QDomDocument doc("widgets"); + QFile file("widgets.xml"); + if (!file.open(QIODevice::ReadOnly)) + return 1; + if (!doc.setContent(&file)) { + file.close(); + return 1; + } + file.close(); + + QDomElement docElem = doc.documentElement(); + + QDomNode n = docElem.firstChild(); + QDomNode node; + while(!n.isNull()) { + QDomElement e = n.toElement(); + if(!e.isNull()) { + if(e.hasAttribute("name") && e.attribute("name") == "mainwidget") node = e; + } + n = n.nextSibling(); + } + + Toolbox toolbox(docElem); + toolbox.move(OFFSET_X, OFFSET_Y); + toolbox.show(); + + MacroWindow macrowindow(node); macrowindow.resize(400, 300); + macrowindow.move(toolbox.width() + OFFSET_X + SPACING, OFFSET_Y); macrowindow.show(); + propertieseditor = new PropertiesEditor(); + propertieseditor->setProperties(¯owindow); + propertieseditor->move(macrowindow.width() + toolbox.width() + OFFSET_X + 2 * SPACING, OFFSET_Y); + propertieseditor->show(); + return app.exec(); } |