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 theQDialog
class, is it OK, or is there any better method? -
@doodle
hi,
MDI windows cannot be moved outside mainwindow.
There is also QDock windows.
http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.htmlthose 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. -
@doodle
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.
Also, the
mydialog->setAttribute(Qt::WA_DeleteOnClose);
is quite handy for such modeless dialogs as it will then
delete the instance if user close it. (auto clean)