diff --git a/pokerth_qml-client.pro b/pokerth_qml-client.pro new file mode 100644 index 00000000..45ce8b79 --- /dev/null +++ b/pokerth_qml-client.pro @@ -0,0 +1,30 @@ +TEMPLATE = app +QT += core qml quick widgets + +DEFINES += QML_CLIENT + +INCLUDEPATH += \ + src/gui/qml \ + src/gui/qml/views + +DEPENDPATH += \ + src \ + src/gui/qml \ + src/gui/qml/views + +RESOURCES += src/gui/qml/views/qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = src/gui/qml/views/ + +# Default rules for deployment. +include(src/gui/qml/views/deployment.pri) + +HEADERS += \ + src/gui/qml/qmlwrapper.h \ + src/gui/qml/views/startview/startview.h \ + +SOURCES += \ + src/pokerth.cpp \ + src/gui/qml/qmlwrapper.cpp \ + src/gui/qml/views/startview/startview.cpp diff --git a/src/gui/qml/qmlwrapper.cpp b/src/gui/qml/qmlwrapper.cpp new file mode 100644 index 00000000..7d3d159b --- /dev/null +++ b/src/gui/qml/qmlwrapper.cpp @@ -0,0 +1,19 @@ +#include +#include "qmlwrapper.h" + +#include "views/startview/startview.h" + + +qmlWrapper::qmlWrapper() +{ + qDebug("qmlWrapperKonstruktor"); + + startView myStartView; + myStartView.show(); +} + +qmlWrapper::~qmlWrapper() +{ + +} + diff --git a/src/gui/qml/qmlwrapper.h b/src/gui/qml/qmlwrapper.h new file mode 100644 index 00000000..496cea10 --- /dev/null +++ b/src/gui/qml/qmlwrapper.h @@ -0,0 +1,12 @@ +#ifndef QMLWRAPPER_H +#define QMLWRAPPER_H + + +class qmlWrapper +{ +public: + qmlWrapper(); + ~qmlWrapper(); +}; + +#endif // QMLWRAPPER_H diff --git a/src/gui/qml/views/MainForm.ui.qml b/src/gui/qml/views/MainForm.ui.qml new file mode 100644 index 00000000..e557debb --- /dev/null +++ b/src/gui/qml/views/MainForm.ui.qml @@ -0,0 +1,31 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +Item { + width: 640 + height: 480 + + property alias button3: button3 + property alias button2: button2 + property alias button1: button1 + + RowLayout { + anchors.centerIn: parent + + Button { + id: button1 + text: qsTr("Press Me 1") + } + + Button { + id: button2 + text: qsTr("Press Me 2") + } + + Button { + id: button3 + text: qsTr("Press Me 3") + } + } +} diff --git a/src/gui/qml/views/deployment.pri b/src/gui/qml/views/deployment.pri new file mode 100644 index 00000000..5441b63d --- /dev/null +++ b/src/gui/qml/views/deployment.pri @@ -0,0 +1,27 @@ +android-no-sdk { + target.path = /data/user/qt + export(target.path) + INSTALLS += target +} else:android { + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + export(target.path) + INSTALLS += target +} else:unix { + isEmpty(target.path) { + qnx { + target.path = /tmp/$${TARGET}/bin + } else { + target.path = /opt/$${TARGET}/bin + } + export(target.path) + } + INSTALLS += target +} + +export(INSTALLS) diff --git a/src/gui/qml/views/main.cpp b/src/gui/qml/views/main.cpp new file mode 100644 index 00000000..1e5bf587 --- /dev/null +++ b/src/gui/qml/views/main.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} diff --git a/src/gui/qml/views/main.qml b/src/gui/qml/views/main.qml new file mode 100644 index 00000000..e09bc3d4 --- /dev/null +++ b/src/gui/qml/views/main.qml @@ -0,0 +1,42 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 + +ApplicationWindow { + title: qsTr("Hello World") + width: 640 + height: 480 + visible: true + + menuBar: MenuBar { + Menu { + title: qsTr("&File") + MenuItem { + text: qsTr("&Open") + onTriggered: messageDialog.show(qsTr("Open action triggered")); + } + MenuItem { + text: qsTr("E&xit") + onTriggered: Qt.quit(); + } + } + } + + MainForm { + anchors.fill: parent + button1.onClicked: messageDialog.show(qsTr("Button 1 pressed")) + button2.onClicked: messageDialog.show(qsTr("Button 2 pressed")) + button3.onClicked: messageDialog.show(qsTr("Button 3 pressed")) + } + + MessageDialog { + id: messageDialog + title: qsTr("May I have your attention, please?") + + function show(caption) { + messageDialog.text = caption; + messageDialog.open(); + } + } +} diff --git a/src/gui/qml/views/qml.qrc b/src/gui/qml/views/qml.qrc new file mode 100644 index 00000000..7684346a --- /dev/null +++ b/src/gui/qml/views/qml.qrc @@ -0,0 +1,6 @@ + + + main.qml + MainForm.ui.qml + + diff --git a/src/gui/qml/views/startview/startview.cpp b/src/gui/qml/views/startview/startview.cpp new file mode 100644 index 00000000..dc7b2b28 --- /dev/null +++ b/src/gui/qml/views/startview/startview.cpp @@ -0,0 +1,19 @@ +#include +#include "startview.h" + +startView::startView() +{ + qDebug("startViewKonstruktor"); + myEngine = new QQmlApplicationEngine(); +} + +startView::~startView() +{ + +} + +void startView::show() +{ + qDebug("show mal bitte"); + myEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); +} diff --git a/src/gui/qml/views/startview/startview.h b/src/gui/qml/views/startview/startview.h new file mode 100644 index 00000000..ca39b3fe --- /dev/null +++ b/src/gui/qml/views/startview/startview.h @@ -0,0 +1,17 @@ +#ifndef STARTVIEW_H +#define STARTVIEW_H + +class QQmlApplicationEngine; +class startView +{ +public: + startView(); + ~startView(); + + void show(); + +private: + QQmlApplicationEngine *myEngine; +}; + +#endif // STARTVIEW_H