Cockatrice/cockatrice/src/interface/widgets/tabs/alt_table_delegate.h
Lukas Brübach 13e0608662 [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.
2026-11-01 22:04:07 +01:00

33 lines
1.1 KiB
C++

#ifndef ALT_TABLE_DELEGATE_H
#define ALT_TABLE_DELEGATE_H
#include <QStyledItemDelegate>
#include <qtmetamacros.h>
/**
* Badge + icon painting for the User Alts table. The match-evidence column
* renders as a palette-tinted pill per match type (email / client id / IP), and
* an IP shared by more than one other account is dimmed. Warn/ban counts gain
* the style's warning/critical icons when nonzero. Selected rows and unknown
* content fall back to default painting.
*/
class AltTableDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit AltTableDelegate(int viaColumn,
int warnsColumn,
int bansColumn,
int sharedColumn,
QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
[[nodiscard]] QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
int viaColumn;
int warnsColumn;
int bansColumn;
int sharedColumn;
};
#endif // ALT_TABLE_DELEGATE_H