Browse Source

Keep quote activation separate from text selection gestures

master
evgeny 3 days ago
parent
commit
ec0666ca2a
  1. 2
      tools/chatgui/src/messagedelegate.cpp
  2. 3
      tools/chatgui/tests/test_invite_links.cpp

2
tools/chatgui/src/messagedelegate.cpp

@ -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);

3
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);

Loading…
Cancel
Save