//=============================================== // main.cpp //=============================================== int main(int argc, char** argv) { QApplication lApp(argc, argv); GWindow lWindow; lWindow.show(); return lApp.exec(); } //=============================================== // GWindow.cpp //=============================================== GWindow::GWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::GWindow) { ui->setupUi(this); } //===============================================
//=============================================== // main.cpp //=============================================== int main(int argc, char** argv) { QApplication lApp(argc, argv); GWindow lWindow; lWindow.show(); return lApp.exec(); } //=============================================== // GWindow.cpp //=============================================== GWindow::GWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::GWindow) { ui->setupUi(this); } //=============================================== void GWindow::on_actionOpen_triggered(bool checked) { qDebug() << __PRETTY_FUNCTION__; } //===============================================
//=============================================== // main.cpp //=============================================== int main(int argc, char** argv) { QGuiApplication lApp(argc, argv); QQmlApplicationEngine lEngine; const QUrl url(u"qrc:/qml/main.qml"_qs); QObject::connect(&lEngine, &QQmlApplicationEngine::objectCreationFailed, &lApp, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); lEngine.load(url); return lApp.exec(); } //===============================================
//=============================================== // main.qml //=============================================== Window { width: 400 height: 300 visible: true title: qsTr("ReadyApp") } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { width: 40; height: 40 color: "black" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom height: 40 color: "black" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GBottomBar { } } //=============================================== // GBottomBar.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom height: 40 color: "black" } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { width: 50; height: 50 color: "orange" } GBottomBar { } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" } GBottomBar { id: bottomBar } } //===============================================
//=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GRightScreen { } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { width: 50; height: 50 color: "blue" } GRightScreen { } GBottomBar { id: bottomBar } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 400 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(59.91, 10.75) zoomLevel: 14 } } //===============================================
//=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" Image { source: "/img/carRender.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" Image { width: parent.width * 0.75 source: "/img/carRender.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" Image { width: parent.width * 0.75 fillMode: Image.PreserveAspectFit source: "/img/carRender.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "blue" Image { anchors.centerIn: parent width: parent.width * 0.75 fillMode: Image.PreserveAspectFit source: "/img/carRender.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GLeftScreen.qml //=============================================== Rectangle { anchors.left: parent.left anchors.right: rightScreen.left anchors.top: parent.top anchors.bottom: bottomBar.top color: "white" Image { anchors.centerIn: parent width: parent.width * 0.75 fillMode: Image.PreserveAspectFit source: "/img/carRender.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(48.57, 7.75) zoomLevel: 14 } Image { anchors.left: parent.left anchors.top: parent.top anchors.margins: 10 width: 15 fillMode: Image.PreserveAspectFit source: "/img/lock.png" } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(48.57, 7.75) zoomLevel: 14 } Image { anchors.left: parent.left anchors.top: parent.top anchors.margins: 10 width: 15 fillMode: Image.PreserveAspectFit source: "/img/unlock.png" } } //===============================================
//=============================================== // GSystem.h //=============================================== class GSystem : public QObject { Q_OBJECT Q_PROPERTY(bool isCarLocked READ isCarLocked WRITE setCarLocked NOTIFY carLockedChanged) public: explicit GSystem(QObject *parent = nullptr); ~GSystem(); bool isCarLocked() const; public slots: void setCarLocked(bool _isCarLocked); signals: void carLockedChanged(bool _isCarLocked); private: bool m_isCarLocked; }; //=============================================== // GSystem.cpp //=============================================== GSystem::GSystem(QObject *parent) : QObject(parent) , m_isCarLocked(true) { } //=============================================== bool GSystem::isCarLocked() const { return m_isCarLocked; } //=============================================== void GSystem::setCarLocked(bool _isCarLocked) { if(m_isCarLocked != _isCarLocked) { m_isCarLocked = _isCarLocked; emit carLockedChanged(m_isCarLocked); } } //===============================================
//=============================================== // main.cpp //=============================================== int main(int argc, char** argv) { QGuiApplication lApp(argc, argv); GSystem lSystemHandler; QQmlApplicationEngine lEngine; const QUrl url(u"qrc:/qml/main.qml"_qs); QObject::connect(&lEngine, &QQmlApplicationEngine::objectCreationFailed, &lApp, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); lEngine.load(url); lEngine.rootContext()->setContextProperty("systemHandler", &lSystemHandler); return lApp.exec(); } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(48.57, 7.75) zoomLevel: 14 } Image { anchors.left: parent.left anchors.top: parent.top anchors.margins: 10 width: 15 fillMode: Image.PreserveAspectFit source: ( systemHandler.isCarLocked ? "/img/lock.png" : "/img/unlock.png" ) } } //===============================================
//=============================================== // main.qml //=============================================== Window { minimumWidth: 600 minimumHeight: 300 visible: true title: qsTr("ReadyApp") GLeftScreen { } GRightScreen { id: rightScreen } GBottomBar { id: bottomBar } } //=============================================== // GRightScreen.qml //=============================================== Rectangle { id: rightScreen anchors.top: parent.top anchors.bottom: bottomBar.top anchors.right: parent.right width: parent.width * 2/3 color: "orange" Plugin { id: mapPlugin name: "osm" } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(48.57, 7.75) zoomLevel: 14 } Image { anchors.left: parent.left anchors.top: parent.top anchors.margins: 10 width: 15 fillMode: Image.PreserveAspectFit source: ( systemHandler.isCarLocked ? "/img/lock.png" : "/img/unlock.png" ) MouseArea { anchors.fill: parent onClicked: systemHandler.setCarLocked(!systemHandler.isCarLocked) } } } //===============================================