[vlc-devel] [PATCH 27/27] qml: handle playlist item tooltip better
Fatih Uzunoglu
fuzun54 at outlook.com
Fri Oct 9 18:56:48 CEST 2020
---
modules/gui/qt/playlist/qml/PLItem.qml | 32 +++++++++++++++----
.../gui/qt/playlist/qml/PlaylistListView.qml | 5 +++
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index 831174991d..8b76bacf2b 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -56,6 +56,31 @@ Rectangle {
property bool dropVisible: false
+ function showTooltip(binding) {
+ plInfoTooltip.close()
+ plInfoTooltip.text = Qt.binding(function() { return (textInfo.text + '\n' + textArtist.text); })
+ plInfoTooltip.parent = textInfoColumn
+ if (plmodel.getSelection().length > 1 && binding)
+ plInfoTooltip.timeout = 2000
+ else
+ plInfoTooltip.timeout = 0
+ plInfoTooltip.visible = Qt.binding(function() { return ( (binding ? model.selected : plitem.hovered) && !overlayMenu.visible &&
+ (textInfo.implicitWidth > textInfo.width || textArtist.implicitWidth > textArtist.width)); })
+
+ }
+
+ onHoveredChanged: {
+ if(hovered)
+ showTooltip(false)
+ }
+
+ readonly property bool selected : model.selected
+
+ onSelectedChanged: {
+ if(selected)
+ showTooltip(true)
+ }
+
Connections {
target: root
@@ -209,13 +234,6 @@ Rectangle {
Layout.fillWidth: true
Layout.leftMargin: VLCStyle.margin_large
- ToolTip {
- id: textInfoExtendTooltip
- text: (textInfo.text + '\n' + textArtist.text)
- visible: (plitem.hovered || model.selected) && (textInfo.implicitWidth > textInfo.width || textArtist.implicitWidth > textArtist.width)
- delay: 750
- }
-
Widgets.ListLabel {
id: textInfo
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index c84d00bc2d..a0219e6271 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -450,6 +450,11 @@ Widgets.NavigableFocusScope {
}
}
+ ToolTip {
+ id: plInfoTooltip
+ delay: 750
+ }
+
delegate: Column {
Loader {
--
2.25.1
More information about the vlc-devel
mailing list