|
|
|
|
@ -154,6 +154,8 @@ void ChatView::mouseMoveEvent(QMouseEvent *event) {
|
|
|
|
|
} |
|
|
|
|
if (!m_selecting) { |
|
|
|
|
QModelIndex idx = indexAt(viewport()->mapFrom(this, event->pos())); |
|
|
|
|
const bool link = m_inviteHitTest && !m_inviteHitTest(idx, event->pos()).isEmpty(); |
|
|
|
|
viewport()->setCursor(link ? Qt::PointingHandCursor : Qt::ArrowCursor); |
|
|
|
|
if (idx != QModelIndex(m_lastHovered)) { |
|
|
|
|
m_lastHovered = idx; |
|
|
|
|
const auto paths = animatedEmojiPaths(idx); |
|
|
|
|
@ -183,9 +185,7 @@ 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(); |
|
|
|
|
const QString link = m_inviteHitTest ? m_inviteHitTest(pressed, event->pos()) : QString(); |
|
|
|
|
if (!link.isEmpty()) { |
|
|
|
|
m_pressIndex = QPersistentModelIndex(); |
|
|
|
|
GUI_INFO("invite link: activated row=%d bytes=%d", pressed.row(), link.size()); |
|
|
|
|
|