Qt World Summit: Register Today!

mousePressEvent and startSystemResize breaks mouse focus on window?

  • 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):
    		self.button = QtWidgets.QPushButton()
    		self.lineedit = QtWidgets.QLineEdit()
    		self.layout = QtWidgets.QHBoxLayout(self)
    	def mousePressEvent(self, event):
    if __name__ == "__main__":
    	app = QtWidgets.QApplication(sys.argv)
    	window = Window()

    is there a way to reactivate this "focus"

  • Lifetime Qt Champion

    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.

  • 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.

Log in to reply