summaryrefslogtreecommitdiffstats
path: root/src/widget/tooltipqopengl.h
blob: ff5d817916638ecbaa3f44ef9c1217a968f128ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <QPoint>
#include <QTimer>
#include <QToolTip>

class WGLWidget;

// Tooltips don't work for the qopengl-based WGLWidget. This
// singleton mimics the standard tooltip behaviour for them.
class ToolTipQOpenGL : public QObject {
    Q_OBJECT
  public:
    static ToolTipQOpenGL& singleton();
    void setActive(bool active);
    void start(WGLWidget* pWidget, QPoint pos);
    void stop();

  private slots:
    void onTimeout();

  private:
    ToolTipQOpenGL();

    bool m_active;
    QTimer m_timer;
    QPoint m_pos;
    WGLWidget* m_pWidget;
};