Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. mousePressEvent and startSystemResize breaks mouse focus on window?

mousePressEvent and startSystemResize breaks mouse focus on window?

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for pythonpython
3 Posts 3 Posters 531 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Poggar
    wrote on last edited by
    #1

    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"

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • R Offline
        R Offline
        Rafael Tosta
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved