From 3e2478bd24a52b30fe6bea4b5b3e9db8fe17cce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Tue, 4 Oct 2022 10:54:00 +0200 Subject: [PATCH] [ui] show tooltip when hovering over line number or color bar --- meshroom/ui/qml/Controls/TextFileViewer.qml | 46 ++++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/meshroom/ui/qml/Controls/TextFileViewer.qml b/meshroom/ui/qml/Controls/TextFileViewer.qml index 872519c0..585422a4 100644 --- a/meshroom/ui/qml/Controls/TextFileViewer.qml +++ b/meshroom/ui/qml/Controls/TextFileViewer.qml @@ -199,30 +199,36 @@ Item { property var duration: textView.model.get(index).duration - // Colored marker to quickly indicate duration - Rectangle { - width: 4 + Item { + Layout.minimumWidth: childrenRect.width Layout.fillHeight: true - color: Colors.interpolate(Colors.grey, Colors.red, duration/180) - } - - // Line number - // displays a tooltip with the duration when hovered - Label { - text: index + 1 - Layout.minimumWidth: lineMetrics.width - rightPadding: 2 - Layout.fillHeight: true - horizontalAlignment: Text.AlignRight - color: "#CCCCCC" + RowLayout { + height: parent.height + // Colored marker to quickly indicate duration + Rectangle { + width: 4 + Layout.fillHeight: true + color: Colors.interpolate(Colors.grey, Colors.red, duration/180) + } + // Line number + Label { + text: index + 1 + Layout.minimumWidth: lineMetrics.width + rightPadding: 6 + Layout.fillHeight: true + horizontalAlignment: Text.AlignRight + color: "#CCCCCC" + } + } + // Display a tooltip with the duration when hovered + MouseArea { + id: mouseArea + hoverEnabled: true + anchors.fill: parent + } enabled: duration > 0 ToolTip.text: "Elapsed time: " + Format.getTimeStr(duration) ToolTip.visible: mouseArea.containsMouse - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - } } Loader {