mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -08:00
[Client] Fix alt badge and trail review findings
- Drop the dead VPN warning branch: rowVisible() already hides IP rows above the threshold, so setVpnThreshold(), its member and the spin-box connect never took effect. - Dim IP rows at shared_count > 2 instead of > 1: the count already includes the investigated account, so every IP row was dimmed. - Truncate backStack when a breadcrumb is clicked instead of pushing the current user again, so the trail keeps a single path and Back works. - Word-wrap the trail label so a long chain cannot widen the tab. - Extract the status/match pill painting into widgets/utility/pill_painter and use it from both delegates instead of duplicating it.
This commit is contained in:
parent
89789dc317
commit
13e0608662
8 changed files with 120 additions and 92 deletions
29
cockatrice/src/interface/widgets/utility/pill_painter.h
Normal file
29
cockatrice/src/interface/widgets/utility/pill_painter.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef PILL_PAINTER_H
|
||||
#define PILL_PAINTER_H
|
||||
|
||||
#include <QPalette>
|
||||
#include <QString>
|
||||
|
||||
class QPainter;
|
||||
class QStyleOptionViewItem;
|
||||
|
||||
namespace pill_painter
|
||||
{
|
||||
constexpr int PAD_X = 10;
|
||||
constexpr int PAD_Y = 4;
|
||||
|
||||
/**
|
||||
* Draws a translucent, palette-tinted rounded pill inside the option's rect and
|
||||
* paints the text elided and centred on it, so badges follow the active theme.
|
||||
* Returns false when the cell is too small to hold a pill, leaving the caller to
|
||||
* fall back to default painting.
|
||||
*/
|
||||
bool paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
QPalette::ColorRole tintRole,
|
||||
QPalette::ColorRole textRole,
|
||||
const QString &text);
|
||||
|
||||
} // namespace pill_painter
|
||||
|
||||
#endif // PILL_PAINTER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue