简体   繁体   中英

Open QDialog from Main Window in Qt Designer

All I would like to do is to be able to open a new dialog from my MainWindow. I want to be able to design the dialog in Qt designer and then use the signals and slots editor to link a button press in my main window to the display of a new dialog. The dialog needs to have a couple of line edits and buttons in it and I want to avoid writing a new class in C++ every time i want a different dialog.

How can I link my main window to another dialog i created in qt designer?

You won't be able to connect the signal to startup the dialog within the designer, this will have to be in the code. But you won't need a new custom class everytime, you could easily use one class implementing different widgets.

You will have to write some c++/design some dialog everytime, since you do want to have another dialog (or at least another setup in the same dialog). You could setup the dialog to have a QStackedWidget and have an index in the constructor for having one dialog with multiple pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM