@SysInclude{tbl} @SysInclude{diag} @SysInclude{graph} @SysInclude{xrgb} @SysInclude{eq} @Include{book.lout} @Book @Title{Rapid GUI Programming with Python and Qt} // @Chapter @Title{Custom Widgets } @Tag{custom.widgets} @Begin @LP In this case the widget is rectangular, but our window has the same width and height. address@hidden, widgets} address@hidden This means that the items we paint will be stretched out horizontally since coordinates in the @I{y} axis will be scaled by @C{QPainter} in the ratio 120:600, whereas those in the @I{x} axis will be scaled in the ratio 120:800). @Table @Caption{Selected QWidget Methods} @Tag{selected.qwidget.methods} @Location{FullPage} address@hidden @Tbl break{ragged} bpaint{lightgrey} address@hidden A| @Cell B|} address@hidden width{2.9c}font{Courier Base 9p}A| @Cell B|} amarginvertical{0.27f} # Typesetting { @Rowb A{Syntax}B{Description address@hidden@C{QWidget} (@C{QtGui})} address@hidden@C{addAction()} (@C{QWidget})} address@hidden@C{addAction()}} address@hidden@C{hasFocus()} (@C{QWidget})} address@hidden@C{hasFocus()}} address@hidden@C{height()} (@C{QWidget})} address@hidden@C{height()}} } @Rowa A{w.width()}B{Returns @C{QWidget} @C{w}'s width} } @LP For most widgets, a rectangular region works perfectly well, but in some cases, for example, if we really want our logical window to be square, we can change the viewport so that we only operate on a proportion of the widget's area. @End @Chapter