on xenial help sign in
Tweak app drawer a bit

Make delegates a bit wider to have more breath space Add a "tooltip" on hover for delegates whose text is truncated

commit0d45cd35706bfa2a6f2bc8de4240fa4ae8929cee authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 3 Apr 2017, 16:55 (10 years ago) parent40d0568
1 file changed+38−2
qml/Launcher/Drawer.qml+38−2
qml/Launcher/Drawer.qml+38−2
@@ -272,7 +272,7 @@ FocusScope {
272272
273273 model: sortProxyModel
274274
275− delegateWidth: units.gu(8)
275+ delegateWidth: units.gu(10)
276276 delegateHeight: units.gu(10)
277277 delegate: drawerDelegateComponent
278278 }
@@ -332,7 +332,7 @@ FocusScope {
332332 filterLetter: model.letter
333333 dynamicSortFilter: false
334334 }
335− delegateWidth: units.gu(8)
335+ delegateWidth: units.gu(10)
336336 delegateHeight: units.gu(10)
337337 delegate: drawerDelegateComponent
338338 }
@@ -352,6 +352,7 @@ FocusScope {
352352 readonly property bool focused: index === GridView.view.currentIndex && GridView.view.activeFocus
353353
354354 onClicked: root.applicationSelected(model.appId)
355+ z: loader.active ? 1 : 0
355356
356357 Column {
357358 width: units.gu(8)
@@ -384,11 +385,46 @@ FocusScope {
384385 }
385386
386387 Label {
388+ id: label
387389 text: model.name
388390 width: parent.width
389391 horizontalAlignment: Text.AlignHCenter
390392 fontSize: "small"
391393 elide: Text.ElideRight
394+
395+ Loader {
396+ id: loader
397+ x: {
398+ var aux = 0;
399+ if (item) {
400+ aux = label.width / 2 - item.width / 2;
401+ var containerXMap = mapToItem(contentContainer, aux, 0).x
402+ if (containerXMap < 0) {
403+ aux = aux - containerXMap;
404+ containerXMap = 0;
405+ }
406+ if (containerXMap + item.width > contentContainer.width) {
407+ aux = aux - (containerXMap + item.width - contentContainer.width);
408+ }
409+ }
410+ return aux;
411+ }
412+ y: -units.gu(0.5)
413+ active: label.truncated && drawerDelegate.hovered
414+ sourceComponent: Rectangle {
415+ color: UbuntuColors.jet
416+ width: fullLabel.width + units.gu(1)
417+ height: fullLabel.height + units.gu(1)
418+ border.color: UbuntuColors.blue
419+ radius: units.dp(4)
420+ Label {
421+ id: fullLabel
422+ anchors.centerIn: parent
423+ text: model.name
424+ fontSize: "small"
425+ }
426+ }
427+ }
392428 }
393429 }
394430 }