diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index 21ed227ed9a9914a9b79f706c97423f26152197b..67d27b5a1ba4f97ec4e70ac485ec4e3bbb314b8a 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -648,10 +648,10 @@ public: protected: void paintEvent(QPaintEvent *event) - { - QPainter p(this); + { QFontMetrics fm(font()); if (fm.width(text()) > (contentsRect().width() - 6) && text().length() > 4) { + QPainter p(this); QString elided_txt; elided_txt = this->fontMetrics().elidedText(text(), Qt::ElideRight, rect().width() - 6, Qt::TextShowMnemonic); p.drawText(rect().adjusted(12, 0, 0, 0), elided_txt);