summaryrefslogtreecommitdiffstats
path: root/src/widget/tooltipqopengl.h
blob: 05777cfe763e13eab47cb202d8e2c996cd663f0b (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
#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

    bool m_active{true};
    QTimer m_timer;
    QPoint m_pos{};
    WGLWidget* m_widget{};
    ToolTipQOpenGL();

  public:
    static ToolTipQOpenGL& singleton();
    void setActive(bool active);
    void start(WGLWidget* widget, QPoint pos);
    void stop(WGLWidget* widget);
  private slots:
    void onTimeout();
};