on xenial help sign in
Fix first column of the preview table to be 25%

This way two consecutive tables have the second column start at the same X coordinate

commit12fb4356ff6109ee0c93994c770a79d3a61ee27d authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 7 Oct 2016, 14:53 (10 years ago) parent1bb5972
2 files changed+23−1
qml/Dash/Previews/PreviewTable.qml+2−1 tests/qmltests/Dash/Previews/tst_PreviewTable.qml+21
qml/Dash/Previews/PreviewTable.qml+2−1
@@ -76,7 +76,8 @@ PreviewWidget {
7676 font.bold: index == 0
7777 wrapMode: Text.Wrap
7878 Layout.alignment: Qt.AlignTop
79− Layout.maximumWidth: column.width - x
79+ Layout.maximumWidth: index == 0 ? column.width / 4 : column.width - x
80+ Layout.minimumWidth: index == 0 ? column.width / 4 : -1
8081 }
8182 }
8283 }
tests/qmltests/Dash/Previews/tst_PreviewTable.qml+21
@@ -31,6 +31,11 @@ Rectangle {
3131 "values": [ [ "Long Label 1", "Long Value 1 Long Value 2 Long Value 3 Long Value 4 Long Value 5 Long Value 6 Long Value 2 Long Value 2 Long Value 2 Long Value 2"], [ "Label 2", "Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ]
3232 }
3333
34+ property var widgetDataComplete2: {
35+ "title": "Short Title here",
36+ "values": [ [ "Label A", "Long Value 1 Long Value 2 Long Value 3 Long Value 4 Long Value 5 Long Value 6 Long Value 2 Long Value 2 Long Value 2 Long Value 2"], [ "Author", "Best 3v3r"], [ "Summary", "If i knew how to write summaries i'd be working somewhere else"] ]
37+ }
38+
3439 property var widgetDataNoTitle: {
3540 "values": [ [ "Long Label 1", "Long Value 1 Long Value 2 Long Value 3 Long Value 4 Long Value 5 Long Value 6 Long Value 2 Long Value 2 Long Value 2 Long Value 2"], [ "Label 2", "Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2 Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ]
3641 }
@@ -51,6 +56,22 @@ Rectangle {
5156 }
5257 }
5358
59+ PreviewWidgetFactory {
60+ id: previewTable2
61+ anchors { left: parent.left; right: parent.right; top: previewTable.bottom; topMargin: units.gu(4) }
62+ widgetType: "table"
63+
64+ Rectangle {
65+ color: "red"
66+ anchors.fill: parent
67+ opacity: 0.5
68+ }
69+
70+ Component.onCompleted: {
71+ previewTable2.widgetData = widgetDataComplete2
72+ }
73+ }
74+
5475 UT.UnityTestCase {
5576 name: "PreviewTableTest"
5677 when: windowShown