on xenial help sign in
Fix GridView interactive problem.

Let the buttons flow when we have more width. Clean-up unused code.

commitaadff5b0051b8a190a4793b0080e704903ce7170 authorYing-Chun Liu <paul.liu@canonical.com> dateFri 13 Sep 2013, 21:22 (13 years ago) parent8d0d15c
1 file changed+9−5
Dash/Movie/MoviePreview.qml+9−5
Dash/Movie/MoviePreview.qml+9−5
@@ -78,14 +78,19 @@ DashPreview {
7878 id: buttons
7979 objectName: "gridButtons"
8080 model: root.previewData.actions
81+ interactive: false
8182
82− property int numOfRows: (count + 1) / 2
83+ anchors.left: parent.left
84+ anchors.right: parent.right
85+
86+ property int numOfRows: (count + numOfColumns - 1) / numOfColumns
87+ property int numOfColumns: Math.max(1, Math.floor(width / (buttonWidth + spacing)))
8388 property int spacing: units.gu(1)
8489 height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
8590
86− cellWidth: Math.max(units.gu(9), width / 2)
87− cellHeight: buttonHeight + spacing
88− property int buttonWidth: Math.max(0, width / 2 - spacing)
91+ cellWidth: width / buttons.numOfColumns
92+ cellHeight: buttonHeight + buttons.spacing
93+ property int buttonWidth: units.gu(17) - spacing
8994 property int buttonHeight: units.gu(4)
9095
9196 delegate: Button {
@@ -160,7 +165,6 @@ DashPreview {
160165 var parts = []
161166 if (ready) {
162167 if (previewData.year) parts.push(previewData.year)
163− //if (nfo.video.runtime) parts.push("%1 minutes".arg(nfo.video.runtime))
164168 }
165169 return parts.join(", ");
166170 }