QmlDesigner: Fix shortcut text clip for the context menus

Task-number: QDS-9662
Change-Id: I7f9385e99c65b2201e36625b2094f04e6f6b701f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
Ali Kianian
2023-04-12 16:23:32 +03:00
parent bcb89dc900
commit f5da6d2eac

View File

@@ -155,7 +155,7 @@ private:
void addText(const QString &txt, QPainter *painter = nullptr) void addText(const QString &txt, QPainter *painter = nullptr)
{ {
if (txt.size()) { if (txt.size()) {
int textWidth = fm.boundingRect(txt).width(); int textWidth = fm.horizontalAdvance(txt);
QSize itemSize = {textWidth, defaultHeight}; QSize itemSize = {textWidth, defaultHeight};
if (painter) { if (painter) {
static const QTextOption textOption(Qt::AlignLeft | Qt::AlignVCenter); static const QTextOption textOption(Qt::AlignLeft | Qt::AlignVCenter);