on xenial help sign in
Fix first column of the preview table to be 25%
12fb435Albert Astals Cid
qml/Dash/Previews/PreviewTable.qml+2−1
@@ -76,7 +76,8 @@ PreviewWidget {
76 font.bold: index == 0
76 font.bold: index == 0
77 wrapMode: Text.Wrap
77 wrapMode: Text.Wrap
78 Layout.alignment: Qt.AlignTop
78 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
80 }
81 }
81 }
82 }
82 }
83 }
tests/qmltests/Dash/Previews/tst_PreviewTable.qml+21
@@ -31,6 +31,11 @@ Rectangle {
31 "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"] ]
31 "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"] ]
32 }
32 }
33
33
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+
34 property var widgetDataNoTitle: {
39 property var widgetDataNoTitle: {
35 "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"] ]
40 "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"] ]
36 }
41 }
@@ -51,6 +56,22 @@ Rectangle {
51 }
56 }
52 }
57 }
53
58
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+
54 UT.UnityTestCase {
75 UT.UnityTestCase {
55 name: "PreviewTableTest"
76 name: "PreviewTableTest"
56 when: windowShown
77 when: windowShown