Merge "Different themes between desktop and dialogs"

This commit is contained in:
Marco Martin 2014-12-11 15:21:44 +01:00 committed by Gerrit Code Review
commit 43f1ff419d
2 changed files with 30 additions and 0 deletions

View File

@ -435,6 +435,21 @@ void AppletQuickItem::init()
engine->setUrlInterceptor(interceptor);
}
//Force QtQuickControls to use the "Plasma" style for this engine.
//this way is possible to mix QtQuickControls and plasma components in applets
//while still having the desktop style in configuration dialogs
QQmlComponent c(engine);
c.setData("import QtQuick 2.1\n\
import QtQuick.Controls 1.0\n\
import QtQuick.Controls.Private 1.0\n \
Item {\
Component.onCompleted: {\
Settings.styleName = \"Plasma\";\
}\
}", QUrl());
QObject *o = c.create();
o->deleteLater();
d->qmlObject->setSource(QUrl::fromLocalFile(d->applet->package().filePath("mainscript")));
if (!engine || !engine->rootContext() || !engine->rootContext()->isValid() || !d->qmlObject->mainComponent() || d->qmlObject->mainComponent()->isError()) {

View File

@ -196,6 +196,21 @@ View::View(Plasma::Corona *corona, QWindow *parent)
qWarning() << "Invalid home screen package";
}
//Force QtQuickControls to use the "Plasma" style for this engine.
//this way is possible to mix QtQuickControls and plasma components in applets
//while still having the desktop style in configuration dialogs
QQmlComponent c(engine());
c.setData("import QtQuick 2.1\n\
import QtQuick.Controls 1.0\n\
import QtQuick.Controls.Private 1.0\n \
Item {\
Component.onCompleted: {\
Settings.styleName = \"Plasma\";\
}\
}", QUrl());
QObject *o = c.create();
o->deleteLater();
setResizeMode(View::SizeRootObjectToView);
}