on xenial help sign in
Renamed and moved to textarea
commit82996dfcb47281ef3585bbe99c967d2fb4ca2d5b authorAndrea Cimitan <andrea.cimitan@gmail.com> dateFri 14 Feb 2014, 14:51 (13 years ago) parented60828
2 files changed+19−16
qml/Dash/Previews/PreviewRating.qml+11−9 tests/qmltests/Dash/Previews/tst_PreviewRating.qml+8−7
qml/Dash/Previews/PreviewRating.qml+11−9
@@ -36,7 +36,7 @@ import "../../Components"
3636
3737PreviewWidget {
3838 id: root
39− implicitHeight: childrenRect.height
39+ implicitHeight: ratingLabelAndWidgetContainer.implicitHeight + reviewContainer.implicitHeight
4040
4141 function submit() {
4242 // checks rating-input requirements
@@ -45,9 +45,9 @@ PreviewWidget {
4545 rating.value < 0) ||
4646 ((widgetData["required"] === "both" ||
4747 widgetData["required"] === "review") &&
48− reviewField.text === "")) return;
48+ reviewTextArea.text === "")) return;
4949
50− var data = {"rating": rating.value, "review": reviewField.text, "author": null};
50+ var data = {"rating": rating.value, "review": reviewTextArea.text, "author": null};
5151 triggered(root.widgetId, widgetData["required"], data);
5252 }
5353
@@ -90,6 +90,7 @@ PreviewWidget {
9090
9191 Item {
9292 id: reviewContainer
93+ implicitHeight: reviewLabel.implicitHeight + reviewSubmitContainer.implicitHeight + anchors.topMargin
9394
9495 readonly property real innerMargin: units.gu(1)
9596
@@ -116,20 +117,21 @@ PreviewWidget {
116117 }
117118
118119 Item {
120+ id: reviewSubmitContainer
119121 anchors {
120122 top: reviewLabel.bottom
121123 left: parent.left
122124 right: parent.right
125+ bottom: parent.bottom
123126 topMargin: reviewContainer.innerMargin
124127 }
125− implicitHeight: childrenRect.height
128+ implicitHeight: submitButton.implicitHeight + anchors.topMargin
126129
127− TextField {
128− id: reviewField
129− objectName: "reviewField"
130+ TextArea {
131+ id: reviewTextArea
132+ objectName: "reviewTextArea"
130133 anchors {
131134 top: parent.top
132− bottom: parent.bottom
133135 left: parent.left
134136 right: submitButton.left
135137 rightMargin: reviewContainer.innerMargin
@@ -141,7 +143,7 @@ PreviewWidget {
141143 objectName: "submitButton"
142144
143145 readonly property bool readyToSubmit: {
144− if (reviewField.text === "" ||
146+ if (reviewTextArea.text === "" ||
145147 (widgetData["visible"] === "both" && rating.value < 0)) return false;
146148 else return true;
147149 }
tests/qmltests/Dash/Previews/tst_PreviewRating.qml+8−7
@@ -45,7 +45,8 @@ Rectangle {
4545
4646 PreviewRating {
4747 id: previewRating
48− anchors.fill: parent
48+ anchors.left: parent.left
49+ anchors.right: parent.right
4950 widgetData: widgetDataBoth
5051 widgetId: "previewRating"
5152 }
@@ -60,12 +61,12 @@ Rectangle {
6061 when: windowShown
6162
6263 property var rating: findChild(previewRating, "rating")
63− property var reviewField: findChild(previewRating, "reviewField")
64+ property var reviewTextArea: findChild(previewRating, "reviewTextArea")
6465 property var submitButton: findChild(previewRating, "submitButton")
6566
6667 function init() {
6768 rating.value = -1;
68− reviewField.text = "";
69+ reviewTextArea.text = "";
6970 }
7071
7172 function test_labels() {
@@ -123,9 +124,9 @@ Rectangle {
123124 }
124125
125126 if (data.widgetData["visible"] !== "rating") {
126− verify(reviewField.visible === true);
127+ verify(reviewTextArea.visible === true);
127128
128− reviewField.text = data.inputText;
129+ reviewTextArea.text = data.inputText;
129130 mouseClick(submitButton, submitButton.width / 2, submitButton.height / 2);
130131 switch (data.widgetData["required"]) {
131132 case "rating": compare(spy.count, 0); break;
@@ -144,7 +145,7 @@ Rectangle {
144145 }
145146 }
146147 } else {
147− verify(reviewField.visible === false);
148+ verify(reviewTextArea.visible === false);
148149 }
149150
150151 compare(spy.count === 1, data.emitted);
@@ -166,7 +167,7 @@ Rectangle {
166167
167168 if (data.inputRating > 0) rating.value = data.inputRating;
168169 if (data.inputText !== "") {
169− reviewField.text = data.inputText;
170+ reviewTextArea.text = data.inputText;
170171 mouseClick(submitButton, submitButton.width / 2, submitButton.height / 2);
171172 }
172173