mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 17:32:17 -07:00
Nudge attribution pill on home screen to align
Took 3 minutes Took 28 seconds Took 38 seconds
This commit is contained in:
parent
b23e2eb452
commit
748ca7a1c5
1 changed files with 11 additions and 3 deletions
|
|
@ -356,12 +356,21 @@ void HomeWidget::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scryfall requires artist attribution wherever card art is shown cropped.
|
// Scryfall requires artist attribution wherever card art is shown cropped.
|
||||||
// Pin it to the bottom-right corner, using the same font as the card name pill.
|
// Pin it to the bottom-right corner, using the same font as the card name pill,
|
||||||
|
// and align its right edge with the card name pill's right edge.
|
||||||
|
constexpr int margin = 15;
|
||||||
|
constexpr qreal attributionMargin = 4.0;
|
||||||
|
|
||||||
QFont attributionFont = painter.font();
|
QFont attributionFont = painter.font();
|
||||||
attributionFont.setPointSize(14);
|
attributionFont.setPointSize(14);
|
||||||
attributionFont.setBold(true);
|
attributionFont.setBold(true);
|
||||||
painter.setFont(attributionFont);
|
painter.setFont(attributionFont);
|
||||||
const QRectF attributionRect = paintArtAttribution(painter, rect(), attribution);
|
|
||||||
|
// paintArtAttribution insets the pill 4px from the given rect's right edge,
|
||||||
|
// so nudge the rect's right edge to land exactly on the pill's right edge.
|
||||||
|
QRectF attributionArea = rect();
|
||||||
|
attributionArea.setRight(width() - margin + attributionMargin);
|
||||||
|
const QRectF attributionRect = paintArtAttribution(painter, attributionArea, attribution);
|
||||||
|
|
||||||
// Card name bubble above the attribution (when enabled).
|
// Card name bubble above the attribution (when enabled).
|
||||||
if (!cardName.isEmpty() && SettingsCache::instance().appearance().getHomeTabDisplayCardName()) {
|
if (!cardName.isEmpty() && SettingsCache::instance().appearance().getHomeTabDisplayCardName()) {
|
||||||
|
|
@ -372,7 +381,6 @@ void HomeWidget::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
constexpr int padding = 10;
|
constexpr int padding = 10;
|
||||||
constexpr int margin = 15;
|
|
||||||
|
|
||||||
QRect textRect = fm.boundingRect(cardName);
|
QRect textRect = fm.boundingRect(cardName);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue