prefer an applet-provided compactRepresentation
if possible, still fallback to a default one
This commit is contained in:
parent
f51895ab91
commit
b34b9e9f6a
@ -417,8 +417,12 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
|
||||
|
||||
//build the icon representation
|
||||
if (m_compactUiObject) {
|
||||
QQmlComponent *compactComponent = new QQmlComponent(m_appletScriptEngine->engine(), this);
|
||||
compactComponent->loadUrl(QUrl::fromLocalFile(applet()->containment()->corona()->package().filePath("ui", "DefaultCompactRepresentation.qml")));
|
||||
QQmlComponent *compactComponent = m_uiObject.data()->property("compactRepresentation").value<QQmlComponent *>();
|
||||
|
||||
if (!compactComponent) {
|
||||
compactComponent = new QQmlComponent(m_appletScriptEngine->engine(), this);
|
||||
compactComponent->loadUrl(QUrl::fromLocalFile(applet()->containment()->corona()->package().filePath("ui", "DefaultCompactRepresentation.qml")));
|
||||
}
|
||||
compactRepresentation = compactComponent->create(m_appletScriptEngine->engine()->rootContext());
|
||||
if (compactRepresentation) {
|
||||
compactComponent->setParent(compactRepresentation);
|
||||
|
@ -29,6 +29,15 @@ Rectangle {
|
||||
radius: 10
|
||||
smooth: true
|
||||
|
||||
property Component compactRepresentation: Component {
|
||||
Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: plasmoid.expanded = !plasmoid.expanded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
Text {
|
||||
|
Loading…
Reference in New Issue
Block a user