on xenial help sign in
More work on column
beea01eAndrea Cimitan
qml/Dash/Previews/PreviewTextSummary.qml+20−20
@@ -32,18 +32,12 @@ PreviewWidget {
32
32
33 Column {
33 Column {
34 id: column
34 id: column
35− anchors {
36− left: parent.left
37− right: parent.right
35+ anchors { left: parent.left; right: parent.right; }
38− }
39
36
40 Label {
37 Label {
41 id: titleLabel
38 id: titleLabel
42 objectName: "titleLabel"
39 objectName: "titleLabel"
43− anchors {
44− left: parent.left
45− right: parent.right
40+ anchors { left: parent.left; right: parent.right }
46− }
47 fontSize: "large"
41 fontSize: "large"
48 // TODO karni: Yet another fix requiring Palette update.
42 // TODO karni: Yet another fix requiring Palette update.
49 color: "grey" //Theme.palette.selected.backgroundText
43 color: "grey" //Theme.palette.selected.backgroundText
@@ -59,11 +53,8 @@ PreviewWidget {
59
53
60 readonly property int maximumCollapsedLineCount: 7
54 readonly property int maximumCollapsedLineCount: 7
61
55
62− anchors {
63− left: parent.left
64− right: parent.right
56+ anchors { left: parent.left; right: parent.right }
65− }
66− height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2) + units.gu(1)
57+ height: (!seeMoreContainer.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
67 clip: true
58 clip: true
68 fontSize: "small"
59 fontSize: "small"
69 lineHeight: 1.2
60 lineHeight: 1.2
@@ -78,14 +69,23 @@ PreviewWidget {
78 }
69 }
79 }
70 }
80
71
81− SeeMore {
72+ Item {
82− id: seeMore
73+ id: seeMoreContainer
83− objectName: "seeMore"
74+ objectName: "seeMoreContainer"
84− anchors {
85− left: parent.left
86− right: parent.right
75+ anchors { left: parent.left; right: parent.right }
87− }
76+ height: seeMore.height
88 visible: textLabel.lineCount > textLabel.maximumCollapsedLineCount
77 visible: textLabel.lineCount > textLabel.maximumCollapsedLineCount
78+
79+ SeeMore {
80+ id: seeMore
81+ objectName: "seeMore"
82+ anchors {
83+ left: parent.left
84+ right: parent.right
85+ top: parent.top
86+ topMargin: units.gu(1)
87+ }
88+ }
89 }
89 }
90 }
90 }
91}
91}
tests/qmltests/Dash/Previews/tst_PreviewTextSummary.qml+2
@@ -75,6 +75,7 @@ Rectangle {
75
75
76 function test_see_more() {
76 function test_see_more() {
77 var seeMore = findChild(previewTextSummary, "seeMore")
77 var seeMore = findChild(previewTextSummary, "seeMore")
78+ var seeMoreContainer = findChild(previewTextSummary, "seeMoreContainer")
78
79
79 // when it's more than textLabel.maximumCollapsedLineCount lines of text, show SeeMore component
80 // when it's more than textLabel.maximumCollapsedLineCount lines of text, show SeeMore component
80 verify(textLabel.lineCount > textLabel.maximumCollapsedLineCount)
81 verify(textLabel.lineCount > textLabel.maximumCollapsedLineCount)
@@ -94,6 +95,7 @@ Rectangle {
94 // text SeeMore automatic hiding
95 // text SeeMore automatic hiding
95 previewTextSummary.widgetData = widgetDataShortText
96 previewTextSummary.widgetData = widgetDataShortText
96 verify(textLabel.lineCount <= textLabel.maximumCollapsedLineCount)
97 verify(textLabel.lineCount <= textLabel.maximumCollapsedLineCount)
98+ compare(seeMoreContainer.visible, false)
97 compare(seeMore.visible, false)
99 compare(seeMore.visible, false)
98 tryCompare(textLabel, "height", textLabel.contentHeight)
100 tryCompare(textLabel, "height", textLabel.contentHeight)
99 }
101 }