forked from qt-creator/qt-creator
Fix Qt 5.13 deprecation warning about QFontMetrics::width()
Replace by QFontMetrics::horizontalAdvance(), fixing: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] Change-Id: I9991ffefe6e87e872dc35ba291d562e06b28ca64 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -66,7 +66,7 @@ void ElidingLabel::paintEvent(QPaintEvent *)
|
||||
QRect contents = contentsRect().adjusted(m, m, -m, -m);
|
||||
QFontMetrics fm = fontMetrics();
|
||||
QString txt = text();
|
||||
if (txt.length() > 4 && fm.width(txt) > contents.width()) {
|
||||
if (txt.length() > 4 && fm.horizontalAdvance(txt) > contents.width()) {
|
||||
setToolTip(txt);
|
||||
txt = fm.elidedText(txt, m_elideMode, contents.width());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user