summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastian.gottfried@posteo.de>2016-10-24 17:14:45 (GMT)
committerSebastian Gottfried <sebastian.gottfried@posteo.de>2016-10-24 17:14:45 (GMT)
commit9fe18509b9090561b56b87f4bbdc77c11f0147f0 (patch)
treeb2da20edbb03d44323c0d94b1fac10f629c4ecf5
parent8fa790e23a9e1a5c4711f98d79505a0eeb42c091 (diff)
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.
-rw-r--r--src/ktouchcontext.cpp4
-rw-r--r--src/ktouchcontext.h6
-rw-r--r--src/mainwindow.cpp12
-rw-r--r--src/mainwindow.h4
4 files changed, 13 insertions, 13 deletions
diff --git a/src/ktouchcontext.cpp b/src/ktouchcontext.cpp
index 006c901..5d63816 100644
--- a/src/ktouchcontext.cpp
+++ b/src/ktouchcontext.cpp
@@ -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)),
diff --git a/src/ktouchcontext.h b/src/ktouchcontext.h
index ac99b2d..74d9c16 100644
--- a/src/ktouchcontext.h
+++ b/src/ktouchcontext.h
@@ -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
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6bd6cc0..64c9332 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -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")));
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 797d268..d401698 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -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;
};