Qt: Fix a deprecation issue.
Use QFontMetrics::horizontalAdvance instead of QFontMetrics::width with newer versions of Qt. Change-Id: I65b3f4a6349d5c6dcd19e1cb029f0c8ce83decd0 Reviewed-on: https://code.wireshark.org/review/36644 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Jason Cohen <kryojenik2@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
8017bde10c
commit
e2b695ddef
|
@ -161,7 +161,12 @@ struct progdlg *ProgressFrame::showProgress(const QString &title, bool animate,
|
|||
ui->progressBar->setValue(value);
|
||||
QString elided_title = title;
|
||||
int max_w = fontMetrics().height() * 20; // em-widths, arbitrary
|
||||
if (fontMetrics().width(title) > max_w) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
int title_w = fontMetrics().horizontalAdvance(title);
|
||||
#else
|
||||
int title_w = fontMetrics().width(title);
|
||||
#endif
|
||||
if (title_w > max_w) {
|
||||
elided_title = fontMetrics().elidedText(title, Qt::ElideRight, max_w);
|
||||
}
|
||||
// If we're in the main status bar, should we push this as a status message instead?
|
||||
|
|
Loading…
Reference in New Issue