better layout in case of single applet

This commit is contained in:
Marco Martin 2015-03-18 15:41:38 +01:00
parent f9f28f75ed
commit e130d3a24f

View file

@ -135,7 +135,7 @@ Item {
} }
Layout.minimumWidth: root.width Layout.minimumWidth: root.width
Layout.minimumHeight: Math.max(applet.Layout.minimumHeight, root.height / 2) Layout.minimumHeight: Math.max(applet.Layout.minimumHeight, (root.height-applicationsView.headerItem.margin) / 2)
Layout.preferredWidth: root.width Layout.preferredWidth: root.width
Layout.preferredHeight: Layout.minimumHeight Layout.preferredHeight: Layout.minimumHeight
@ -173,13 +173,13 @@ Item {
onFlickingChanged: { onFlickingChanged: {
if (!draggingVertically && contentY < -headerItem.height + root.height) { if (!draggingVertically && contentY < -headerItem.height + root.height) {
scrollAnim.to = Math.round(contentY/root.height) * root.height - headerItem.margin scrollAnim.to = Math.round(contentY/root.height) * root.height
scrollAnim.running = true; scrollAnim.running = true;
} }
} }
onDraggingVerticallyChanged: { onDraggingVerticallyChanged: {
if (!draggingVertically && contentY < -headerItem.height + root.height) { if (!draggingVertically && contentY < -headerItem.height + root.height) {
scrollAnim.to = Math.round(contentY/root.height) * root.height - headerItem.margin scrollAnim.to = Math.round(contentY/root.height) * root.height
scrollAnim.running = true; scrollAnim.running = true;
} }
} }
@ -198,7 +198,7 @@ Item {
property Item layout: appletsLayout property Item layout: appletsLayout
property Item lastSpacer: spacer property Item lastSpacer: spacer
width: root.width width: root.width
height: mainLayout.Layout.minimumHeight + stripe.height + units.gridUnit height: mainLayout.Layout.minimumHeight
property int margin: stripe.height + units.gridUnit * 2 property int margin: stripe.height + units.gridUnit * 2
onPressAndHold: { onPressAndHold: {
@ -209,7 +209,6 @@ Item {
id: mainLayout id: mainLayout
anchors { anchors {
fill: parent fill: parent
bottomMargin: stripe.height + units.gridUnit * 2
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -235,15 +234,20 @@ Item {
} }
ColumnLayout { ColumnLayout {
id: appletsLayout id: appletsLayout
//Layout.minimumHeight: Math.max(root.height, Math.round(Layout.preferredHeight / root.height) * root.height)
Item { Item {
id: spacer id: spacer
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.minimumHeight: plasmoid.applets.length % 2 == 0 ? 0 : root.height/2 Layout.minimumHeight: plasmoid.applets.length % 2 == 0 ? 0 : (root.height - margin)/2
Layout.maximumHeight: Layout.minimumHeight Layout.maximumHeight: Layout.minimumHeight
} }
} }
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: margin
Layout.maximumHeight: Layout.minimumHeight
}
} }
SatelliteStripe { SatelliteStripe {
id: stripe id: stripe