2017-12-23 22:17:38 +01:00
|
|
|
#pragma once
|
2018-04-03 02:55:32 +02:00
|
|
|
|
2018-01-22 15:06:36 +01:00
|
|
|
#include "widgets/basewindow.hpp"
|
2017-12-23 22:17:38 +01:00
|
|
|
|
|
|
|
#include <QLabel>
|
2017-12-23 23:24:35 +01:00
|
|
|
#include <QWidget>
|
2018-01-22 20:14:43 +01:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
2017-12-23 22:17:38 +01:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
|
2018-01-22 15:06:36 +01:00
|
|
|
class TooltipWidget : public BaseWindow
|
2017-12-23 22:17:38 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-04-03 02:55:32 +02:00
|
|
|
|
2017-12-23 22:17:38 +01:00
|
|
|
public:
|
|
|
|
TooltipWidget(BaseWidget *parent = nullptr);
|
2018-01-22 20:14:43 +01:00
|
|
|
~TooltipWidget();
|
2017-12-23 22:17:38 +01:00
|
|
|
|
|
|
|
void setText(QString text);
|
|
|
|
|
2017-12-23 23:24:35 +01:00
|
|
|
static TooltipWidget *getInstance()
|
2017-12-23 22:17:38 +01:00
|
|
|
{
|
|
|
|
static TooltipWidget *tooltipWidget = nullptr;
|
2017-12-23 23:24:35 +01:00
|
|
|
if (tooltipWidget == nullptr) {
|
2017-12-23 22:17:38 +01:00
|
|
|
tooltipWidget = new TooltipWidget();
|
|
|
|
}
|
|
|
|
return tooltipWidget;
|
|
|
|
}
|
|
|
|
|
2018-05-24 10:03:07 +02:00
|
|
|
#ifdef USEWINSDK
|
|
|
|
void raise();
|
|
|
|
#endif
|
|
|
|
|
2018-01-22 15:06:36 +01:00
|
|
|
protected:
|
2018-04-03 02:55:32 +02:00
|
|
|
void changeEvent(QEvent *) override;
|
|
|
|
void leaveEvent(QEvent *) override;
|
2018-05-16 14:55:45 +02:00
|
|
|
void themeRefreshEvent() override;
|
2018-04-03 02:55:32 +02:00
|
|
|
void scaleChangedEvent(float) override;
|
2018-01-22 15:06:36 +01:00
|
|
|
|
2017-12-23 22:17:38 +01:00
|
|
|
private:
|
|
|
|
QLabel *displayText;
|
2018-01-22 20:14:43 +01:00
|
|
|
pajlada::Signals::Connection fontChangedConnection;
|
2018-01-22 15:06:36 +01:00
|
|
|
|
2018-01-22 20:14:43 +01:00
|
|
|
void updateFont();
|
2017-12-23 22:17:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|