on xenial help sign in
Ensure search panel label is not overflowed by indicator icons
commit1c015ae04b1a459a4c7c28b290c9efc9ffafa46f authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 18 Sep 2013, 17:48 (13 years ago) parent174fa52
2 files changed+41−11
Panel/Panel.qml+33−4 Panel/SearchIndicator.qml+8−7
Panel/Panel.qml+33−4
@@ -31,6 +31,8 @@ Item {
3131
3232 signal searchClicked
3333
34+ property real backgroundY: 0
35+
3436 PanelBackground {
3537 id: panelBackground
3638 anchors {
@@ -38,7 +40,7 @@ Item {
3840 right: parent.right
3941 }
4042 height: __panelMinusSeparatorLineHeight
41− y: 0
43+ y: backgroundY
4244
4345 Behavior on y { StandardAnimation {} }
4446 }
@@ -109,6 +111,34 @@ Item {
109111 source: "graphics/rectangular_dropshadow.sci"
110112 }
111113
114+ PanelBackground {
115+ id: backgroundSearch
116+ height: __panelMinusSeparatorLineHeight
117+ y: backgroundY
118+ anchors {
119+ left: parent.left
120+ right: search.right
121+ }
122+ clip: false
123+ opacity: search.state=="visible" ? 1.0 : 0.0
124+
125+ Rectangle {
126+ id: backgroundGradient
127+ anchors {
128+ left: parent.right
129+ }
130+ width: __panelMinusSeparatorLineHeight
131+ height: __panelMinusSeparatorLineHeight
132+ rotation: 90
133+ gradient: Gradient {
134+ GradientStop { position: 0.0; color: "transparent" }
135+ GradientStop { position: 1.0; color: backgroundSearch.color }
136+ }
137+ }
138+ Behavior on y { StandardAnimation {} }
139+ Behavior on opacity { StandardAnimation {} }
140+ }
141+
112142 SearchIndicator {
113143 id: search
114144 objectName: "search"
@@ -127,7 +157,6 @@ Item {
127157 return "hidden";
128158 }
129159
130− width: units.gu(13)
131160 height: __panelMinusSeparatorLineHeight
132161 anchors {
133162 top: panelBackground.top
@@ -141,12 +170,12 @@ Item {
141170 State {
142171 name: "in" //fully opaque and visible at top edge of screen
143172 when: !fullscreenMode
144− PropertyChanges { target: panelBackground; y: 0 }
173+ PropertyChanges { target: root; backgroundY: 0 }
145174 },
146175 State {
147176 name: "out" //pushed off screen
148177 when: fullscreenMode
149− PropertyChanges { target: panelBackground; y: -panelHeight }
178+ PropertyChanges { target: root; backgroundY: -panelHeight }
150179 }
151180 ]
152181}
Panel/SearchIndicator.qml+8−7
@@ -21,7 +21,7 @@ import "../Components"
2121Item {
2222 id: search
2323
24− width: units.gu(9)
24+ width: container.width + units.gu(2)
2525 height: units.gu(3)
2626
2727 property string headerText: i18n.tr("Search")
@@ -34,12 +34,17 @@ Item {
3434 onClicked: search.clicked()
3535 }
3636
37− Item {
37+ Row {
3838 id: container
3939 objectName: "container"
4040
41− width: parent.width
4241 height: parent.height
42+ width: childrenRect.width
43+ anchors {
44+ left: parent.left
45+ leftMargin: units.gu(1)
46+ }
47+ spacing: units.gu(1)
4348
4449 Behavior on opacity { StandardAnimation {} }
4550
@@ -47,8 +52,6 @@ Item {
4752 id: icon
4853 source: "graphics/search.png"
4954 anchors.verticalCenter: parent.verticalCenter
50− anchors.left: parent.left
51− anchors.leftMargin: units.gu(1)
5255 }
5356
5457 Label {
@@ -56,8 +59,6 @@ Item {
5659 color: Qt.rgba(0.8, 0.8, 0.8, 1.0)
5760 fontSize: "small"
5861 font.capitalization: Font.AllUppercase
59− anchors.left: icon.right
60− anchors.leftMargin: units.gu(1)
6162 anchors.verticalCenter: parent.verticalCenter
6263 }
6364 }