Chapter 8
Advanced Graphical User Interfaces with Qt
Author
Kristine Middlemiss
Project
Install Qt and build basic window with Qt Designer
Example Files
polywin.py
coneptrwin.py
cone.ui
Synopsis
This chapter expands upon the previous one by introducing concepts of GUI creation using Qt. The chapter first explains how Qt is integrated into Maya. Next, readers will download and install Qt tools. Readers then walk through an example in Qt Designer to create a basic window that can communicate with Maya commands. In the process, readers will be exposed to Qt’s signal/slot mechanism for using non-native Qt controls in Maya. Finally, the chapter concludes with a brief discussion of PyQt.
Resources
Qt download links and build instructions
The dockControl Command
Using Qt Designer for MEL Interfaces
Qt Reference Documentation
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
Ten Usability Heuristics
Other Notes
None
Errata for the First Edition
On p. 236, for the first step in the Docking Windows section, there is a code sample for docking the Graph Editor. In the final line containing the scriptedPanel
call, the parent needs to be the variable layout
, rather than the string literal 'layout'
.
On p.238, it says to look in the API guide to find out the compatible Qt version, but the indicated page does not exist in the guide any more. Qt information has been moved elsewhere in the guide, but no definitive statement is made there as to the Qt version. Instead, it seems that you need to consult the version number of the compressed Qt headers file, in the Maya include directory – on OS X, this is /Applications/Autodesk/maya2014/devkit/include , for “qt-4.8.2-include.tar.gz”.
Jonathan said this on January 25, 2014 at 7:02 pm |
I really like the book and am learning quite a lot about programming using python. Would it be possible for me to query the types of meshes in a scene and then view them in a QListView widget created using the qt designer? I would greatly appreciate any help I can get on the subject. Great book, btw. very helpful
Wesley said this on April 15, 2014 at 2:27 pm |
How can I install Qt for Maya 2016? there doesn’t seem to be any documentation on this, and I am stuck at this point in the book.
Michael said this on May 8, 2017 at 6:53 am |
Hi there! Fortunately for Maya 2016 this should no longer be necessary, as it ships with the PySide module. You might find this page in the documentation helpful: http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_3F96AF53_A47E_4351_A86A_396E7BFD6665_htm
Adam said this on May 8, 2017 at 12:34 pm |
Struggling to get the coneptrwin.py to work in Maya 2015.
Using the linked file above, I get this when I click the button:
‘ar_conePtrWindow|centralwidget|inputRotation’ not found.
Line 19 states: self.window = ‘ar_conePtrWindow’
Definitely not a typo! That name does not point to anything…
Andy said this on May 8, 2017 at 8:55 am |
Hi! Which linked file are you using exactly? When I used the linked coneptrwin.py and cone.ui it works for me in Maya 2017. Can you verify that the ui file you are using has the correct widget names so that path to that control is valid?
Adam said this on May 8, 2017 at 1:10 pm |