chatgui: кнопка + для invite в каналах, автокопирование ссылки, автоподключение из буфера

- Замена контекстного меню 'Пригласить' на кнопку + (18x18) справа снизу каждого канала с hover-эффектом
- InviteDialog: авто-копирование ссылки в буфер (Clipboard + Selection) при открытии
- JoinDialog: параметр autoJoinLink — если в буфере валидная utun:// ссылка, диалог сразу стартует подключение
This commit is contained in:
Evgeny committed 2026-07-19 09:05:55 +03:00
1 parent 501b636d19
commit e3286d409f
8 files changed
+107 -27

No files matched your search

+29 -1
View File
@@ -5,6 +5,13 @@
ChannelDelegate::ChannelDelegate(QObject *parent)
: QStyledItemDelegate(parent) {}
QRect ChannelDelegate::inviteButtonRect(const QRect &itemRect) {
const int margin = 6;
return QRect(itemRect.right() - margin - InviteBtnSize,
itemRect.bottom() - margin - InviteBtnSize,
InviteBtnSize, InviteBtnSize);
}
void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const {
painter->save();
@@ -90,7 +97,8 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
if (option.state & QStyle::State_Selected) nickColor = nickColor.lighter(140);
QRect msgRect(textRect.left(), nameRect.bottom() + 4,
textRect.width(), option.rect.bottom() - nameRect.bottom() - margin);
textRect.right() - InviteBtnSize - 6 - textRect.left(),
option.rect.bottom() - nameRect.bottom() - margin);
QFontMetrics msgFm(msgFont);
int colon = lastMsg.indexOf(QString::fromUtf8(": "));
@@ -117,6 +125,26 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
}
}
/* ── invite plus button (bottom-right) ── */
QRect plusRect = inviteButtonRect(option.rect);
bool plusHovered = index.data(ChannelInviteBtnHoveredRole).toInt() != 0;
painter->setRenderHint(QPainter::Antialiasing);
if (plusHovered) {
painter->setBrush(QColor(0x33, 0x90, 0xEC));
painter->setPen(Qt::NoPen);
painter->drawEllipse(plusRect);
painter->setPen(QPen(Qt::white, 2));
} else {
painter->setBrush(QColor(0x33, 0x90, 0xEC, 110));
painter->setPen(Qt::NoPen);
painter->drawEllipse(plusRect);
painter->setPen(QPen(QColor(0x33, 0x90, 0xEC), 2));
}
painter->drawLine(plusRect.center().x(), plusRect.top() + 5,
plusRect.center().x(), plusRect.bottom() - 5);
painter->drawLine(plusRect.left() + 5, plusRect.center().y(),
plusRect.right() - 5, plusRect.center().y());
painter->restore();
}