digiKam
Loading...
Searching...
No Matches
dcursortracker.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2007-23-03
7 * Description : A tool tip widget which follows cursor movements.
8 * Tool tip content is displayed without delay.
9 *
10 * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 * SPDX-FileCopyrightText: 2009-2010 by Andi Clemens <andi dot clemens at gmail dot com>
12 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
14 *
15 * ============================================================ */
16
17#pragma once
18
19// Qt includes
20
21#include <QEvent>
22#include <QString>
23#include <QLabel>
24
25// Local includes
26
27#include "digikam_export.h"
28
29namespace Digikam
30{
31
36class DIGIKAM_EXPORT DCursorTracker : public QLabel
37{
38 Q_OBJECT
39
40public:
41
42 explicit DCursorTracker(const QString& txt, QWidget* const parent, Qt::Alignment align = Qt::AlignCenter);
43 ~DCursorTracker() override;
44
45 void setText(const QString& txt);
46 void setEnable(bool b);
47 void setKeepOpen(bool b);
48 void setTrackerAlignment(Qt::Alignment alignment);
49
50 void triggerAutoShow(int timeout = 2000);
51 void refresh();
52
53protected:
54
55 bool eventFilter(QObject*, QEvent*) override;
56 void paintEvent(QPaintEvent*) override;
57
58private Q_SLOTS:
59
60 void slotAutoHide();
61
62private:
63
64 void moveToParent(QWidget* const parent);
65 bool canBeDisplayed();
66
67private:
68
69 class Private;
70 Private* const d = nullptr;
71};
72
73} // namespace Digikam
Definition dcursortracker.h:37
Definition datefolderview.cpp:34