From 735f1774e4c622ea50a4576d180daecfc0698918 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 26 Aug 2021 17:12:45 +0200 Subject: API stuff --- qutebrowser/keyinput/keyutils.py | 6 +++--- qutebrowser/mainwindow/mainwindow.py | 2 +- qutebrowser/mainwindow/statusbar/command.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'qutebrowser') diff --git a/qutebrowser/keyinput/keyutils.py b/qutebrowser/keyinput/keyutils.py index d03220a7a..387e1ac4b 100644 --- a/qutebrowser/keyinput/keyutils.py +++ b/qutebrowser/keyinput/keyutils.py @@ -472,9 +472,9 @@ class KeySequence: def __iter__(self) -> Iterator[KeyInfo]: """Iterate over KeyInfo objects.""" for key_and_modifiers in self._iter_keys(): - key = Qt.Key(int(key_and_modifiers) & ~Qt.KeyboardModifier.KeyboardModifierMask) - modifiers = Qt.KeyboardModifier( # type: ignore[call-overload] - int(key_and_modifiers) & Qt.KeyboardModifier.KeyboardModifierMask) + # key = Qt.Key(int(key_and_modifiers) & ~Qt.KeyboardModifier.KeyboardModifierMask) + key = key_and_modifiers.key() + modifiers = key_and_modifiers.keyboardModifiers() yield KeyInfo(key=key, modifiers=modifiers) def __repr__(self) -> str: diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index a3e6722af..1d694a45a 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -565,7 +565,7 @@ class MainWindow(QWidget): refresh_window = self.isVisible() if hidden: window_flags |= Qt.WindowType.CustomizeWindowHint | Qt.WindowType.NoDropShadowWindowHint - self.setWindowFlags(cast(Qt.WindowFlags, window_flags)) + self.setWindowFlags(window_flags) if refresh_window: self.show() diff --git a/qutebrowser/mainwindow/statusbar/command.py b/qutebrowser/mainwindow/statusbar/command.py index dbb4a4626..bbcf16c7b 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().horizontalAdvance(text) return QSize(width, height) @pyqtSlot() -- cgit v1.2.3-54-g00ecf