on xenial help sign in
Fix the buttons. A new variable to control the max width of buttons.

So it looks better on wide screens.

commit3f15cca9b02c58f852f122bc7d3b21834fc2c763 authorYing-Chun Liu <paul.liu@canonical.com> dateThu 26 Sep 2013, 20:53 (13 years ago) parent4c43d6e
2 files changed+7−5
Dash/DashPreview.qml+2−2 Dash/Generic/GenericPreview.qml+5−3
Dash/DashPreview.qml+2−2
@@ -63,6 +63,7 @@ Rectangle {
6363
6464 Item {
6565 id: headerIcon
66+ height: childrenRect.height
6667 anchors {
6768 left: parent.left
6869 right: parent.right
@@ -71,7 +72,6 @@ Rectangle {
7172 topMargin: root.contentSpacing
7273 rightMargin: root.contentSpacing
7374 }
74− height: childrenRect.height
7575 Loader {
7676 id: headerLoader
7777 anchors.left: parent.left
@@ -82,7 +82,7 @@ Rectangle {
8282
8383 Item {
8484 id: headerRow
85− height: childrenRect.height
85+ height: childrenRect.height
8686 anchors {
8787 top: headerIcon.bottom
8888 left: parent.left
Dash/Generic/GenericPreview.qml+5−3
@@ -67,13 +67,15 @@ DashPreview {
6767 id: buttons
6868 model: genericPreview.previewData.actions
6969
70− property int numOfRows: (count + 1) / 2
70+ property int buttonMaxWidth: units.gu(34)
71+ property int numOfColumns: Math.ceil((width + spacing) / (buttonMaxWidth + spacing))
72+ property int numOfRows: Math.ceil(count / numOfColumns)
7173 property int spacing: units.gu(1)
7274 height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
7375
74− cellWidth: Math.max(units.gu(9), width / 2)
76+ cellWidth: width / numOfColumns
7577 cellHeight: buttonHeight + spacing
76− property int buttonWidth: Math.max(0, width / 2 - spacing)
78+ property int buttonWidth: cellWidth - spacing / 2
7779 property int buttonHeight: units.gu(4)
7880
7981 delegate: Button {