You have a QMainWindow and a QDialog. Both of these are intended to create a separate window on the desktop when show() (or exec()) is called... I assume this is what you see. Instead, when you click a button in the main window you want the content that is displayed in the current dialog to be shown as part of the content area of the main window. It's not clear whether that will be:
1. Replacing existing content in the "third frame". You generally use a QStackedWidget to show alternate widgets in the same layout space.
2. The "third frame" is normally hidden and only shown, with the dialog's contents, on demand.
Case 1 is demonstrated in the attached example based on yours. I mocked up the main window content. Flip between options in the stack using the two push buttons.
I changed your FirstDialog class to QWidget because it really is not a dialog. It is embedded in the main window designer ui by promoting page 2 of the stacked widget.
You will notice that the QFrame* member variables you put in the two headers are neither present nor needed.
Case 2 is handled differently and has more complicated implications for layout handling. Take a look at the Qt Extension Example for guidance.
Bookmarks