on xenial help sign in
Fixes for Table Preview Widget Fixes: #1410420

Approved by: Michael Zanetti

commitbaa4162741d05989e8083480434e43287a048042 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 21 Jan 2015, 18:32 (12 years ago) parent55426c66d54e35
2 files changed+12−5
qml/Dash/Previews/PreviewTable.qml+6 tests/qmltests/Dash/Previews/tst_PreviewTable.qml+6−5
qml/Dash/Previews/PreviewTable.qml+6
@@ -37,6 +37,7 @@ PreviewWidget {
3737 id: column
3838 objectName: "column"
3939 spacing: units.gu(1)
40+ width: parent.width
4041
4142 Label {
4243 id: titleLabel
@@ -51,6 +52,7 @@ PreviewWidget {
5152 visible: text !== ""
5253 opacity: .8
5354 text: widgetData["title"] || ""
55+ elide: Text.ElideRight
5456 }
5557
5658 GridLayout {
@@ -72,6 +74,10 @@ PreviewWidget {
7274 visible: root.expanded || rowIndex < maximumCollapsedRowCount
7375 color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText
7476 font.bold: index == 0
77+ verticalAlignment: Text.AlignTop
78+ wrapMode: Text.WordWrap
79+ Layout.fillHeight: true
80+ Layout.maximumWidth: column.width - x
7581 }
7682 }
7783 }
tests/qmltests/Dash/Previews/tst_PreviewTable.qml+6−5
@@ -27,17 +27,18 @@ Rectangle {
2727 color: Theme.palette.selected.background
2828
2929 property var widgetDataComplete: {
30− "title": "Title here",
31− "values": [ [ "Long Label 1", "Value 1"], [ "Label 2", "Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ]
30+ "title": "Title here longa long long long long long long long long long long",
31+ "values": [ [ "Long Label 1", "Value 1"], [ "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
3434 property var widgetDataNoTitle: {
35− "values": [ [ "Long Label 1", "Value 1"], [ "Label 2", "Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ]
35+ "values": [ [ "Long Label 1", "Value 1"], [ "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"] ]
3636 }
3737
38− PreviewTable {
38+ PreviewWidgetFactory {
3939 id: previewTable
4040 anchors { left: parent.left; right: parent.right }
41+ widgetType: "table"
4142 widgetData: widgetDataComplete
4243
4344 Rectangle {
@@ -59,7 +60,7 @@ Rectangle {
5960 compare(findChild(previewTable, "label00").text, "Long Label 1");
6061 compare(findChild(previewTable, "label01").text, "Value 1");
6162 compare(findChild(previewTable, "label10").text, "Label 2");
62− compare(findChild(previewTable, "label11").text, "Long Value 2");
63+ compare(findChild(previewTable, "label11").text, "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");
6364 compare(findChild(previewTable, "label20").text, "Label 3");
6465 compare(findChild(previewTable, "label21").text, "Value 3");
6566 compare(findChild(previewTable, "label30").text, "Label 4");