mousePressEvent and startSystemResize breaks mouse focus on window?
Poggar last edited by
Something weird I found while experimenting. If you use startSystemResize on mouse press, the window "loses" mouse focus. In the example if you activate the resize function by clicking the background, then you release mouse button, the push button will not show tooltip, line edit won't change cursor to IBeamCursor etc. until you press anything again.
import sys from PySide6 import QtWidgets, QtCore class Window(QtWidgets.QWidget): def __init__(self): super().__init__() self.button = QtWidgets.QPushButton() self.button.setToolTip("Tooltip") self.lineedit = QtWidgets.QLineEdit() self.layout = QtWidgets.QHBoxLayout(self) self.layout.addWidget(self.button) self.layout.addWidget(self.lineedit) self.show() def mousePressEvent(self, event): self.windowHandle().startSystemResize(QtCore.Qt.TopEdge|QtCore.Qt.LeftEdge) if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) window = Window() sys.exit(app.exec_())
is there a way to reactivate this "focus"
Hi and welcome to devnet,
That is indeed something strange but why are you using it in the first place ? QWidget already has support for resizing.
Rafael Tosta last edited by
Hello, did you find a solution?
I have the same problem.But I found that this only occurs in a Wayland session and Gnome.
Even in gnome and xorg this problem does not happen.