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. macOS window list in the dock icon menu.
Forum Updated to NodeBB v4.3 + New Features

macOS window list in the dock icon menu.

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

    Hi all.

    We recently ported our application from Qt 5 to Qt 6, and noticed the following on the macOS version: the application's dock icon menu now includes the list of windows. which was not displayed with Qt 5.

    dockMenu.png

    Now the problem is that we have a QSystemTrayIcon in our application, and it creates this ugly "Item-0" entry in the window list.

    Is there a way to:

    • get rid of the window list in the dock menu (qt 5 style) ?
    • get rid of the Item-0 entry alone?

    This seems unrelated to any menu we set via QMenu::setAsDockMenu().

    Here is a minimal example showing the issue. The code compiles both on Qt 5 and 6, and the window list only appears in the Qt 6 version.

    Thanks!

    Xavier

    1 Reply Last reply
    3
    • G Offline
      G Offline
      GGlowack
      wrote on last edited by
      #2

      I have faced a similar problem for some time. Decided to experiment with Loaders and loading SystemTrayIcon asynchronously.
      Surprisingly this solved "Item-0" issue for me.

      
      ApplicationWindow {
          id: root
      ...
          visible: true
      
          Component {
              id: trayComponent
              SystemTrayIcon {
                  id: systemIcon
              }
          }
          
          Loader{
              sourceComponent: trayComponent
              asynchronous: true
              visible: status == Loader.Ready
          }
      
      1 Reply Last reply
      1
      • ShrademnThillS Offline
        ShrademnThillS Offline
        ShrademnThill
        wrote on last edited by
        #3

        Hi,

        I also encounter this issue and I solved it by delaying the show:

        QTimer::singleShot(250, this, [this]
        {
        	trayIcon.show();
        });
        
        1 Reply Last reply
        1

        • Login

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