diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-08-23 20:13:11 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-08-23 21:27:50 +0300 |
commit | 1260ecd812e35185898fd555ad3e01d019072bcf (patch) | |
tree | 02a9912efdfadafbea77535b6730b141167a569f /src/qt/guiutil.h | |
parent | 442a9c64775454a7073aff9872721c58b1dd35c5 (diff) |
qt: Add TextWidth() wrapper
In Qt 5.12 and before the QFontMetrics::width() is used and it is
deprecated since Qt 13.0.
In Qt 5.11 the QFontMetrics::horizontalAdvance() was introduced.
Diffstat (limited to 'src/qt/guiutil.h')
-rw-r--r-- | src/qt/guiutil.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index bea4a83494..9db92f94d7 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -257,6 +257,14 @@ namespace GUIUtil // Fix known bugs in QProgressDialog class. void PolishProgressDialog(QProgressDialog* dialog); + + /** + * Returns the distance in pixels appropriate for drawing a subsequent character after text. + * + * In Qt 5.12 and before the QFontMetrics::width() is used and it is deprecated since Qt 13.0. + * In Qt 5.11 the QFontMetrics::horizontalAdvance() was introduced. + */ + int TextWidth(const QFontMetrics& fm, const QString& text); } // namespace GUIUtil #endif // BITCOIN_QT_GUIUTIL_H |