mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[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>
This commit is contained in:
parent
396196b762
commit
3bcdfc3793
44 changed files with 387 additions and 79 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "resizable_panel.h"
|
||||
|
||||
#include "../interface/theme_manager.h"
|
||||
#include "abstract_analytics_panel_widget.h"
|
||||
#include "libcockatrice/utility/qt_utils.h"
|
||||
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
#include <QDropEvent>
|
||||
#include <QEvent>
|
||||
#include <QFlags>
|
||||
#include <QFont>
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMimeData>
|
||||
|
|
@ -93,9 +95,17 @@ ResizablePanel::ResizablePanel(const QString &_typeId, AbstractAnalyticsPanelWid
|
|||
|
||||
dragButton->setStyleSheet(QString("QPushButton { "
|
||||
"background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 %1, stop:1 %2); "
|
||||
"border: none; color: %3; font-size: 10px; }"
|
||||
"border: none; color: %3; }"
|
||||
"QPushButton:hover { background: %4; }")
|
||||
.arg(mid.name(), dark.name(), placeholderText.name(), midLight.name()));
|
||||
// Family comes from the InterfaceDefault theme role; the 10px size stays caller-side.
|
||||
auto applyDragFont = [this]() {
|
||||
QFont dragFont = themeManager->appFont(AppFont::InterfaceDefault);
|
||||
dragFont.setPixelSize(10);
|
||||
dragButton->setFont(dragFont);
|
||||
};
|
||||
applyDragFont();
|
||||
connect(themeManager, &ThemeManager::fontsChanged, this, applyDragFont);
|
||||
|
||||
resizeHandle->setStyleSheet(QString("QWidget { background: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
|
||||
"stop:0 %1, stop:1 %2); }")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue