35 lines
789 B
C++
35 lines
789 B
C++
|
#include "mainwindow.h"
|
||
|
#include "ui_mainwindow.h"
|
||
|
#include "globalvar.h"
|
||
|
#include <QQuickView>
|
||
|
#include <QtQuickWidgets/QQuickWidget>
|
||
|
#include <QQmlComponent>
|
||
|
#include <QQmlContext>
|
||
|
#include "sharedata.h"
|
||
|
#include <QLayout>
|
||
|
|
||
|
ShareData gGlobal;
|
||
|
|
||
|
|
||
|
MainWindow::MainWindow(QWidget *parent) :
|
||
|
QssMainWindow(parent),
|
||
|
ui(new Ui::MainWindow)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
QQuickWidget *m_quickWidget=new QQuickWidget();
|
||
|
QUrl source("qrc:/main.qml");
|
||
|
m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView );
|
||
|
m_quickWidget->setSource(source);
|
||
|
m_quickWidget->rootContext()->setContextProperty("DataWrap",&gGlobal);
|
||
|
|
||
|
|
||
|
gGlobal.SetQuickView(m_quickWidget);
|
||
|
ui->centralwidget->layout()->addWidget(m_quickWidget);
|
||
|
|
||
|
}
|
||
|
|
||
|
MainWindow::~MainWindow()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|