chat: deleted-аккаунты — колонка deleted, скрытие/зачёркивание, не подключаемся

This commit is contained in:
evgeny committed 2026-09-07 01:40:53 +03:00
1 parent 631a176944
commit a17a85a383
10 files changed
+91 -46

No files matched your search

+7 -4
View File
@@ -29,9 +29,12 @@ void AccountDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
const int w = option.rect.right() - x - margin;
const int yMid = option.rect.top() + option.rect.height() / 2;
uint8_t flags = (uint8_t)(index.data(Qt::UserRole + 3).toInt() & 0xFF);
QFont nameFont = painter->font();
nameFont.setBold(true);
nameFont.setPixelSize(13);
if (flags & MEMBER_FLAG_DELETED) nameFont.setStrikeOut(true);
painter->setFont(nameFont);
QColor textColor = option.palette.color(QPalette::Text);
@@ -39,12 +42,12 @@ void AccountDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
if (index.data(Qt::UserRole + 2).toBool()) textColor = QColor("#4CAF50");
painter->setPen(textColor);
uint8_t flags = (uint8_t)(index.data(Qt::UserRole + 3).toInt() & 0xFF);
const uint8_t visualFlags = flags & (MEMBER_FLAG_SUPERNODE | MEMBER_FLAG_ADMIN | MEMBER_FLAG_MODER);
int flagX = x;
if (flags) {
if (visualFlags) {
FlagPainter::draw(painter, flags, flagX, option.rect.top() + (option.rect.height() - nameFont.pixelSize()) / 2, nameFont.pixelSize());
flagX += nameFont.pixelSize() * ((flags & 0x01 ? 1 : 0) + (flags & 0x02 ? 1 : 0) + (flags & 0x04 ? 1 : 0))
+ ((__builtin_popcount(flags) - 1) * 2);
int n = __builtin_popcount(visualFlags);
flagX += nameFont.pixelSize() * n + (n - 1) * 2;
}
QString name = index.data(Qt::DisplayRole).toString();