Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
banner_widget.h
Go to the documentation of this file.
1
8
9#ifndef BANNER_WIDGET_H
10#define BANNER_WIDGET_H
11
12#include <QLabel>
13#include <QVBoxLayout>
14#include <QWidget>
15
16class BannerWidget : public QWidget
17{
18 Q_OBJECT
19
20public:
21 explicit BannerWidget(QWidget *parent,
22 const QString &text,
23 Qt::Orientation orientation = Qt::Vertical,
24 int transparency = 80);
25 void mousePressEvent(QMouseEvent *event) override;
26 void setText(const QString &text) const;
27 void setClickable(bool _clickable);
28 void setBuddy(QWidget *_buddy);
29 [[nodiscard]] QString getText() const
30 {
31 return bannerLabel->text();
32 }
33
34protected:
35 void paintEvent(QPaintEvent *event) override;
36
37private:
38 QLabel *iconLabel;
39 QLabel *bannerLabel;
40 Qt::Orientation gradientOrientation;
41 int transparency; // Transparency percentage for the gradient
42 QWidget *buddy = nullptr;
43 bool clickable = true;
44signals:
46private slots:
47 void toggleBuddyVisibility() const;
48 void updateDropdownIconState() const;
49};
50
51#endif // BANNER_WIDGET_H
BannerWidget(QWidget *parent, const QString &text, Qt::Orientation orientation=Qt::Vertical, int transparency=80)
Definition banner_widget.cpp:10
int transparency
Definition banner_widget.h:41
QLabel * bannerLabel
Definition banner_widget.h:39
QLabel * iconLabel
Definition banner_widget.h:38
QWidget * buddy
Definition banner_widget.h:42
void paintEvent(QPaintEvent *event) override
Definition banner_widget.cpp:78
void buddyVisibilityChanged()
QString getText() const
Definition banner_widget.h:29
void mousePressEvent(QMouseEvent *event) override
Definition banner_widget.cpp:35
void toggleBuddyVisibility() const
Definition banner_widget.cpp:60
Qt::Orientation gradientOrientation
Definition banner_widget.h:40
void setText(const QString &text) const
Definition banner_widget.cpp:43
bool clickable
Definition banner_widget.h:43
void setClickable(bool _clickable)
Definition banner_widget.cpp:48
void updateDropdownIconState() const
Definition banner_widget.cpp:68
void setBuddy(QWidget *_buddy)
Definition banner_widget.cpp:54