Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Recommended Approach for Inline Modal
Qt 6.12 LTS is out! See what's new in the release blog

[SOLVED] Recommended Approach for Inline Modal

Scheduled Pinned Locked Moved General and Desktop
15 Posts 2 Posters 5.1k 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.
  • M maximo

    @mrjj I tried to follow your instructions in Qt5.5 Creator but they didn't line up.

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #4

    @maximo
    what did not line up?
    The dialogs?
    Did you inline it or use frameless dialogs?

    M 1 Reply Last reply
    0
    • mrjjM mrjj

      @maximo
      what did not line up?
      The dialogs?
      Did you inline it or use frameless dialogs?

      M Offline
      M Offline
      maximo
      wrote on last edited by
      #5

      @mrjj

      1. New > QT Designer > Dialog. Doesn't exist. Did you mean Designer Form or Designer Form Class?

      2. Add stuff to the new dialog.

      3. Add a widget to the centralWidget. Which centralWidget? The one in the main application window (I assume) ? Also, you say "add a widget". Did you mean just the widget in the toolbox that says "Widget"?

      4. Rightclick the centralWidget and choose Promote. I did this in the main window. I see a dialog that looks like this:

      http://screencast.com/t/9xLRr59xgTzM

      I have no clue what to put in those fields.

      mrjjM 1 Reply Last reply
      0
      • M maximo

        @mrjj

        1. New > QT Designer > Dialog. Doesn't exist. Did you mean Designer Form or Designer Form Class?

        2. Add stuff to the new dialog.

        3. Add a widget to the centralWidget. Which centralWidget? The one in the main application window (I assume) ? Also, you say "add a widget". Did you mean just the widget in the toolbox that says "Widget"?

        4. Rightclick the centralWidget and choose Promote. I did this in the main window. I see a dialog that looks like this:

        http://screencast.com/t/9xLRr59xgTzM

        I have no clue what to put in those fields.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @maximo

        1. Sorry . didn't write all steps.
          Yes its Designer Form Class, then choose Dialog in center.

        2. The edit controls or what you want to be displayed in the mainform in your inline dialog. buttons and such.

        3. The mainwindow centralWidget. yes. I assumed you wanted it there.
          Yes, "Add widget" is that widget type from the list.
          It is just a place holder. Could also use Frame.

        in

        Promoted class name,

        we must type the name of the dialog class.
        Like
        MyDialog
        or whatever you call it in (1).
        Note big/small letters.
        Then in

        Headerfile

        you must type name of header file.
        like
        mydialog.h
        (this is most likely small letters)

        Then Press Add button
        and now you can press the Promote button.

        Hope this is better to follow.

        M 1 Reply Last reply
        0
        • mrjjM mrjj

          @maximo

          1. Sorry . didn't write all steps.
            Yes its Designer Form Class, then choose Dialog in center.

          2. The edit controls or what you want to be displayed in the mainform in your inline dialog. buttons and such.

          3. The mainwindow centralWidget. yes. I assumed you wanted it there.
            Yes, "Add widget" is that widget type from the list.
            It is just a place holder. Could also use Frame.

          in

          Promoted class name,

          we must type the name of the dialog class.
          Like
          MyDialog
          or whatever you call it in (1).
          Note big/small letters.
          Then in

          Headerfile

          you must type name of header file.
          like
          mydialog.h
          (this is most likely small letters)

          Then Press Add button
          and now you can press the Promote button.

          Hope this is better to follow.

          M Offline
          M Offline
          maximo
          wrote on last edited by
          #7

          @mrjj Okay, I added it (called it "Dialog") and this is what that form looks like:

          http://screencast.com/t/KVtqWZfCHE

          However, when I do Build > Run from the menus, I don't see the QWidget with that UI inside it. I don't see the QWidget at all.

          What do I do next?

          mrjjM 1 Reply Last reply
          0
          • M maximo

            @mrjj Okay, I added it (called it "Dialog") and this is what that form looks like:

            http://screencast.com/t/KVtqWZfCHE

            However, when I do Build > Run from the menus, I don't see the QWidget with that UI inside it. I don't see the QWidget at all.

            What do I do next?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #8

            Hi
            And you have promoted a widget or frame ?
            After you added it. You must press Promote.
            So you must right click the widget (placeholder) and promote it to Dialog.
            Did you do that besides adding it ?

            And you did add something to the ui file (for Dialog) ?
            (so there is something to show up ?)

            Update:
            Ok it looks like you did it right.

            So how do you mainscreen look like before you run it ?

            mrjjM 1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              And you have promoted a widget or frame ?
              After you added it. You must press Promote.
              So you must right click the widget (placeholder) and promote it to Dialog.
              Did you do that besides adding it ?

              And you did add something to the ui file (for Dialog) ?
              (so there is something to show up ?)

              Update:
              Ok it looks like you did it right.

              So how do you mainscreen look like before you run it ?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #9

              Ok. sorry. I remembered wrong.
              Select Type "Widget" in step 1.
              Not Dialog.

              Default name will be Form
              so put
              Form
              and
              form.h
              in promote dialog,
              and "add" and "promote"
              Just made small test here to be sure.
              https://www.dropbox.com/s/p69tpbmi9v059b4/maxtest.zip?dl=0

              M 1 Reply Last reply
              0
              • mrjjM mrjj

                Ok. sorry. I remembered wrong.
                Select Type "Widget" in step 1.
                Not Dialog.

                Default name will be Form
                so put
                Form
                and
                form.h
                in promote dialog,
                and "add" and "promote"
                Just made small test here to be sure.
                https://www.dropbox.com/s/p69tpbmi9v059b4/maxtest.zip?dl=0

                M Offline
                M Offline
                maximo
                wrote on last edited by
                #10

                @mrjj Worked! Awesome!

                mrjjM 1 Reply Last reply
                0
                • M maximo

                  @mrjj Worked! Awesome!

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @maximo
                  Super :) sorry for the confusion.
                  I hope its what you wanted.

                  M 2 Replies Last reply
                  1
                  • mrjjM mrjj

                    @maximo
                    Super :) sorry for the confusion.
                    I hope its what you wanted.

                    M Offline
                    M Offline
                    maximo
                    wrote on last edited by
                    #12

                    @mrjj It is, exactly. I guess the only thing I want to know now is how to promote via code. That way, I can stick one widget on the Main Window's centralWidget and then just switch the promotions via code.

                    M 1 Reply Last reply
                    0
                    • M maximo

                      @mrjj It is, exactly. I guess the only thing I want to know now is how to promote via code. That way, I can stick one widget on the Main Window's centralWidget and then just switch the promotions via code.

                      M Offline
                      M Offline
                      maximo
                      wrote on last edited by maximo
                      #13

                      @mrjj It doesn't look like there's a programmatic way to do that unless I want to do something messy like intercept the Paint event:

                      http://stackoverflow.com/questions/32584320/programmatically-promote-qwidget

                      So, what I'll do is use a QStackedWidget control and put my content inside that. That way, I can put several dialogs there that I can flip in the designer, and then switch that index via code.

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @maximo
                        Super :) sorry for the confusion.
                        I hope its what you wanted.

                        M Offline
                        M Offline
                        maximo
                        wrote on last edited by
                        #14

                        @mrjj I tidied this up here:

                        http://stackoverflow.com/a/32940561/105539

                        1 Reply Last reply
                        1
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #15

                          That is a nice step by step guide.
                          Thank you for updating post.

                          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
                          • Unsolved