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. Windows with Qt:Tool flag shown on all desktops on Windows OS
Qt 6.11 is out! See what's new in the release blog

Windows with Qt:Tool flag shown on all desktops on Windows OS

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 417 Views 2 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.
  • G Offline
    G Offline
    gvanvoor
    wrote on last edited by
    #1

    I've noticed that windows which have the Qt::Tool flag set, are shown on all desktops on Windows OS. Does anybody know if there's a way to prevent this from happening? (I don't mind if there's a need to make platform specific calls to do this).

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Tool windows have a WS_EX_TOOLWINDOW style flag set, so the window manager styles them appropriately. This flag is also what causes this behavior and a lot of apps (not just Qt based) experience this. It doesn't seem to be documented anywhere on Microsoft's sites though, so it's hard to say if it's a bug or a feature.

      So whether that's intentional or not that's just how tool windows behave on virtual desktops. The only way to prevent this I know is to remove that style flag. You can do that with native SetWindowLong to set GWL_EXSTYLE, but that's basically the same as just not using the Qt::Tool flag and will make your window not look/behave like a tool window.

      G 1 Reply Last reply
      3
      • Chris KawaC Chris Kawa

        Tool windows have a WS_EX_TOOLWINDOW style flag set, so the window manager styles them appropriately. This flag is also what causes this behavior and a lot of apps (not just Qt based) experience this. It doesn't seem to be documented anywhere on Microsoft's sites though, so it's hard to say if it's a bug or a feature.

        So whether that's intentional or not that's just how tool windows behave on virtual desktops. The only way to prevent this I know is to remove that style flag. You can do that with native SetWindowLong to set GWL_EXSTYLE, but that's basically the same as just not using the Qt::Tool flag and will make your window not look/behave like a tool window.

        G Offline
        G Offline
        gvanvoor
        wrote on last edited by
        #3

        @Chris-Kawa Thanks for the info. Since the windows that have the flag set in my application need to have it, users will have to learn to live with it.

        Chris KawaC 1 Reply Last reply
        0
        • G gvanvoor

          @Chris-Kawa Thanks for the info. Since the windows that have the flag set in my application need to have it, users will have to learn to live with it.

          Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @gvanvoor Yeah, unfortunately it's a Windows API behavior, so you'd have to ask someone from Microsoft if that's intended and if there's a workaround.
          Maybe you can fiddle with the virtual desktop manager API, but I haven't tried it so can't give you specifics.

          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