mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
BalloonTip: Rework BalloonTip drawing
* Fix irregularly shaped corners * Remove extra space for BalloonTips with no message or no title * When the target tip location is not on a screen, put the tooltip on the mouse's screen instead of the primary screen * Fix description getting cut off when the title was too long * Expose border width as a parameter * Fix spacing and sizing issues with larger border widths
This commit is contained in:
@ -3,10 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QIcon>
|
||||
#include <QColor>
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
class QPaintEvent;
|
||||
class QPoint;
|
||||
class QString;
|
||||
|
||||
class BalloonTip : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -21,15 +25,16 @@ public:
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
static void ShowBalloon(const QIcon& icon, const QString& title, const QString& msg,
|
||||
const QPoint& pos, QWidget* parent,
|
||||
ShowArrow show_arrow = ShowArrow::Yes);
|
||||
static void ShowBalloon(const QString& title, const QString& message,
|
||||
const QPoint& target_arrow_tip_position, QWidget* parent,
|
||||
ShowArrow show_arrow = ShowArrow::Yes, int border_width = 1);
|
||||
static void HideBalloon();
|
||||
|
||||
BalloonTip(PrivateTag, const QIcon& icon, QString title, QString msg, QWidget* parent);
|
||||
BalloonTip(PrivateTag, const QString& title, QString message, QWidget* parent);
|
||||
|
||||
private:
|
||||
void UpdateBoundsAndRedraw(const QPoint&, ShowArrow);
|
||||
void UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, ShowArrow show_arrow,
|
||||
int border_width);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
@ -37,5 +42,4 @@ protected:
|
||||
private:
|
||||
QColor m_border_color;
|
||||
QPixmap m_pixmap;
|
||||
bool m_show_arrow = true;
|
||||
};
|
||||
|
Reference in New Issue
Block a user