digiKam
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  * Copyright (C) 2007-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2009-2010 by Andi Clemens <andi dot clemens at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DCURSOR_TRACKER_H
27 #define DIGIKAM_DCURSOR_TRACKER_H
28 
29 // Qt includes
30 
31 #include <QEvent>
32 #include <QString>
33 #include <QLabel>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 
39 namespace Digikam
40 {
41 
46 class DIGIKAM_EXPORT DCursorTracker : public QLabel
47 {
48  Q_OBJECT
49 
50 public:
51 
52  explicit DCursorTracker(const QString& txt, QWidget* const parent, Qt::Alignment align = Qt::AlignCenter);
53  ~DCursorTracker() override;
54 
55  void setText(const QString& txt);
56  void setEnable(bool b);
57  void setKeepOpen(bool b);
58  void setTrackerAlignment(Qt::Alignment alignment);
59 
60  void triggerAutoShow(int timeout = 2000);
61  void refresh();
62 
63 protected:
64 
65  bool eventFilter(QObject*, QEvent*) override;
66  void paintEvent(QPaintEvent*) override;
67 
68 private Q_SLOTS:
69 
70  void slotAutoHide();
71 
72 private:
73 
74  void moveToParent(QWidget* const parent);
75  bool canBeDisplayed();
76 
77 private:
78 
79  class Private;
80  Private* const d;
81 };
82 
83 } // namespace Digikam
84 
85 #endif // DIGIKAM_DCURSOR_TRACKER_H
Definition: dcursortracker.h:47
Definition: datefolderview.cpp:43