Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. applicationStateChanged not called when computer goes to sleep
Forum Updated to NodeBB v4.3 + New Features

applicationStateChanged not called when computer goes to sleep

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.4k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    cristeab
    wrote on last edited by cristeab
    #1

    Hi

    I am looking for a way of detecting when the computer goes to sleep in my application. I am using Qt 5.3 and the target platform is Linux. I have found applicationStateChanged() emitted by QGuiApplication, but this signal does not seem to be emitted. Am I missing something or is there another way of detecting when computer goes to sleep ?

    thanks
    Bogdan

    ? 1 Reply Last reply
    0
    • C cristeab

      Hi

      I am looking for a way of detecting when the computer goes to sleep in my application. I am using Qt 5.3 and the target platform is Linux. I have found applicationStateChanged() emitted by QGuiApplication, but this signal does not seem to be emitted. Am I missing something or is there another way of detecting when computer goes to sleep ?

      thanks
      Bogdan

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @cristeab Hi! The D-Bus service "org.freedesktop.UPower" offers the signals you need.

      1 Reply Last reply
      0
      • stackprogramerS Offline
        stackprogramerS Offline
        stackprogramer
        wrote on last edited by
        #3

        Qt is a framework for RAPID DEVELOPMENT our app .so it has not most API of native platform .other words for some work you need get privileges adminstrator and root or sudo for accessing this ability to your app.
        in windows for do these work we use win32api.
        in linux you should work with kernel and signals.
        so your object you should add some native platform c++/c code to your Qt projects.that Qt call it Qt Android Extras or Qt X11 Extras and ...............
        if you use Extras your app cannot be crossplatform.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cristeab
          wrote on last edited by
          #4

          Hi

          Thanks for the replies. How about using QAbstractNativeFilterEvent() ? It seems that on Windows this works.

          regards
          Bogdan

          ? 1 Reply Last reply
          0
          • C cristeab

            Hi

            Thanks for the replies. How about using QAbstractNativeFilterEvent() ? It seems that on Windows this works.

            regards
            Bogdan

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @cristeab On Linux, the Desktop Bus (D-Bus) was exactly invented for stuff like this. It replaced everything else and all the distros are using this for years. The next thing that will be replaced will be the X server (Wayland will be its successor) . And now you want to write new code that handles Xcb events? I don't think that's a great idea. Just use D-Bus. It's also supported by Qt -> http://doc.qt.io/qt-5/qtdbus-index.html

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cristeab
              wrote on last edited by
              #6

              ok, thanks for the information.

              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