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. Window Get hidden when "Show Desktop" pressed
Forum Updated to NodeBB v4.3 + New Features

Window Get hidden when "Show Desktop" pressed

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 463 Views 3 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.
  • X Offline
    X Offline
    Xx_Phantom_xX
    wrote on last edited by
    #1

    my qtWindow Get hidden when "Show Desktop" pressed (Windows + D)

    i tested the

    if(isMinimized()) {
                  setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
                  showNormal();
              }
    

    but didn't work, i think show desktop dosn't minimize the windows , it hides them or somthing

    i'm making a desktop widget so i need it be shown even when Win+D is pressed.

    thanks for helping me!

    Pl45m4P 1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Welcome to the Qt forum!
      Could you elaborate a bit more on your use case? What is a desktop widget? Where is the code shown actually located?

      Software Engineer
      The Qt Company, Oslo

      X 1 Reply Last reply
      0
      • Axel SpoerlA Axel Spoerl

        Welcome to the Qt forum!
        Could you elaborate a bit more on your use case? What is a desktop widget? Where is the code shown actually located?

        X Offline
        X Offline
        Xx_Phantom_xX
        wrote on last edited by
        #3

        @Axel-Spoerl
        hi , thanks for response

        the code shown up is executed every 1 second to check if the qtWindow is minimized and if so , show it, and it doesn't .

        anyway please ignore that , what i want is when i press Windows + D "Show Desktop" the window get hidden(or minimize) with other apps

        what i want is it to be always in desktop and blow other apps and not hide able by Windows + D

        8aa02df1-6f74-4895-aaa9-e4290a79282f-image.png

        1 Reply Last reply
        0
        • X Xx_Phantom_xX

          my qtWindow Get hidden when "Show Desktop" pressed (Windows + D)

          i tested the

          if(isMinimized()) {
                        setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
                        showNormal();
                    }
          

          but didn't work, i think show desktop dosn't minimize the windows , it hides them or somthing

          i'm making a desktop widget so i need it be shown even when Win+D is pressed.

          thanks for helping me!

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:

          i'm making a desktop widget so i need it be shown even when Win+D is pressed.

          I don't think that this is possible with Qt (or even at all).
          The Win-Key + D shortcut hides (not minimizes!!) all visible windows and shows the desktop.
          Unless I'm wrong, you can't stop the OS from hiding the underlying window in where your widget is rendered.

          the code shown up is executed every 1 second to check if the qtWindow is minimized and if so , show it, and it doesn't .

          You don't block the event loop by doing this, don't you?! You are using QTimer instead of some cringey while / sleep loop stuff, right?!! :))


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          X 1 Reply Last reply
          0
          • Pl45m4P Pl45m4

            @Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:

            i'm making a desktop widget so i need it be shown even when Win+D is pressed.

            I don't think that this is possible with Qt (or even at all).
            The Win-Key + D shortcut hides (not minimizes!!) all visible windows and shows the desktop.
            Unless I'm wrong, you can't stop the OS from hiding the underlying window in where your widget is rendered.

            the code shown up is executed every 1 second to check if the qtWindow is minimized and if so , show it, and it doesn't .

            You don't block the event loop by doing this, don't you?! You are using QTimer instead of some cringey while / sleep loop stuff, right?!! :))

            X Offline
            X Offline
            Xx_Phantom_xX
            wrote on last edited by
            #5

            @Pl45m4
            it is possible , rainmeter dose it
            4f7a9ab9-3997-4830-b49c-cb891265f41a-image.png
            when i press Show desktop it flickers a bit, showing that it re-showing itself

            and yes i'm using QTimer don't worry :)

            Pl45m4P X 2 Replies Last reply
            0
            • X Xx_Phantom_xX

              @Pl45m4
              it is possible , rainmeter dose it
              4f7a9ab9-3997-4830-b49c-cb891265f41a-image.png
              when i press Show desktop it flickers a bit, showing that it re-showing itself

              and yes i'm using QTimer don't worry :)

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by
              #6

              @Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:

              it is possible , rainmeter dose it

              It seems to be bugged there as well.
              Try to catch the Qt hide event for your widget, if this doesn't work either, I have no idea how they do it.

              • https://github.com/rainmeter/rainmeter/issues/377

              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              1 Reply Last reply
              0
              • X Xx_Phantom_xX

                @Pl45m4
                it is possible , rainmeter dose it
                4f7a9ab9-3997-4830-b49c-cb891265f41a-image.png
                when i press Show desktop it flickers a bit, showing that it re-showing itself

                and yes i'm using QTimer don't worry :)

                X Offline
                X Offline
                Xx_Phantom_xX
                wrote on last edited by
                #7

                @Xx_Phantom_xX

                @Pl45m4 said in Window Get hidden when "Show Desktop" pressed:

                catch the Qt hide even
                How tho?

                Pl45m4P X 2 Replies Last reply
                0
                • X Xx_Phantom_xX

                  @Xx_Phantom_xX

                  @Pl45m4 said in Window Get hidden when "Show Desktop" pressed:

                  catch the Qt hide even
                  How tho?

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote on last edited by
                  #8

                  @Xx_Phantom_xX

                  https://doc.qt.io/qt-6/qhideevent.html

                  You probably won't be able to prevent or intercept the Win+D combination with Qt, but maybe it works to show the widget manually again.


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  1 Reply Last reply
                  0
                  • X Xx_Phantom_xX

                    @Xx_Phantom_xX

                    @Pl45m4 said in Window Get hidden when "Show Desktop" pressed:

                    catch the Qt hide even
                    How tho?

                    X Offline
                    X Offline
                    Xx_Phantom_xX
                    wrote on last edited by
                    #9

                    @Xx_Phantom_xX

                    void QHideEvent() {
                        DeskPing w;
                        w.hide();
                    }
                    
                    void DeskPing::hide()
                    {
                         ui->txtIp->setText(QString::fromStdString("Window Got hidden!"));
                    }
                    

                    why this doesn't work?

                    Pl45m4P 1 Reply Last reply
                    0
                    • X Xx_Phantom_xX

                      @Xx_Phantom_xX

                      void QHideEvent() {
                          DeskPing w;
                          w.hide();
                      }
                      
                      void DeskPing::hide()
                      {
                           ui->txtIp->setText(QString::fromStdString("Window Got hidden!"));
                      }
                      

                      why this doesn't work?

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by Pl45m4
                      #10

                      @Xx_Phantom_xX said in Window Get hidden when "Show Desktop" pressed:

                      why this doesn't work?

                      If this is your serious question, then you should improve your C++ knowledge.

                      Short answer:
                      Because your code is wrong and will never work this way.

                      Detailed answer:
                      By "catching the hide event" I meant reimplementing it for your custom widget and then (maybe) force it to show itself again.
                      (Could be a little "dirty" but I can't think of other options right now. Probably others might know better)

                      • https://doc.qt.io/qt-6/eventsandfilters.html

                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      1 Reply Last reply
                      4

                      • Login

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