|
|
|
|
@ -180,6 +180,19 @@ void ChatView::mouseMoveEvent(QMouseEvent *event) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ChatView::mouseReleaseEvent(QMouseEvent *event) { |
|
|
|
|
const QModelIndex pressed(m_pressIndex); |
|
|
|
|
if (event->button() == Qt::LeftButton && !m_selecting && pressed.isValid() && |
|
|
|
|
(event->pos() - m_pressPos).manhattanLength() < 5 && indexAt(event->pos()) == pressed) { |
|
|
|
|
auto* delegate = qobject_cast<MessageDelegate*>(itemDelegate(pressed)); |
|
|
|
|
QStyleOptionViewItem option; option.initFrom(this); option.widget = this; option.rect = visualRect(pressed); |
|
|
|
|
const QString link = delegate ? delegate->inviteLinkAt(option, pressed, event->pos()) : QString(); |
|
|
|
|
if (!link.isEmpty()) { |
|
|
|
|
m_pressIndex = QPersistentModelIndex(); |
|
|
|
|
GUI_INFO("invite link: activated row=%d bytes=%d", pressed.row(), link.size()); |
|
|
|
|
emit inviteLinkActivated(link); |
|
|
|
|
event->accept(); return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (event->button() == Qt::LeftButton && m_selecting) { |
|
|
|
|
m_selecting = false; |
|
|
|
|
viewport()->update(); |
|
|
|
|
|