#include "mainwindow.h" #include "ui_mainwindow.h" #include "globalvar.h" #include #include #include #include #include "sharedata.h" #include #include QmlShareData gGlobal; MainWindow::MainWindow(QWidget *parent) : QssMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QQuickWidget *m_quickWidget=new QQuickWidget(); QQmlEngine *engine = m_quickWidget->engine(); QQmlContext* ctx = engine->rootContext(); ctx->setContextProperty("DataWrap", &gGlobal); QUrl source("qrc:/main.qml"); m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView ); m_quickWidget->setSource(source); // m_quickWidget->rootContext()->setContextProperty("DataWrap",&gGlobal); this->setStyleSheet("margin: 0px;"); gGlobal.SetQuickView(m_quickWidget); ui->centralwidget->layout()->addWidget(m_quickWidget); } MainWindow::~MainWindow() { delete ui; }