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
|
//build the icon representation
|
||||||
if (m_compactUiObject) {
|
if (m_compactUiObject) {
|
||||||
QQmlComponent *compactComponent = new QQmlComponent(m_appletScriptEngine->engine(), this);
|
QQmlComponent *compactComponent = m_uiObject.data()->property("compactRepresentation").value<QQmlComponent *>();
|
||||||
compactComponent->loadUrl(QUrl::fromLocalFile(applet()->containment()->corona()->package().filePath("ui", "DefaultCompactRepresentation.qml")));
|
|
||||||
|
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());
|
compactRepresentation = compactComponent->create(m_appletScriptEngine->engine()->rootContext());
|
||||||
if (compactRepresentation) {
|
if (compactRepresentation) {
|
||||||
compactComponent->setParent(compactRepresentation);
|
compactComponent->setParent(compactRepresentation);
|
||||||
|
@ -29,6 +29,15 @@ Rectangle {
|
|||||||
radius: 10
|
radius: 10
|
||||||
smooth: true
|
smooth: true
|
||||||
|
|
||||||
|
property Component compactRepresentation: Component {
|
||||||
|
Rectangle {
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: plasmoid.expanded = !plasmoid.expanded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
Text {
|
Text {
|
||||||
|
Loading…
Reference in New Issue
Block a user