Commit 9fe18509 authored by Sebastian Gottfried's avatar Sebastian Gottfried
Browse files

Use QQuickView To Render The Trainer QtQuick Scene

QQuickView is supposed to be faster than QQuickWidget and it makes
Shortcut element working which previously never triggered a shortcut
invocation.
parent 8fa790e2
......@@ -21,7 +21,7 @@
#include <QPointer>
#include <QDialogButtonBox>
#include <QMenu>
#include <QQuickWidget>
#include <QQuickView>
#include "application.h"
#include "colorsconfigwidget.h"
......@@ -49,7 +49,7 @@
const QString keyboardKCMName = "kcm_keyboard";
KTouchContext::KTouchContext(KMainWindow* mainWindow, QQuickWidget* view, QObject *parent) :
KTouchContext::KTouchContext(KMainWindow* mainWindow, QQuickView* view, QObject *parent) :
QObject(parent),
m_actionCollection(new KActionCollection(this)),
m_menu(new QMenu(mainWindow)),
......
......@@ -21,7 +21,7 @@
#include <QObject>
class QMenu;
class QQuickWidget;
class QQuickView;
class KActionCollection;
class KMainWindow;
......@@ -38,7 +38,7 @@ class KTouchContext : public QObject
Q_PROPERTY(QString keyboardLayoutName READ keyboardLayoutName NOTIFY keyboardLayoutNameChanged)
Q_PROPERTY(DataIndex* globalDataIndex READ dataIndex CONSTANT)
public:
explicit KTouchContext(KMainWindow* mainWindow, QQuickWidget* view, QObject* parent = 0);
explicit KTouchContext(KMainWindow* mainWindow, QQuickView* view, QObject* parent = 0);
~KTouchContext();
QString keyboardLayoutName() const;
DataIndex* dataIndex();
......@@ -59,7 +59,7 @@ private:
KActionCollection* m_actionCollection;
QMenu* m_menu;
KMainWindow* m_mainWindow;
QQuickWidget* m_view;
QQuickView* m_view;
#ifdef KTOUCH_BUILD_WITH_X11
XEventNotifier* m_XEventNotifier;
#else
......
......@@ -17,7 +17,7 @@
#include "mainwindow.h"
#include <QQuickWidget>
#include <QQuickView>
#include <QVariant>
#include <QStandardPaths>
#include <QQmlContext>
......@@ -29,7 +29,7 @@
MainWindow::MainWindow(QWidget* parent):
KMainWindow(parent),
m_view(new QQuickWidget(this)),
m_view(new QQuickView()),
m_context(new KTouchContext(this, m_view, this))
{
init();
......@@ -42,13 +42,13 @@ MainWindow::~MainWindow()
void MainWindow::init()
{
setCentralWidget(m_view);
QWidget* viewWidget = QWidget::createWindowContainer(m_view, this);
viewWidget->setMinimumSize(1000, 700);
setCentralWidget(viewWidget);
Application::setupDeclarativeBindings(m_view->engine());
m_view->setMinimumSize(1000, 700);
m_view->rootContext()->setContextProperty(QStringLiteral("ktouch"), m_context);
m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
m_view->setResizeMode(QQuickView::SizeRootObjectToView);
m_view->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, "qml/main.qml")));
}
......@@ -22,7 +22,7 @@
#include <QWeakPointer>
class QQuickWidget;
class QQuickView;
class KTouchContext;
......@@ -40,7 +40,7 @@ public:
~MainWindow();
private:
void init();
QQuickWidget* m_view;
QQuickView* m_view;
KTouchContext* m_context;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment