From 0f86bd5b6e7a33dc761f63dc77492798c2657b5d Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 6 Sep 2013 19:22:14 +0200 Subject: [PATCH] fix size hints propagation --- examples/applets/qmltasks/contents/ui/qmltasks.qml | 2 ++ src/scriptengines/qml/plasmoid/appletinterface.cpp | 9 +++++---- .../qmlpackages/desktop/contents/views/Panel.qml | 12 ++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/examples/applets/qmltasks/contents/ui/qmltasks.qml b/examples/applets/qmltasks/contents/ui/qmltasks.qml index 89f3a5979..91a99106e 100644 --- a/examples/applets/qmltasks/contents/ui/qmltasks.qml +++ b/examples/applets/qmltasks/contents/ui/qmltasks.qml @@ -29,6 +29,7 @@ Item { property bool fillWidth: true property bool fillHeight: true + implicitWidth: tasksModel.count * 50 PlasmaCore.DataSource { id: tasksSource @@ -56,6 +57,7 @@ Item { orientation: ListView.Horizontal model: PlasmaCore.DataModel { + id: tasksModel dataSource: tasksSource } diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 910adc637..5c7ce1582 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -751,11 +751,10 @@ void AppletInterface::compactRepresentationCheck() emit expandedChanged(); //we are already expanded: nothing to do - if (!m_compactUiObject) { - return; + if (m_compactUiObject) { + disconnect(m_compactUiObject.data(), 0, this, 0); } - disconnect(m_compactUiObject.data(), 0, this, 0); //Here we have to use the old connect syntax, because we don't have access to the class type if (m_qmlObject->rootObject()->property("minimumWidth").isValid()) { connect(m_qmlObject->rootObject(), SIGNAL(minimumWidthChanged()), @@ -794,7 +793,9 @@ void AppletInterface::compactRepresentationCheck() emit maximumHeightChanged(); m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); - m_compactUiObject.data()->deleteLater(); + if (m_compactUiObject) { + m_compactUiObject.data()->deleteLater(); + } //set anchors QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent"); diff --git a/src/shell/qmlpackages/desktop/contents/views/Panel.qml b/src/shell/qmlpackages/desktop/contents/views/Panel.qml index 341f860e5..1b3e4cc18 100644 --- a/src/shell/qmlpackages/desktop/contents/views/Panel.qml +++ b/src/shell/qmlpackages/desktop/contents/views/Panel.qml @@ -82,33 +82,33 @@ PlasmaCore.FrameSvgItem { } onMinimumWidthChanged: { if (containment.formFactor === PlasmaCore.Types.Horizontal) { - panel.width = Math.max(panel.width, containment.minimumWidth); + panel.width = Math.max(panel.width, panel.minimumLength); } } onMaximumWidthChanged: { if (containment.formFactor === PlasmaCore.Types.Horizontal) { - panel.width = Math.min(panel.width, containment.maximumWidth); + panel.width = Math.min(panel.width, panel.maximumLength); } } onImplicitWidthChanged: { if (containment.formFactor === PlasmaCore.Types.Horizontal) { - panel.width = Math.min(containment.maximumWidth, Math.max(containment.implicitWidth, containment.minimumWidth)); + panel.width = Math.min(panel.maximumLength, Math.max(containment.implicitWidth, panel.minimumLength)); } } onMinimumHeightChanged: { if (containment.formFactor === PlasmaCore.Types.Vertical) { - panel.width = Math.max(panel.width, containment.minimumHeight); + panel.width = Math.max(panel.width, panel.minimumLength); } } onMaximumHeightChanged: { if (containment.formFactor === PlasmaCore.Types.Vertical) { - panel.width = Math.min(panel.width, containment.maximumHeight); + panel.width = Math.min(panel.width, panel.maximumLength); } } onImplicitHeightChanged: { if (containment.formFactor === PlasmaCore.Types.Vertical) { - panel.width = Math.min(containment.maximumHeight, Math.max(containment.implicitHeight, containment.minimumHeight)); + panel.width = Math.min(panel.maximumLength, Math.max(containment.implicitHeight, panel.minimumLength)); } } }