Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Displaying multiple dialog on the same window(Qt5.14)
I designed a standard dialog box that generates QDialog by clicking pushButton. Now I want each pop-up dialog box to be displayed in the main window one at a time (not as a separate window). What should I do? thank you very much!
The picture is what it looks like now:
Hi and welcome to devnet,
Do you mean you do not want your QDialog to act as a usual dialog ?
@SGaist Sorry for the late reply. I hope that the dialog box function after clicking can be embedded in the label on the right instead of popping up a dialog box. I hope you understand what I mean. Thank you very much!
I hope that the dialog box function after clicking can be embedded in the label on the right instead of popping up a dialog box.
I fail to understand this.
Do you want to show a dialog or not?
Or do you want an editable label?
@jsulm Sorry I didn't make it clear, I want to show the "function" of the dialog in the right label, not a pop-up dialog.THX!!
JonB last edited by
So set the text of the label instead of showing the dialog?
I want to show the "function"
What do you mean by "function"? Do you want to enter a value directly in the label?
@jsulm Thank you for your reply! I want to display the respective function of each dialog box in the right label after clicking the corresponding button. For example, the color dialog box can set the color, the font dialog box can set the font, and the input dialog box can enter text... But they are not displayed in the new dialog box but displayed on the label on the right!
JonB last edited by JonB
This is a slightly strange interface, but one of:
- Have the dialog raise a signal when its button is pressed. Have the window connect a 8slot* to that, and update the desired corresponding label.
- Allow the dialog to exit when the button pressed. Have the caller --- the place which invoked the dialog --- read the button/value the user selected, and have it 9the caller) update the label on the widget.
Does this address your requirement?
@RAKULO You can use https://doc.qt.io/qt-5/qstackedwidget.html in that "right label" to select a widget corresponding to the clicked button. In each widget you implement the interface you need like selecting color or font. I don't know a way to integrate a dialog into a widget, so you will have to implement these UI interfaces by yourself.
Since Qt is open source you can also check the code for the dialog you need to see how you can implement these interfaces.