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. No Taskbar Icon on QDialog is shown before mainwindow.show() is called.
Forum Updated to NodeBB v4.3 + New Features

No Taskbar Icon on QDialog is shown before mainwindow.show() is called.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.6k Views 1 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.
  • C Offline
    C Offline
    Chrisw01
    wrote on last edited by
    #1

    Hi, Is it possible to have a icon for a QWidget in the taskbar displayed before mainwindow.show() is called. What I am doing is a login box of type QDialog is displayed waiting for input from the user. Sometimes the dialog is hidden behind other windows at startup. Or you may need to look at a different program. With no icon in the task bar you need to use CTRL-TAB to switch to that window again. Note, the icon does appear after successful completion of the Login Dialog.

    OS. Windows 10
    Qt: 5.12.5
    Compiled with MinGW

    Thanks..

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      The taskbar icon will only appear when there is a QMainWindow - so create your main window before your login dialog but don't show it.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      C 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        The taskbar icon will only appear when there is a QMainWindow - so create your main window before your login dialog but don't show it.

        C Offline
        C Offline
        Chrisw01
        wrote on last edited by Chrisw01
        #3

        @Christian-Ehrlicher Thats kind of what I am doing.

        In main() the mainwindow object is created. Then I have a function in mainwindow called startUp() that I call from main(). This function starts the databases up, creates a QDialog login dialog and then if all is good the last thing it does is calls showMaximized(); before returning to the main function to call a.exec();

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chrisw01
          wrote on last edited by
          #4

          I've figured this out.. For those with similar problems... If you create a dialog box and pass the main window object to it then the only time the dialog icon is shown is if the window is shown. so instead of ...

          someDialog dialog(this);
          

          I call it like this now...

          someDialog dialog(nullptr);
          

          End result is the dialog Icon is shown on task bar even though I have not shown the mainwindow yet.

          Thanks for your suggestions...

          Pablo J. RoginaP 1 Reply Last reply
          0
          • C Chrisw01

            I've figured this out.. For those with similar problems... If you create a dialog box and pass the main window object to it then the only time the dialog icon is shown is if the window is shown. so instead of ...

            someDialog dialog(this);
            

            I call it like this now...

            someDialog dialog(nullptr);
            

            End result is the dialog Icon is shown on task bar even though I have not shown the mainwindow yet.

            Thanks for your suggestions...

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @Chrisw01 said in No Taskbar Icon on QDialog is shown before mainwindow.show() is called.:

            I've figured this out..

            So is it time to mark your post as solved? Thanks.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            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