2017-12-23 22:17:38 +01:00
|
|
|
#pragma once
|
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
|
|
|
|
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-01-22 15:06:36 +01:00
|
|
|
protected:
|
2018-01-22 20:14:43 +01:00
|
|
|
virtual void changeEvent(QEvent *) override;
|
|
|
|
virtual void leaveEvent(QEvent *) override;
|
2018-01-25 20:49:49 +01:00
|
|
|
virtual 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
|