From ec0666ca2a0add0a95c50c1001971c02e9b89065 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 8 Oct 2026 00:31:27 +0200 Subject: [PATCH] Keep quote activation separate from text selection gestures --- tools/chatgui/src/messagedelegate.cpp | 2 +- tools/chatgui/tests/test_invite_links.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/chatgui/src/messagedelegate.cpp b/tools/chatgui/src/messagedelegate.cpp index 6055a18b..e7cdc929 100644 --- a/tools/chatgui/src/messagedelegate.cpp +++ b/tools/chatgui/src/messagedelegate.cpp @@ -158,7 +158,7 @@ bool MessageDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const auto* view = qobject_cast(option.widget); const bool hadQuotePress = m_quotePress.isValid(); const bool activateQuote = onQuote && m_quotePress == index - && (mouse->pos() - m_quotePressPosition).manhattanLength() < 5 && (!view || !view->isSelecting()); + && (mouse->pos() - m_quotePressPosition).manhattanLength() < 5 && (!view || !view->hasSelection()); m_quotePress = QPersistentModelIndex(); const bool activatePoll = onPoll && m_pollPress == index && (mouse->pos() - m_pollPressPosition).manhattanLength() < 5 && (!view || !view->textSelection().active); diff --git a/tools/chatgui/tests/test_invite_links.cpp b/tools/chatgui/tests/test_invite_links.cpp index 2d2ee7bb..0c36f1a9 100644 --- a/tools/chatgui/tests/test_invite_links.cpp +++ b/tools/chatgui/tests/test_invite_links.cpp @@ -49,7 +49,8 @@ private slots: // Верхняя цитата у медиа/emoji; у текста она ниже имени автора. const bool text = type == "text/plain" || type == "poll"; const int y = text ? 8 + (outgoing ? 0 : QFontMetrics(view.font()).height() + 2) + 6 : 6; - const QPoint quote(view.viewport()->width() / 2, y); + const int x = width < 480 ? view.viewport()->width() / 2 : outgoing ? view.viewport()->width() - 170 : 170; + const QPoint quote(x, y); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, quote); QCOMPARE(replies.size(), 1); QCOMPARE(replies[0][0].toString(), QString(64, 'b')); QCOMPARE(downloads, 0); QCOMPARE(polls.size(), 0);