Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Which class to chose as a subwindow is appropriate?
I am writing a serial port program to show some data in the mainwindow, and at the same time I want to use the serial port data to plot wave form. I put a button in the mainwindow and use it to open a subwindow to show the wave form, and the mainwindow is also accessible.
I found the
QDialogclass, is it OK, or is there any better method?
VRonin last edited by
if you are using QMainWidow,you can use a QMdiArea as central widget and open as many sub windows in in as necessary
doodle last edited by doodle
@VRonin I hope the subwindow can be moved outside the mainwindow.
Is there any result?
MDI windows cannot be moved outside mainwindow.
There is also QDock windows.
those can tear off and be outside mainwindow.
However, for just displaying a floating window, dialog should be fine.
Unless you need more that one plot open at a time then
mdi or dock might be easier to work with.
@mrjj OK, I'll choose Qdialog and dock for a try.
Yes, testing both would a good way to find out what will work for you.
Notes for using the dialog. ( just to be sure. u might already know)
Since you want mainwindow to be accessible while
dialog is open, you should use
show() and not exec() when you show it.
is quite handy for such modeless dialogs as it will then
delete the instance if user close it. (auto clean)