From 64ffcdad4ff60e1f0b443c00229e6aacf523c72f Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 29 Mar 2022 09:36:30 +0200 Subject: [ToolTipManager] Create DolphinFileMetaDataWidget on-demand again This reverts b7fbd19a7660424e6839df37f12b33111408b1fc but creates the widget only once and then reuses it. However, ownership of a parent-less widget is transferred to the `KToolTipWidget` but since we first request metadata, then show the tooltip (or won't if the mouse moved on since), we cannot rely on the `KToolTipWidget` exclusively. Instead, when we still delete the widget ourself until we have shown the `KToolTipWidget` once at which point it will handle the life time for us. This fixes parenting the widget to `DolphinView` which would make it appear as a broken line in the top left of the window. --- src/views/tooltips/tooltipmanager.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/views/tooltips/tooltipmanager.h') diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h index 066393344..c86c97f6b 100644 --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -77,7 +77,12 @@ private: QWindow* m_transientParent; QScopedPointer m_tooltipWidget; - DolphinFileMetaDataWidget *m_fileMetaDataWidget; + DolphinFileMetaDataWidget *m_fileMetaDataWidget = nullptr; + + /// Whether ownership of the metadata widget was transferred + /// over to the KToolTipWidget (i.e. we should not delete it + /// anymore) + bool m_fileMetaDatWidgetOwnershipTransferred = false; bool m_toolTipRequested; bool m_metaDataRequested; -- cgit v1.3