summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-04-13 20:54:32 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-04-13 23:19:22 +0200
commitac84cbaad9b8132e2ca8681938b2c28e192f5930 (patch)
tree06d9f865979c335da941026cee7f4f19418bedd9
parent3bced54404eef0203250cf9b4b5fa9a1e3d05d85 (diff)
downloadqutebrowser-ac84cbaad9b8132e2ca8681938b2c28e192f5930.tar.gz
qutebrowser-ac84cbaad9b8132e2ca8681938b2c28e192f5930.zip
Use QFontMetrics::boundingRect()
.width() was deprecated in Qt 5.11 because what it actually does is better described as .horizontalAdvance(): https://codereview.qt-project.org/c/qt/qtbase/+/201397 (ee2ad9df701b27790e2ab72e99111d255fde42ed in qtbase) Docs: https://doc.qt.io/qt-6/qfontmetrics.html#horizontalAdvance-2 What we actually want for the size hint is the bounding box. (originally cherry picked from commit 78838338c331d74931da31acd2306550721ef121)
-rw-r--r--qutebrowser/mainwindow/statusbar/command.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/qutebrowser/mainwindow/statusbar/command.py b/qutebrowser/mainwindow/statusbar/command.py
index 92408d34f..199f0a103 100644
--- a/qutebrowser/mainwindow/statusbar/command.py
+++ b/qutebrowser/mainwindow/statusbar/command.py
@@ -276,7 +276,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
text = self.text()
if not text:
text = 'x'
- width = self.fontMetrics().width(text)
+ width = self.fontMetrics().boundingRect(text).width()
return QSize(width, height)
@pyqtSlot()