diff --git a/containments/desktop/package/contents/ui/CompactRepresentation.qml b/containments/desktop/package/contents/ui/CompactRepresentation.qml --- a/containments/desktop/package/contents/ui/CompactRepresentation.qml +++ b/containments/desktop/package/contents/ui/CompactRepresentation.qml @@ -24,6 +24,17 @@ import org.kde.draganddrop 2.0 as DragDrop DragDrop.DropArea { + readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge + || plasmoid.location == PlasmaCore.Types.RightEdge + || plasmoid.location == PlasmaCore.Types.BottomEdge + || plasmoid.location == PlasmaCore.Types.LeftEdge) + + Layout.minimumWidth: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? height : units.iconSizes.small + Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : (units.iconSizes.small + 2 * theme.mSize(theme.defaultFont).height) + + Layout.maximumWidth: inPanel && plasmoid.formFactor != PlasmaCore.Types.Vertical ? units.iconSizeHints.panel : -1 + Layout.maximumHeight: inPanel && plasmoid.formFactor != PlasmaCore.Types.Vertical ? units.iconSizeHints.panel : -1 + property Item folderView: null onContainsDragChanged: { diff --git a/containments/desktop/package/contents/ui/main.qml b/containments/desktop/package/contents/ui/main.qml --- a/containments/desktop/package/contents/ui/main.qml +++ b/containments/desktop/package/contents/ui/main.qml @@ -37,15 +37,35 @@ id: root objectName: isFolder ? "folder" : "desktop" - width: isPopup ? undefined : preferredWidth(false) // for the initial size when placed on the desktop - Layout.minimumWidth: preferredWidth(true) - Layout.preferredWidth: isPopup ? preferredWidth(false) : 0 // for the popup size to change at runtime when view mode changes - Plasmoid.switchWidth: isPopup ? units.iconSizeHints.panel : preferredWidth(true) - + width: isPopup ? undefined : preferredWidth(false) height: isPopup ? undefined : preferredHeight(false) - Layout.minimumHeight: preferredHeight(true) - Layout.preferredHeight: isPopup ? preferredHeight(false) : 0 - Plasmoid.switchHeight: isPopup ? units.iconSizeHints.panel : preferredHeight(true) + + Layout.minimumWidth: preferredWidth(!isPopup) + Layout.minimumHeight: preferredHeight(!isPopup) + + Layout.preferredWidth: preferredWidth(false) + Layout.preferredHeight: preferredHeight(false) + + Layout.maximumWidth: isPopup ? preferredWidth(false) : -1 + Layout.maximumHeight: isPopup ? preferredHeight(false) : -1 + + Plasmoid.switchWidth: { + // Support expanding into the full representation only on vertical panels. + if (isPopup && plasmoid.formFactor == PlasmaCore.Types.Vertical) { + return units.iconSizeHints.panel; + } + + return undefined; + } + + Plasmoid.switchHeight: { + // Support expanding into the full representation only on vertical panels. + if (isPopup && plasmoid.formFactor == PlasmaCore.Types.Vertical) { + return units.iconSizeHints.panel; + } + + return undefined; + } LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true