|
@@ -10,13 +10,29 @@ class QmlWindow : public QMainWindow
|
10
|
10
|
public:
|
11
|
11
|
QmlWindow(QWidget *parent = NULL);
|
12
|
12
|
Q_INVOKABLE QAction *addMenuItem(QString menu, QString item);
|
|
13
|
+signals:
|
|
14
|
+ void newPoint(QVariantMap pointDescription);
|
13
|
15
|
private:
|
14
|
16
|
QHash<QString,QMenu *> menus;
|
15
|
17
|
};
|
16
|
18
|
|
17
|
19
|
QmlWindow::QmlWindow(QWidget *parent) : QMainWindow(parent)
|
18
|
20
|
{
|
19
|
|
-
|
|
21
|
+ QmlApplicationViewer *viewer = new QmlApplicationViewer;
|
|
22
|
+ viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
|
23
|
+ viewer->rootContext()->setContextProperty("window", this);
|
|
24
|
+ viewer->setSource(QUrl("qrc:/qml/qml/BrewPlot/main.qml"));
|
|
25
|
+ qApp->connect(viewer->engine(), SIGNAL(quit()), SLOT(quit()));
|
|
26
|
+ QWidget *central = new QWidget;
|
|
27
|
+ QHBoxLayout *layout = new QHBoxLayout;
|
|
28
|
+ NewPointControl *control = new NewPointControl;
|
|
29
|
+ layout->addWidget(control);
|
|
30
|
+ layout->addWidget(viewer);
|
|
31
|
+ central->setLayout(layout);
|
|
32
|
+ setCentralWidget(central);
|
|
33
|
+ viewer->setMinimumSize(viewer->sizeHint());
|
|
34
|
+ connect(control, SIGNAL(newPoint(QVariantMap)),
|
|
35
|
+ this, SIGNAL(newPoint(QVariantMap)));
|
20
|
36
|
}
|
21
|
37
|
|
22
|
38
|
QAction *QmlWindow::addMenuItem(QString menu, QString item)
|
|
@@ -45,19 +61,6 @@ int main(int argc, char *argv[])
|
45
|
61
|
|
46
|
62
|
QmlWindow *window = new QmlWindow(NULL);
|
47
|
63
|
window->setWindowTitle("BrewPlot");
|
48
|
|
- QmlApplicationViewer *viewer = new QmlApplicationViewer;
|
49
|
|
- viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
50
|
|
- viewer->rootContext()->setContextProperty("window", window);
|
51
|
|
- viewer->setSource(QUrl("qrc:/qml/qml/BrewPlot/main.qml"));
|
52
|
|
- app.connect(viewer->engine(), SIGNAL(quit()), SLOT(quit()));
|
53
|
|
- QWidget *central = new QWidget;
|
54
|
|
- QHBoxLayout *layout = new QHBoxLayout;
|
55
|
|
- NewPointControl *control = new NewPointControl;
|
56
|
|
- layout->addWidget(control);
|
57
|
|
- layout->addWidget(viewer);
|
58
|
|
- central->setLayout(layout);
|
59
|
|
- window->setCentralWidget(central);
|
60
|
|
- viewer->setMinimumSize(viewer->sizeHint());
|
61
|
64
|
window->show();
|
62
|
65
|
|
63
|
66
|
return app.exec();
|