2019-07-23 22:18:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "widgets/BaseWindow.hpp"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
|
|
|
|
namespace AB_NAMESPACE {
|
|
|
|
|
|
|
|
class TooltipWidget : public BaseWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
static TooltipWidget *getInstance();
|
|
|
|
|
|
|
|
TooltipWidget(BaseWidget *parent = nullptr);
|
|
|
|
~TooltipWidget() override;
|
|
|
|
|
|
|
|
void setText(QString text);
|
|
|
|
void setWordWrap(bool wrap);
|
|
|
|
void clearImage();
|
|
|
|
void setImage(QPixmap image);
|
|
|
|
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
void raise();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void changeEvent(QEvent *) override;
|
|
|
|
void leaveEvent(QEvent *) override;
|
|
|
|
void themeChangedEvent() override;
|
|
|
|
void scaleChangedEvent(float) override;
|
2019-08-21 02:37:10 +02:00
|
|
|
void paintEvent(QPaintEvent *) override;
|
2019-07-23 22:18:36 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updateFont();
|
|
|
|
|
|
|
|
QLabel *displayImage_;
|
|
|
|
QLabel *displayText_;
|
|
|
|
pajlada::Signals::Connection fontChangedConnection_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace AB_NAMESPACE
|