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. QMainWindow with own dialog taskbar icon
Qt 6.11 is out! See what's new in the release blog

QMainWindow with own dialog taskbar icon

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • F Offline
    F Offline
    flautzr
    wrote on last edited by flautzr
    #1

    Hi,

    I have a dialog in an Application. The dialog is derived from QMainWindow and lives in the bigger Application which creates and destroys the dialog. I know that QmainWindow is not the correct class to use for a sub-dialog but changing that is a task for another day.

    The issue is, when the dialog is open, it doesnt have a taskbar icon. When minimized, it reduces itself to a tiny window at the lower left corner where it can be reopened by clicking the respective icon on it but our customer wants it to be accessible through a taskbar icon.

    I've read that it should actually be having an own icon by default, but since our App still uses MFC, there is a wrapper that ensures compatibility. Basically an instance of the wrapper class (QWinWidget) is created and the dialog is then created with the wrapper class as parent. I assume this is the cause for this behaviour.

    Any ideas on how to achieve that?

    1 Reply Last reply
    0
    • Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by
      #2

      Hi @flautzr ,

      If you let the parent of your dialog to null_ptr, it should create a "standalone" window with its own taskbar icon.

      JonBJ F 2 Replies Last reply
      1
      • Gojir4G Gojir4

        Hi @flautzr ,

        If you let the parent of your dialog to null_ptr, it should create a "standalone" window with its own taskbar icon.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @Gojir4
        Ooohhh, that's a good one (provided it works!) :)

        Hang on though! Remember, the OP is not using a QDialog for the "dialog" only a QMainWindow. Does that "null parent produces taskbar icon" require a Windows dialog?

        Gojir4G 1 Reply Last reply
        0
        • Gojir4G Gojir4

          Hi @flautzr ,

          If you let the parent of your dialog to null_ptr, it should create a "standalone" window with its own taskbar icon.

          F Offline
          F Offline
          flautzr
          wrote on last edited by
          #4

          @Gojir4 This does work surprisingly ...

          i never doubted your suggestion, what surprises me is the wrapper class around the dialog is not needed at all so now I have to talk to my fellow developer what this means.

          thanks for the solution!

          1 Reply Last reply
          0
          • JonBJ JonB

            @Gojir4
            Ooohhh, that's a good one (provided it works!) :)

            Hang on though! Remember, the OP is not using a QDialog for the "dialog" only a QMainWindow. Does that "null parent produces taskbar icon" require a Windows dialog?

            Gojir4G Offline
            Gojir4G Offline
            Gojir4
            wrote on last edited by
            #5

            @JonB said in QMainWindow with own dialog taskbar icon:

            Does that "null parent produces taskbar icon" require a Windows dialog?

            That's behavior of any QWidget so no matter if it's a QMainWindow or a QDialog.
            I just did test with Python and I see the same result using a dialog .

            As said in the doc of QWidget:

            If parent is nullptr, the new widget becomes a window. If parent is another widget, this widget becomes a child window inside parent. The new widget is deleted when its parent is deleted.

            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