dolphin/Source/Core/DolphinQt/Config/ToolTipControls/BalloonTip.h
Dentomologist 56ff19c513 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
2024-02-17 12:36:19 -08:00

46 lines
961 B
C++

// Copyright 2020 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QColor>
#include <QPixmap>
#include <QWidget>
class QPaintEvent;
class QPoint;
class QString;
class BalloonTip : public QWidget
{
Q_OBJECT
struct PrivateTag
{
};
public:
enum class ShowArrow
{
Yes,
No
};
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 QString& title, QString message, QWidget* parent);
private:
void UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, ShowArrow show_arrow,
int border_width);
protected:
void paintEvent(QPaintEvent*) override;
private:
QColor m_border_color;
QPixmap m_pixmap;
};