📄 c2591.htm
字号:
<HTML><HEAD><TITLE>Qt Class Hierarchy</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.72"><LINKREL="HOME"TITLE="GUI Programming with Python: QT Edition"HREF="book1.htm"><LINKREL="UP"TITLE="PyQt fundamentals"HREF="p1032.htm"><LINKREL="PREVIOUS"TITLE="Object and class introspection"HREF="x2568.htm"><LINKREL="NEXT"TITLE="Base classes"HREF="x2629.htm"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GUI Programming with Python: QT Edition</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x2568.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x2629.htm"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CH2">Chapter 10. Qt Class Hierarchy</A></H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="c2591.htm#AEN2597">Hierarchy</A></DT><DT><AHREF="x2629.htm">Base classes</A></DT><DT><AHREF="x2693.htm">Application classes</A></DT><DT><AHREF="x2765.htm">Widget foundations: QWidget</A></DT><DT><AHREF="x2976.htm">Basic widgets</A></DT><DT><AHREF="x3270.htm">Advanced widgets</A></DT><DT><AHREF="x3410.htm">Layout managers</A></DT><DT><AHREF="x3581.htm">Dialogs and Standard Dialogs</A></DT><DT><AHREF="x3738.htm">Qt Utility classes and their Python equivalents</A></DT></DL></DIV><P>In this chapter I will present an overview of the Qt library, including both gui objects and non-gui objects. While well-designed, Qt is a large library, and the key to effective use is not knowing every class by heart, but rather developing an intuition for what is available and where it is. After an overview of the entire hierarchy I will shortly discuss the base classes, the gui classes and compare the Qt utility classes with their Python equivalents.</P><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN2597">Hierarchy</A></H1><P>As noted before, Qt consists of a hierarchy of classes derived from a basic QObject class, and a side-show cluster of more independent classes. Classes derived from QObject share some important functionality, namely the power to communicate through signals and slots and to arrange themselves in an ownership hierarchy. There are other odds and ends, such as introspection functionality, which is discussed in <AHREF="x2568.htm">the Section called <I>Object and class introspection</I> in Chapter 9</A>.</P><DIVCLASS="FIGURE"><ANAME="AEN2605"></A><P><B>Figure 10-1. Qt Inheritance Hierarchy (only the most important classes)</B></P><P><IMGSRC="ch2/qt-condensed.eps"ALIGN="CENTER"></P></DIV><P>Prior to version 3.0, PyQt basically plunked everything except for the OpenGL extension in the <TTCLASS="FILENAME">qt</TT> module. That was the situation when I wrote this book. From PyQt 3.0, the Qt modules <TTCLASS="FILENAME">Canvas</TT>, <TTCLASS="FILENAME">IconView</TT>, <TTCLASS="FILENAME">Network</TT>, <TTCLASS="FILENAME">OpenGL</TT>, <TTCLASS="FILENAME">SQL</TT>, <TTCLASS="FILENAME">Table</TT>, <TTCLASS="FILENAME">WorkSpace</TT> and <TTCLASS="FILENAME">XML</TT> have been put in separate Python modules.</P><P>In addition to the inheritance hierarchy, there is an ownership hierarchy, where a window will own, for instance, toolbars, a menubar and a statusbar. If the window is deleted, all child objects will be deleted, too, and if a keypress event arrives for an application, it will traverse the tree until it arrives at the right spot. The ownership hierarchy comes into existence by creating objects with their owner object as parent - see <AHREF="x2420.htm">the Section called <I>References and ownership</I> in Chapter 9</A> about this principle.</P><DIVCLASS="FIGURE"><ANAME="AEN2626"></A><P><B>Figure 10-2. Object Ownership Hierarchy</B></P><P><IMGSRC="ch2/ownership-condensed.eps"ALIGN="CENTER"></P></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x2568.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.htm"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x2629.htm"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Object and class introspection</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="p1032.htm"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Base classes</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -