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. Taskbar click event
Forum Updated to NodeBB v4.3 + New Features

Taskbar click event

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 588 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.
  • N Offline
    N Offline
    Nan Feng
    wrote on 9 Nov 2022, 09:38 last edited by
    #1

    Dear fellow forum members, good morning. I have a problem that after Qt program is minimized, I need to restore the normal display when I click software in the taskbar. This is done by default. But I need to do a few things before I go back to the default display. So you need to know in eventFilter how do you determine if it's a taskbar click event?

    J 1 Reply Last reply 9 Nov 2022, 09:50
    0
    • N Nan Feng
      9 Nov 2022, 09:38

      Dear fellow forum members, good morning. I have a problem that after Qt program is minimized, I need to restore the normal display when I click software in the taskbar. This is done by default. But I need to do a few things before I go back to the default display. So you need to know in eventFilter how do you determine if it's a taskbar click event?

      J Offline
      J Offline
      JonB
      wrote on 9 Nov 2022, 09:50 last edited by JonB 11 Sept 2022, 09:51
      #2

      @Nan-Feng
      What is a "taskbar"? Something in your windowing system? A Windows taskbar on the desktop if you are under Windows?

      Qt isn't going to know/tell you that something was caused by/emanated from some windowing desktop or taskbar. Does clicking the taskbar just toggle between window mimimize and window restore? I can only think of showEvent() or QShowEvent where event->spontaneous() will be true to tell you the event came from the windowing system rather than your own code calling show...().

      1 Reply Last reply
      1
      • C Online
        C Online
        Chris Kawa
        Lifetime Qt Champion
        wrote on 9 Nov 2022, 14:16 last edited by
        #3

        Clicking an icon on a taskbar is not the only way to activate your app. You can alt-tab to it or it can be activated by the OS when all other apps are closed, some other app might send your window a minimize/maximize/restore message etc. In general don't rely on what's happening outside of your app in the OS. Some update will come out that changes that behavior and your app will stop working correctly.

        In the event filter you can check for QWindowStateChangeEvent. This will tell you when your app is minimized, maximized or restored, no matter what caused it.

        N 1 Reply Last reply 11 Nov 2022, 08:59
        3
        • C Chris Kawa
          9 Nov 2022, 14:16

          Clicking an icon on a taskbar is not the only way to activate your app. You can alt-tab to it or it can be activated by the OS when all other apps are closed, some other app might send your window a minimize/maximize/restore message etc. In general don't rely on what's happening outside of your app in the OS. Some update will come out that changes that behavior and your app will stop working correctly.

          In the event filter you can check for QWindowStateChangeEvent. This will tell you when your app is minimized, maximized or restored, no matter what caused it.

          N Offline
          N Offline
          Nan Feng
          wrote on 11 Nov 2022, 08:59 last edited by
          #4

          @Chris-Kawa Thanks.Solved!!!.Love you~

          1 Reply Last reply
          0

          1/4

          9 Nov 2022, 09:38

          • Login

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