Show temporary Copied feedback after copying a code block

This commit is contained in:
evgeny committed 2026-11-03 00:24:46 +01:00
1 parent c91a217c0c
commit fff5834a01
3 files changed
+25 -5

No files matched your search

+3 -1
View File
@@ -237,6 +237,8 @@ QRectF messageCodeCopyRect(const QTextLayout& layout, const MessageCodeBlock& bl
if (!line.isValid()) return {};
const QFontMetricsF metrics(layout.font());
const qreal height = metrics.height() + 8;
const qreal buttonWidth = qMin(qreal(width), metrics.horizontalAdvance(QCoreApplication::translate("ChatGui", "Copy")) + 16);
const qreal labelWidth = qMax(metrics.horizontalAdvance(QCoreApplication::translate("ChatGui", "Copy")),
metrics.horizontalAdvance(QCoreApplication::translate("ChatGui", "Copied")));
const qreal buttonWidth = qMin(qreal(width), labelWidth + 16);
return QRectF(width - buttonWidth, line.y() - height + 2, buttonWidth, height - 4);
}