on xenial help sign in
Move the Panel "title" from PanelItemRow to Panel
commitd977cf6faa31961bfcda1971f5323dedf8cecce1 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 15 Mar 2017, 17:10 (10 years ago) parentccb3d6b
4 files changed+32−34
qml/Panel/Panel.qml+24−2 qml/Panel/PanelBar.qml+1−3 qml/Panel/PanelItemRow.qml+3−24 qml/Panel/PanelMenu.qml+4−5
qml/Panel/Panel.qml+24−2
@@ -260,6 +260,7 @@ Item {
260260 alignment: Qt.AlignLeft
261261 enableHint: !callHint.active && !fullscreenMode
262262 showOnClick: false
263+ adjustDragHandleSizeToContents: false
263264 panelColor: panelAreaBackground.color
264265
265266 onShowTapped: {
@@ -268,8 +269,7 @@ Item {
268269 }
269270 }
270271
271− showRowTitle: !expanded
272− rowTitle: PanelState.title
272+ hideRow: !expanded
273273 rowItemDelegate: ActionItem {
274274 id: actionItem
275275 property int ownIndex: index
@@ -310,6 +310,28 @@ Item {
310310 }
311311 }
312312
313+ Label {
314+ id: rowLabel
315+ objectName: "panelTitle"
316+ anchors {
317+ left: parent.left
318+ leftMargin: units.gu(1)
319+ right: __indicators.left
320+ rightMargin: units.gu(1)
321+ }
322+ height: root.minimizedPanelHeight
323+ verticalAlignment: Text.AlignVCenter
324+ elide: Text.ElideRight
325+ maximumLineCount: 1
326+ fontSize: "medium"
327+ font.weight: Font.Medium
328+ color: Theme.palette.selected.backgroundText
329+ opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
330+ visible: opacity != 0
331+ Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
332+ text: PanelState.title
333+ }
334+
313335 PanelMenu {
314336 id: __indicators
315337 objectName: "indicators"
qml/Panel/PanelBar.qml+1−3
@@ -30,9 +30,7 @@ Item {
3030 property real lateralPosition: -1
3131 property int alignment: Qt.AlignRight
3232
33− property alias showRowTitle: row.showRowTitle
34− property alias rowTitle: row.rowTitle
35− property alias shiftLeftTitle: row.shiftLeftTitle
33+ property alias hideRow: row.hideRow
3634 property alias rowItemDelegate: row.delegate
3735
3836 implicitWidth: flickable.contentWidth
qml/Panel/PanelItemRow.qml+3−24
@@ -20,12 +20,10 @@ import "../Components"
2020
2121Item {
2222 id: root
23− implicitWidth: showRowTitle && !expanded ? rowTitle != "" ? rowLabel.width : 0 : row.width
23+ implicitWidth: row.width
2424 implicitHeight: units.gu(3)
2525
26− property bool showRowTitle: false
27− property alias rowTitle: rowLabel.text
28− property real shiftLeftTitle: 0
26+ property bool hideRow: false
2927 property QtObject model: null
3028 property real overFlowWidth: width
3129 property bool expanded: false
@@ -139,31 +137,12 @@ Item {
139137 d.previousItem = currentItem;
140138 }
141139
142− Label {
143− id: rowLabel
144− objectName: "panelTitle"
145− anchors {
146− left: parent.left
147− leftMargin: units.gu(1) - root.shiftLeftTitle
148− verticalCenter: parent.verticalCenter
149− }
150− width: implicitWidth + units.gu(2)
151− elide: Text.ElideRight
152− maximumLineCount: 1
153− fontSize: "medium"
154− font.weight: Font.Medium
155− color: Theme.palette.selected.backgroundText
156− opacity: showRowTitle ? 1 : 0
157− visible: opacity != 0
158− Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
159− }
160−
161140 ListView {
162141 id: row
163142 objectName: "panelRow"
164143 orientation: ListView.Horizontal
165144 model: root.model
166− opacity: showRowTitle ? 0 : 1
145+ opacity: hideRow ? 0 : 1
167146 // dont set visible on basis of opacity; otherwise width will not be calculated correctly
168147 anchors {
169148 top: parent.top
qml/Panel/PanelMenu.qml+4−5
@@ -32,12 +32,12 @@ Showable {
3232 property real openedHeight: units.gu(71)
3333 property bool enableHint: true
3434 property bool showOnClick: true
35+ property bool adjustDragHandleSizeToContents: true
3536 property color panelColor: theme.palette.normal.background
3637 property real menuContentX: 0
3738
3839 property alias alignment: bar.alignment
39− property alias rowTitle: bar.rowTitle
40− property alias showRowTitle: bar.showRowTitle
40+ property alias hideRow: bar.hideRow
4141 property alias rowItemDelegate: bar.rowItemDelegate
4242 property alias pageDelegate: content.pageDelegate
4343
@@ -46,7 +46,7 @@ Showable {
4646 readonly property bool partiallyOpened: unitProgress > 0 && unitProgress < 1.0
4747 readonly property bool fullyClosed: unitProgress == 0
4848 readonly property alias expanded: bar.expanded
49− readonly property int barWidth: Math.min(bar.width, bar.implicitWidth)
49+ readonly property int barWidth: adjustDragHandleSizeToContents ? Math.min(bar.width, bar.implicitWidth) : bar.width
5050
5151 signal showTapped()
5252
@@ -175,7 +175,6 @@ Showable {
175175 enableLateralChanges: false
176176 lateralPosition: -1
177177 unitProgress: root.unitProgress
178− shiftLeftTitle: root.menuContentX
179178
180179 height: expanded ? expandedPanelHeight : minimizedPanelHeight
181180 Behavior on height { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing } }
@@ -230,7 +229,7 @@ Showable {
230229 anchors.left: alignment == Qt.AlignLeft ? parent.left : undefined
231230 anchors.leftMargin: -root.menuContentX
232231 anchors.right: alignment == Qt.AlignRight ? parent.right : undefined
233− width: root.barWidth // show handle should only cover panel items.
232+ width: root.barWidth + root.menuContentX // show handle should only cover panel items.
234233 height: minimizedPanelHeight
235234 direction: Direction.Downwards
236235 enabled: !root.shown && root.available