QMainWindow or QDialog when teaching PySide

I’m running through a lot of tutorials on PySide (Maya) to make sure I’m going to be teaching the ‘most’ correct approach.

I’ve noticed that most people start their examples by using QDialog and not QMainWindow. I’m thinking this is because you can add Buttons etc… without having to setup a central widget before hand as when using QMainWindow. But of course then you can’t start adding tool, menu, and status bars. Is QDialog being used for simplicity sake? or am I’m missing something… It is my understanding that QDialog should be used for temporary purposes only.

Currently I’m preparing my lesson around building a Qt window from a QMainWindow base…

Can you guys weigh in on this for me please?

thanks

Jamie

qdialog will (usually) be modal and simply show and return a value via exec_(). i supposed it is being used for simplicity at the cost of confusion as dialogs have a specific use. qmainwindow is probably the better thing to use in most non-modal tools and the extra step of centralwidget is trivial i think.

I think QDialog gives you the versatility to flag and run it on its own or embed into other windows later on if you so choose. In the past I developed most my tools with QMainWindow and it’s not very extensible.

But hey I may be wrong I consider myself very noobish at Qt as well.

Thanks for the input! much appreciated… Yeah QMainWindow gives you a great deal of flexibility in that you can build a comprehensive Qt interface.

I think thou I’ll create the window as a floating QDockWidget… seems quite a cool way to show students Qt and they can dock it over with the Attribute Editor and Tool box, which is kinda what i wanted to get them interested in creating their own custom tool/scripts tab…

What do you reckon about using a QDockWidget?

cheers

J

For maya specifically, there is a helper class in maya.app as of 2015(?) that helps with this. Otherwise there’s an example class on here that ive used in the past that works well, just search dockControl