Keep quote activation separate from text selection gestures

This commit is contained in:
evgeny committed 2026-10-08 00:31:27 +02:00
1 parent 484d6f2fa4
commit ec0666ca2a
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -158,7 +158,7 @@ bool MessageDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
const auto* view = qobject_cast<const ChatView*>(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);
+2 -1
View File
@@ -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);