Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1590

Problem receiving system event

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.14.2, 5.15.0
    • PySide
    • None
    • Linux/Wayland, Windows

    Description

      Hello. I try detecting change state computer - hibernate/sleep mode

      On Qt forum https://forum.qt.io/topic/69485/do-an-operation-when-computer-goes-to-sleep used nativeEventFilter from QAbstractNativeEventFilter.

      I created example based on QCoreApplication:

      {{}}

      from PySide2.QtCore import QCoreApplication, QAbstractNativeEventFilter
      class MyFilter(QAbstractNativeEventFilter):
          def nativeEventFilter(eventType, message, result):
              print("eventType %s" % eventType)
              print("message %s" % message)
              print("result %s" % result)
              return False
      my_filter = MyFilter()
      app = QCoreApplication()
      event_dispatcher = app.eventDispatcher()
      print(event_dispatcher)
      event_dispatcher.installNativeEventFilter(my_filter)
      # app.installNativeEventFilter(my_filter)
      print("App started")
      app.exec_()
      
      

      Ran this script on Fedora 32 (PySide2 - 5.15.0) - no events caught

      Ran this script on Windows 10 (PySide2 - 5.14.2) - immediately after start recived only three event:

      eventType <__main__.MyFilter object at 0x0000026E74140340>
      message b'windows_dispatcher_MSG'
      result shiboken2.libshiboken.VoidPtr(Address 0x00000075667EB830, Size 0, isWritable False)
      eventType <__main__.MyFilter object at 0x0000026E74140340>
      message b'windows_dispatcher_MSG'
      result shiboken2.libshiboken.VoidPtr(Address 0x00000075667EB840, Size 0, isWritable False)
      eventType <__main__.MyFilter object at 0x0000026E74140340>
      message b'windows_dispatcher_MSG'
      result shiboken2.libshiboken.VoidPtr(Address 0x00000075667EB760, Size 0, isWritable False)

      How to get a computer state change?

      {{}}

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            weedman Michl Voznesensky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes