Changed from QQuickView to QQmlApplication Engine.

This commit is contained in:
greek 2024-05-31 13:56:24 +01:00
parent 8bb03932d2
commit 2e9f2133d6
4 changed files with 16 additions and 13 deletions

View file

@ -1,7 +1,7 @@
#include <QQmlContext> #include <QQmlContext>
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
#include <cstddef>
#include <qqml.h> #include <qqml.h>
#include <qqmlapplicationengine.h>
#include <qquickview.h> #include <qquickview.h>
#include <qurl.h> #include <qurl.h>
@ -9,8 +9,5 @@
MainWindow::MainWindow(QWindow *parent) MainWindow::MainWindow(QWindow *parent)
{ {
QQuickView::setTitle("Roulette Payout"); load(QUrl("../Root.qml"));
setSource(QUrl("../Root.qml"));
} }

View file

@ -1,9 +1,10 @@
#pragma once #pragma once
#include <QQuickView> #include <QQmlApplicationEngine>
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
#include <qqmlapplicationengine.h>
class MainWindow : public QQuickView class MainWindow : public QQmlApplicationEngine
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT QML_ELEMENT

View file

@ -4,11 +4,18 @@ import QtQuick.Layouts
import roulette import roulette
Pane { Window {
id: rootWindow
height: 500 height: 500
width: 1000 width: 1000
PlayerAreaView { title: "Roulette Payout"
visible: true
Pane {
id: rootWindow
anchors.fill: parent
PlayerAreaView {
id: playerAreaView
}
} }
} }

View file

@ -1,5 +1,4 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QQuickView>
#include "MainWindow.h" #include "MainWindow.h"
@ -8,7 +7,6 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
MainWindow view; MainWindow view;
view.show();
return app.exec(); return app.exec();
} }