2 * SPDX-FileCopyrightText: 2008 Konstantin Heil <konst.heil@stud.uni-heidelberg.de>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef TOOLTIPMANAGER_H
8 #define TOOLTIPMANAGER_H
15 class DolphinFileMetaDataWidget
;
21 * @brief Manages the tooltips for an item view.
23 * When hovering an item, a tooltip is shown after
24 * a short timeout. The tooltip is hidden again when the
25 * viewport is hovered or the item view has been left.
27 class ToolTipManager
: public QObject
32 enum class HideBehavior
{
37 explicit ToolTipManager(QWidget
* parent
);
38 ~ToolTipManager() override
;
41 * Triggers the showing of the tooltip for the item \p item
42 * where the item has the maximum boundaries of \p itemRect.
43 * The tooltip manager takes care that the tooltip is shown
44 * slightly delayed and with a proper \p transientParent.
46 void showToolTip(const KFileItem
& item
, const QRectF
& itemRect
, QWindow
*transientParent
);
49 * Hides the currently shown tooltip.
51 void hideToolTip(const HideBehavior behavior
= HideBehavior::Later
);
55 * Is emitted when the user clicks a tag or a link
56 * in the metadata widget.
58 void urlActivated(const QUrl
& url
);
61 void startContentRetrieval();
62 void setPreviewPix(const KFileItem
& item
, const QPixmap
& pix
);
64 void slotMetaDataRequestFinished();
68 /// Timeout from requesting a tooltip until the tooltip
70 QTimer
* m_showToolTipTimer
;
72 /// Timeout from requesting a tooltip until the retrieving of
73 /// the tooltip content like preview and meta data gets started.
74 QTimer
* m_contentRetrievalTimer
;
76 /// Transient parent of the tooltip, mandatory on Wayland.
77 QWindow
* m_transientParent
;
79 QScopedPointer
<KToolTipWidget
> m_tooltipWidget
;
80 QScopedPointer
<DolphinFileMetaDataWidget
> m_fileMetaDataWidget
;
82 bool m_toolTipRequested
;
83 bool m_metaDataRequested
;
84 bool m_appliedWaitCursor
;