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. Hide QMainWindow from task bar and task switcher

Hide QMainWindow from task bar and task switcher

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmainwindowtaskbarhide
1 Posts 1 Posters 1.1k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Hello everyone,

    for my Qt application I want to create multipleMainWindows (derived from QMainWindow), but they should not appear in the task bar or in the task switcher (alt + tab). I found this stack overflow thread, but none of the suggested solutions worked.

    • Using a hidden QMainWindow as parent:
    QMainWindow hiddenParent;
    MainWindow window(&hiddenParent);
    window.show();
    

    The Window is still shown in the task bar and the task switcher.

    • Setting any combination of the Qt::Dialog, Qt::Tool and Qt::CustomizeWindowHint flags:
    MainWindow window(nullptr);
    window.setWindowFlags(Qt::Dialog | Qt::Tool | Qt::CustomizeWindowHint);
    window.show();
    

    The window does not show up at all, although the application is running, or the window is still visible in the task bar and the task switcher.

    • Setting the Qt::SubWindow flag:
    MainWindow window(nullptr);
    window.setWindowFlags(Qt::SubWindow);
    window.show();
    

    The Window is still shown in the task bar and the task switcher.

    • Setting the Qt::ToolTip flag:
    MainWindow window(nullptr);
    window.setWindowFlags(Qt::ToolTip);
    window.show();
    

    The window does not show up in the task bar or the task switcher, but it also loses the window decorations.

    Is using QMainWindows even the correct approach when I have multiple completely independent windows?
    I am working with Qt 6.0.2 on Ubuntu 20.04, however I also want to run the application on Windows.

    Thank you very much in advance!

    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