Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Hide QMainWindow from task bar and task switcher

    General and Desktop
    qmainwindow taskbar hide
    1
    1
    494
    Loading More Posts
    • 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.
    • R
      Roysten Rigobert last edited by Roysten Rigobert

      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 Reply Quote 1
      • First post
        Last post