mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 20:13:24 -08:00
* [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>
50 lines
No EOL
1.2 KiB
C++
50 lines
No EOL
1.2 KiB
C++
#ifndef COCKATRICE_PALETTE_GRID_WIDGET_H
|
||
#define COCKATRICE_PALETTE_GRID_WIDGET_H
|
||
|
||
#include "../theme_config.h"
|
||
|
||
#include <QList>
|
||
#include <QMap>
|
||
#include <QPalette>
|
||
#include <QVector>
|
||
#include <QWidget>
|
||
#include <qtmetamacros.h>
|
||
|
||
class QLabel;
|
||
class QScrollArea;
|
||
class ColorButton;
|
||
class QVBoxLayout;
|
||
|
||
// Scrollable grid of ColorButtons — one per (ColorGroup × ColorRole) cell.
|
||
// Owns the load/read round-trip for PaletteConfig but has no file I/O itself.
|
||
class PaletteGridWidget : public QWidget
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit PaletteGridWidget(QWidget *parent = nullptr);
|
||
|
||
void loadPalette(const PaletteConfig &cfg);
|
||
PaletteConfig currentPaletteConfig() const;
|
||
|
||
signals:
|
||
void paletteChanged();
|
||
|
||
private:
|
||
void buildGrid(QWidget *host);
|
||
void changeEvent(QEvent *e);
|
||
void refreshChromePalettes();
|
||
|
||
private slots:
|
||
void applyInterfaceDefaultFont();
|
||
|
||
private:
|
||
QMap<QPalette::ColorGroup, QMap<QPalette::ColorRole, ColorButton *>> colorButtons;
|
||
QMap<AppColor::Role, ColorButton *> appColorButtons;
|
||
QScrollArea *scroll;
|
||
QWidget *gridHost;
|
||
QVBoxLayout *layout;
|
||
QVector<QLabel *> headerLabels;
|
||
QVector<QWidget *> rowShadeWidgets;
|
||
};
|
||
|
||
#endif // COCKATRICE_PALETTE_GRID_WIDGET_H
|