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>
|
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);
|
|
|
|
|
|
|
|
void setText(QString text);
|
2018-01-22 15:06:36 +01:00
|
|
|
void moveTo(QWidget *widget, QPoint point);
|
2017-12-23 22:17:38 +01:00
|
|
|
|
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:
|
|
|
|
virtual void resizeEvent(QResizeEvent *) override;
|
|
|
|
|
2017-12-23 22:17:38 +01:00
|
|
|
private:
|
|
|
|
QLabel *displayText;
|
2018-01-22 15:06:36 +01:00
|
|
|
|
|
|
|
void moveIntoDesktopRect(QWidget *parent);
|
2017-12-23 22:17:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|