diff --git a/kcmkwin/kwintabbox/layoutpreview.cpp b/kcmkwin/kwintabbox/layoutpreview.cpp
index b2a63ac45c..536488f0d8 100644
--- a/kcmkwin/kwintabbox/layoutpreview.cpp
+++ b/kcmkwin/kwintabbox/layoutpreview.cpp
@@ -20,18 +20,14 @@ along with this program. If not, see .
// own
#include "layoutpreview.h"
#include "thumbnailitem.h"
-#include
-#include
-#include
-#include
+#include
#include
-#include
#include
#include
-#include
#include
#include
#include
+#include
#include
namespace KWin
@@ -39,32 +35,22 @@ namespace KWin
namespace TabBox
{
-LayoutPreview::LayoutPreview(QWidget* parent)
- : QDeclarativeView(parent)
+LayoutPreview::LayoutPreview(QWindow *parent)
+ : QQuickView(parent)
{
- setAutoFillBackground(false);
- QPalette pal = palette();
- pal.setColor(backgroundRole(), Qt::transparent);
- setPalette(pal);
+ setColor(Qt::white);
setMinimumSize(QSize(480, 300));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
- foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
- engine()->addImportPath(importPath);
- }
- foreach (const QString &importPath, QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kwin/tabbox", QStandardPaths::LocateDirectoty)) {
+ setResizeMode(QQuickView::SizeRootObjectToView);
+ foreach (const QString &importPath, QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kwin/tabbox", QStandardPaths::LocateDirectory)) {
engine()->addImportPath(importPath);
}
ExampleClientModel *model = new ExampleClientModel(this);
engine()->addImageProvider(QLatin1String("client"), new TabBoxImageProvider(model));
- KDeclarative kdeclarative;
- kdeclarative.setDeclarativeEngine(engine());
- kdeclarative.initialize();
- kdeclarative.setupBindings();
qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem");
rootContext()->setContextProperty("clientModel", model);
rootContext()->setContextProperty("sourcePath", QString());
rootContext()->setContextProperty("name", QString());
- setSource(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kwin/kcm_kwintabbox/main.qml"));
+ setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kwin/kcm_kwintabbox/main.qml")));
}
LayoutPreview::~LayoutPreview()
@@ -78,7 +64,7 @@ void LayoutPreview::setLayout(const QString &path, const QString &name)
}
TabBoxImageProvider::TabBoxImageProvider(QAbstractListModel* model)
- : QDeclarativeImageProvider(QDeclarativeImageProvider::Pixmap)
+ : QQuickImageProvider(QQuickImageProvider::Pixmap)
, m_model(model)
{
}
@@ -89,7 +75,7 @@ QPixmap TabBoxImageProvider::requestPixmap(const QString &id, QSize *size, const
QStringList parts = id.split('/');
const int index = parts.first().toInt(&ok);
if (!ok) {
- return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize);
+ return QQuickImageProvider::requestPixmap(id, size, requestedSize);
}
QSize s(32, 32);
if (requestedSize.isValid()) {
diff --git a/kcmkwin/kwintabbox/layoutpreview.h b/kcmkwin/kwintabbox/layoutpreview.h
index 4e9bb21047..6839b94aa0 100644
--- a/kcmkwin/kwintabbox/layoutpreview.h
+++ b/kcmkwin/kwintabbox/layoutpreview.h
@@ -21,8 +21,8 @@ along with this program. If not, see .
#define KWIN_TABBOX_LAYOUTPREVIEW_H
#include
-#include
-#include
+#include
+#include
namespace KWin
{
@@ -30,17 +30,17 @@ namespace KWin
namespace TabBox
{
-class LayoutPreview : public QDeclarativeView
+class LayoutPreview : public QQuickView
{
Q_OBJECT
public:
- explicit LayoutPreview(QWidget *parent = NULL);
+ explicit LayoutPreview(QWindow *parent = nullptr);
virtual ~LayoutPreview();
void setLayout(const QString &path, const QString &name);
};
-class TabBoxImageProvider : public QDeclarativeImageProvider
+class TabBoxImageProvider : public QQuickImageProvider
{
public:
explicit TabBoxImageProvider(QAbstractListModel *model);
diff --git a/kcmkwin/kwintabbox/main.cpp b/kcmkwin/kwintabbox/main.cpp
index 265b993599..d6cf9e80f7 100644
--- a/kcmkwin/kwintabbox/main.cpp
+++ b/kcmkwin/kwintabbox/main.cpp
@@ -497,9 +497,9 @@ void KWinTabBoxConfig::configureEffectClicked()
const int effect = ui->effectCombo->currentIndex();
if (effect >= Layout) {
if (!m_layoutPreview) {
- m_layoutPreview = new LayoutPreview(this);
- m_layoutPreview->setWindowTitle(i18n("Tabbox layout preview"));
- m_layoutPreview->setWindowFlags(Qt::Dialog);
+ m_layoutPreview = new LayoutPreview();
+ m_layoutPreview->setTitle(i18n("Tabbox layout preview"));
+ m_layoutPreview->setFlags(Qt::Dialog);
}
m_layoutPreview->setLayout(ui->effectCombo->itemData(effect, Qt::UserRole+1).toString(), ui->effectCombo->itemText(effect));
m_layoutPreview->show();
diff --git a/kcmkwin/kwintabbox/qml/main.qml b/kcmkwin/kwintabbox/qml/main.qml
index 300474b70f..911e81a749 100644
--- a/kcmkwin/kwintabbox/qml/main.qml
+++ b/kcmkwin/kwintabbox/qml/main.qml
@@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
id : preview