[SOLVED] Recommended Approach for Inline Modal
-
-
New > QT Designer > Dialog. Doesn't exist. Did you mean Designer Form or Designer Form Class?
-
Add stuff to the new dialog.
-
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"?
-
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.
-
-
-
Sorry . didn't write all steps.
Yes its Designer Form Class, then choose Dialog in center. -
The edit controls or what you want to be displayed in the mainform in your inline dialog. buttons and such.
-
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 inHeaderfile
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.
-
-
@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?
-
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 ?
-
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 -
@mrjj Worked! Awesome!
-
@maximo
Super :) sorry for the confusion.
I hope its what you wanted. -
@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.
-
@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.
-
@mrjj I tidied this up here:
-
That is a nice step by step guide.
Thank you for updating post.