diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-06-23 17:25:22 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-06-23 17:25:22 +0200 |
commit | 1adb46420e4692f86626dc2b068f68f810b91048 (patch) | |
tree | f601f6f8e830a676f22961366c9fa8a50e2c9b24 | |
parent | 10ce807e1a862ce9969f1f904346105b3d69f8ad (diff) | |
download | qutebrowser-1adb46420e4692f86626dc2b068f68f810b91048.tar.gz qutebrowser-1adb46420e4692f86626dc2b068f68f810b91048.zip |
Revert "Remove now unneeded WrapperLayout.unwrap"
This reverts commit 370bd12a1512f5164be0e3ae1838515957e587fb.
Turns one of out the workarounds removed in
87d7dd93420ab92a1a209919297371dc0fadcecd is still needed until Qt 5.12...
-rw-r--r-- | qutebrowser/misc/miscwidgets.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index 868796e99..95786e3c7 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -240,6 +240,7 @@ class WrapperLayout(QLayout): def __init__(self, parent=None): super().__init__(parent) self._widget = None # type: typing.Optional[QWidget] + self._container = None # type: typing.Optional[QWidget] def addItem(self, _widget): raise utils.Unreachable @@ -264,10 +265,23 @@ class WrapperLayout(QLayout): def wrap(self, container, widget): """Wrap the given widget in the given container.""" + self._container = container self._widget = widget container.setFocusProxy(widget) widget.setParent(container) + def unwrap(self): + """Remove the widget from this layout. + + Does nothing if it nothing was wrapped before. + """ + if self._widget is None: + return + assert self._container is not None + self._widget.setParent(None) # type: ignore[call-overload] + self._widget = None + self._container.setFocusProxy(None) # type: ignore[arg-type] + class PseudoLayout(QLayout): |