Cockatrice/cockatrice/src/interface/widgets/general/display/banner_widget.h
BruebachL 3bcdfc3793
[Fonts] Migrate DeckList and InterfaceDefault surfaces to theme roles (#7539)
* [Fonts] Migrate DeckList and InterfaceDefault surfaces to theme roles

* [Fonts] Drop unused lambda captures in font-refresh handlers

* [Fonts] Fix pixel sizes and game overlay fonts from review

- Set the sizes the stylesheets carried with setPixelSize() rather than
  setPointSize(): home buttons (34), banner (24), home group box (20),
  the placeholder labels (14), the analytics drag handle (10), the EDHREC
  navigation buttons (24), the user info popup (11/14/11/10/11) and the
  game overlays (14/16/12). Points at 96 DPI were ~33% larger.
- The drag/total counters and tally columns keep the monospace family the
  stylesheets set, so digit widths stop changing as counts tick and
  white-space: pre stays aligned.
- applyDeckListFont() drops the cached tally rows before re-measuring, so
  previewing a larger DeckList font no longer leaves the tally clipped.
- Tally labels and the constructor/fontsChanged pairs in the shared-deck
  preview, quick setup, analytics panel, home box and public decks build
  their font once in a local lambda instead of twice.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-11-04 07:57:54 +01:00

54 lines
1.3 KiB
C++

/**
* @file banner_widget.h
* @ingroup Widgets
* @ingroup DeckEditorCardGroupWidgets
* @ingroup DeckStorageWidgets
*/
//! \todo Document this file.
#ifndef BANNER_WIDGET_H
#define BANNER_WIDGET_H
#include <QLabel>
#include <QString>
#include <QWidget>
#include <qnamespace.h>
#include <qtmetamacros.h>
class BannerWidget : public QWidget
{
Q_OBJECT
public:
explicit BannerWidget(QWidget *parent,
const QString &text,
Qt::Orientation orientation = Qt::Vertical,
int transparency = 80);
void mousePressEvent(QMouseEvent *event) override;
void setText(const QString &text) const;
void setClickable(bool _clickable);
void setBuddy(QWidget *_buddy);
[[nodiscard]] QString getText() const
{
return bannerLabel->text();
}
protected:
void paintEvent(QPaintEvent *event) override;
private:
QLabel *iconLabel;
QLabel *bannerLabel;
Qt::Orientation gradientOrientation;
int transparency; // Transparency percentage for the gradient
QWidget *buddy = nullptr;
bool clickable = true;
signals:
void buddyVisibilityChanged();
private slots:
void toggleBuddyVisibility() const;
void updateDropdownIconState() const;
void applyInterfaceDefaultFont();
};
#endif // BANNER_WIDGET_H