Draw Copy controls for code blocks and copy complete block on click

This commit is contained in:
evgeny committed 2026-11-02 23:50:42 +01:00
1 parent f7e82c04a7
commit 61aafac32d
3 files changed
+50 -2

No files matched your search

+6 -1
View File
@@ -187,7 +187,12 @@ void ChatView::mouseMoveEvent(QMouseEvent *event) {
if (!m_selecting) {
QModelIndex idx = indexAt(viewport()->mapFrom(this, event->pos()));
const bool link = m_linkHitTest && !m_linkHitTest(idx, event->pos()).isEmpty();
viewport()->setCursor(link ? Qt::PointingHandCursor : Qt::ArrowCursor);
bool copyCode = false;
if (auto* delegate = qobject_cast<MessageDelegate*>(itemDelegate())) {
QStyleOptionViewItem option; option.initFrom(this); option.widget = this; option.rect = visualRect(idx);
copyCode = delegate->codeCopyAt(option, idx, event->pos()) >= 0;
}
viewport()->setCursor(link || copyCode ? Qt::PointingHandCursor : Qt::ArrowCursor);
if (idx != QModelIndex(m_lastHovered)) {
m_lastHovered = idx;
const auto paths = animatedEmojiPaths(idx);