~ubuntu-branches/ubuntu/precise/python-qt4/precise-proposed

« back to all changes in this revision

Viewing changes to doc/html/qpushbutton.html

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell, Jonathan Riddell
  • Date: 2010-11-08 16:13:33 UTC
  • mfrom: (1.5.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101108161333-0nec4wu0nz3wpf9r
Tags: 4.8.1-0ubuntu1
[ Jonathan Riddell ]
* New upstream release
* Build against python-sip-dev 4.11.2
* Remove kubuntu_02_fix-scpk-and-flag-issue.diff merged upstream
* Install __init__.py into /usr/lib/python3.2/dist-packages/PyQt4,
  fixes Python 3 support
* Add QtDeclarative to python-qt4
* Add kubuntu_03_uiparser.diff from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
tr.address { font-family: sans-serif }
8
8
body { background: #ffffff; color: black; }
9
9
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPushButton Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPushButton widget provides a command button. <a href="#details">More...</a></p>
 
10
 
10
11
<p>Inherits <a href="qabstractbutton.html">QAbstractButton</a>.</p><p>Inherited by <a href="qcommandlinkbutton.html">QCommandLinkButton</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpushbutton.html#QPushButton">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qpushbutton.html#QPushButton-2">__init__</a></b> (<i>self</i>, QString, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qpushbutton.html#QPushButton-3">__init__</a></b> (<i>self</i>, QIcon, QString, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qpushbutton.html#autoDefault">autoDefault</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpushbutton.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qpushbutton.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" /><b><a href="qpushbutton.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" /><b><a href="qpushbutton.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionButton)</li><li><div class="fn" />bool <b><a href="qpushbutton.html#isDefault">isDefault</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpushbutton.html#isFlat">isFlat</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpushbutton.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" />QMenu <b><a href="qpushbutton.html#menu">menu</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qpushbutton.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpushbutton.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qpushbutton.html#setAutoDefault">setAutoDefault</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qpushbutton.html#setDefault">setDefault</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qpushbutton.html#setFlat">setFlat</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qpushbutton.html#setMenu">setMenu</a></b> (<i>self</i>, QMenu)</li><li><div class="fn" /><b><a href="qpushbutton.html#showMenu">showMenu</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qpushbutton.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPushButton widget provides a command button.</p>
11
 
<p>The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button to command the computer to perform some action, or to answer a question. Typical buttons are OK, Apply, Cancel, Close, Yes, No and Help.</p>
12
 
<p>A command button is rectangular and typically displays a text label describing its action. A shortcut key can be specified by preceding the preferred character with an ampersand in the text. For example:</p>
13
 
<pre> QPushButton *button = new QPushButton("&amp;Download", this);</pre>
14
 
<p>In this example the shortcut is <i>Alt+D</i>. See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details (to display an actual ampersand, use '&amp;&amp;').</p>
15
 
<p>Push buttons display a textual label, and optionally a small icon. These can be set using the constructors and changed later using <a href="qabstractbutton.html#text-prop">setText</a>() and <a href="qabstractbutton.html#icon-prop">setIcon</a>(). If the button is disabled the appearance of the text and icon will be manipulated with respect to the GUI style to make the button look "disabled".</p>
16
 
<p>A push button emits the signal <a href="qabstractbutton.html#clicked">clicked</a>() when it is activated by the mouse, the Spacebar or by a keyboard shortcut. Connect to this signal to perform the button's action. Push buttons also provide less commonly used signals, for example, <a href="qabstractbutton.html#pressed">pressed</a>() and <a href="qabstractbutton.html#released">released</a>().</p>
17
 
<p>Command buttons in dialogs are by default auto-default buttons, i.e. they become the default push button automatically when they receive the keyboard input focus. A default button is a push button that is activated when the user presses the Enter or Return key in a dialog. You can change this with <a href="qpushbutton.html#autoDefault-prop">setAutoDefault</a>(). Note that auto-default buttons reserve a little extra space which is necessary to draw a default-button indicator. If you do not want this space around your buttons, call setAutoDefault(false).</p>
18
 
<p>Being so central, the button widget has grown to accommodate a great many variations in the past decade. The Microsoft style guide now shows about ten different states of Windows push buttons and the text implies that there are dozens more when all the combinations of features are taken into consideration.</p>
 
12
<p>The push button, or command button, is perhaps the most commonly
 
13
used widget in any graphical user interface. Push (click) a button
 
14
to command the computer to perform some action, or to answer a
 
15
question. Typical buttons are OK, Apply, Cancel, Close, Yes, No and
 
16
Help.</p>
 
17
<p>A command button is rectangular and typically displays a text
 
18
label describing its action. A shortcut key can be specified by
 
19
preceding the preferred character with an ampersand in the text.
 
20
For example:</p>
 
21
<pre class="highlightedCode brush: cpp">
 
22
 QPushButton *button = new QPushButton("&amp;Download", this);
 
23
</pre>
 
24
<p>In this example the shortcut is <i>Alt+D</i>. See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details
 
25
(to display an actual ampersand, use '&amp;&amp;').</p>
 
26
<p>Push buttons display a textual label, and optionally a small
 
27
icon. These can be set using the constructors and changed later
 
28
using <a href="qabstractbutton.html#text-prop">setText</a>() and
 
29
<a href="qabstractbutton.html#icon-prop">setIcon</a>(). If the
 
30
button is disabled the appearance of the text and icon will be
 
31
manipulated with respect to the GUI style to make the button look
 
32
"disabled".</p>
 
33
<p>A push button emits the signal <a href="qabstractbutton.html#clicked">clicked</a>() when it is activated
 
34
by the mouse, the Spacebar or by a keyboard shortcut. Connect to
 
35
this signal to perform the button's action. Push buttons also
 
36
provide less commonly used signals, for example, <a href="qabstractbutton.html#pressed">pressed</a>() and <a href="qabstractbutton.html#released">released</a>().</p>
 
37
<p>Command buttons in dialogs are by default auto-default buttons,
 
38
i.e. they become the default push button automatically when they
 
39
receive the keyboard input focus. A default button is a push button
 
40
that is activated when the user presses the Enter or Return key in
 
41
a dialog. You can change this with <a href="qpushbutton.html#autoDefault-prop">setAutoDefault</a>(). Note that
 
42
auto-default buttons reserve a little extra space which is
 
43
necessary to draw a default-button indicator. If you do not want
 
44
this space around your buttons, call setAutoDefault(false).</p>
 
45
<p>Being so central, the button widget has grown to accommodate a
 
46
great many variations in the past decade. The Microsoft style guide
 
47
now shows about ten different states of Windows push buttons and
 
48
the text implies that there are dozens more when all the
 
49
combinations of features are taken into consideration.</p>
19
50
<p>The most important modes or states are:</p>
20
51
<ul>
21
52
<li>Available or not (grayed out, disabled).</li>
22
53
<li>Standard push button, toggling push button or menu button.</li>
23
54
<li>On or off (only for toggling push buttons).</li>
24
 
<li>Default or normal. The default button in a dialog can generally be "clicked" using the Enter or Return key.</li>
 
55
<li>Default or normal. The default button in a dialog can generally
 
56
be "clicked" using the Enter or Return key.</li>
25
57
<li>Auto-repeat or not.</li>
26
58
<li>Pressed down or not.</li>
27
59
</ul>
28
 
<p>As a general rule, use a push button when the application or dialog window performs an action when the user clicks on it (such as Apply, Cancel, Close and Help) <i>and</i> when the widget is supposed to have a wide, rectangular shape with a text label. Small, typically square buttons that change the state of the window rather than performing an action (such as the buttons in the top-right corner of the <a href="qfiledialog.html">QFileDialog</a>) are not command buttons, but tool buttons. Qt provides a special class (<a href="qtoolbutton.html">QToolButton</a>) for these buttons.</p>
29
 
<p>If you need toggle behavior (see <a href="qabstractbutton.html#checkable-prop">setCheckable</a>()) or a button that auto-repeats the activation signal when being pushed down like the arrows in a scroll bar (see <a href="qabstractbutton.html#autoRepeat-prop">setAutoRepeat</a>()), a command button is probably not what you want. When in doubt, use a tool button.</p>
30
 
<p>A variation of a command button is a menu button. These provide not just one command, but several, since when they are clicked they pop up a menu of options. Use the method <a href="qpushbutton.html#setMenu">setMenu</a>() to associate a popup menu with a push button.</p>
 
60
<p>As a general rule, use a push button when the application or
 
61
dialog window performs an action when the user clicks on it (such
 
62
as Apply, Cancel, Close and Help) <i>and</i> when the widget is
 
63
supposed to have a wide, rectangular shape with a text label.
 
64
Small, typically square buttons that change the state of the window
 
65
rather than performing an action (such as the buttons in the
 
66
top-right corner of the <a href="qfiledialog.html">QFileDialog</a>)
 
67
are not command buttons, but tool buttons. Qt provides a special
 
68
class (<a href="qtoolbutton.html">QToolButton</a>) for these
 
69
buttons.</p>
 
70
<p>If you need toggle behavior (see <a href="qabstractbutton.html#checkable-prop">setCheckable</a>()) or a
 
71
button that auto-repeats the activation signal when being pushed
 
72
down like the arrows in a scroll bar (see <a href="qabstractbutton.html#autoRepeat-prop">setAutoRepeat</a>()), a
 
73
command button is probably not what you want. When in doubt, use a
 
74
tool button.</p>
 
75
<p>A variation of a command button is a menu button. These provide
 
76
not just one command, but several, since when they are clicked they
 
77
pop up a menu of options. Use the method <a href="qpushbutton.html#setMenu">setMenu</a>() to associate a popup menu
 
78
with a push button.</p>
31
79
<p>Other classes of buttons are option buttons (see <a href="qradiobutton.html">QRadioButton</a>) and check boxes (see <a href="qcheckbox.html">QCheckBox</a>).</p>
32
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="100%">
33
 
<tr class="odd" valign="top"><td><img alt="Screenshot of a Macintosh style push button" src="images/macintosh-pushbutton.png" /></td><td>A push button shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.<p>Note that when a button's width becomes smaller than 50 or its height becomes smaller than 30, the button's corners are changed from round to square. Use the <a href="qwidget.html#minimumSize-prop">setMinimumSize</a>() function to prevent this behavior.</p>
34
 
</td></tr>
35
 
<tr class="even" valign="top"><td><img alt="Screenshot of a Windows XP style push button" src="images/windowsxp-pushbutton.png" /></td><td>A push button shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td></tr>
36
 
<tr class="odd" valign="top"><td><img alt="Screenshot of a Plastique style push button" src="images/plastique-pushbutton.png" /></td><td>A push button shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td></tr>
37
 
</table></p>
38
 
<p>In Qt, the <a href="qabstractbutton.html">QAbstractButton</a> base class provides most of the modes and other API, and QPushButton provides GUI logic. See <a href="qabstractbutton.html">QAbstractButton</a> for more information about the API.</p>
39
 
<p>See also <a href="qtoolbutton.html">QToolButton</a>, <a href="qradiobutton.html">QRadioButton</a>, <a href="qcheckbox.html">QCheckBox</a>, and <a href="guibooks.html#fowler">GUI Design Handbook: Push Button</a>.</p>
 
80
<table class="generic">
 
81
<tr class="odd topAlign">
 
82
<td>
 
83
<p><img alt="Screenshot of a Macintosh style push button" src="images/macintosh-pushbutton.png" /></p>
 
84
</td>
 
85
<td>
 
86
<p>A push button shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</p>
 
87
<p>Note that when a button's width becomes smaller than 50 or its
 
88
height becomes smaller than 30, the button's corners are changed
 
89
from round to square. Use the <a href="qwidget.html#minimumSize-prop">setMinimumSize</a>() function to
 
90
prevent this behavior.</p>
 
91
</td>
 
92
</tr>
 
93
<tr class="even topAlign">
 
94
<td>
 
95
<p><img alt="Screenshot of a Windows XP style push button" src="images/windowsxp-pushbutton.png" /></p>
 
96
</td>
 
97
<td>
 
98
<p>A push button shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</p>
 
99
</td>
 
100
</tr>
 
101
<tr class="odd topAlign">
 
102
<td>
 
103
<p><img alt="Screenshot of a Plastique style push button" src="images/plastique-pushbutton.png" /></p>
 
104
</td>
 
105
<td>
 
106
<p>A push button shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</p>
 
107
</td>
 
108
</tr>
 
109
</table>
 
110
<p>In Qt, the <a href="qabstractbutton.html">QAbstractButton</a>
 
111
base class provides most of the modes and other API, and
 
112
QPushButton provides GUI logic. See <a href="qabstractbutton.html">QAbstractButton</a> for more information
 
113
about the API.</p>
40
114
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPushButton" />QPushButton.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a push button with no text and a <i>parent</i>.</p>
41
 
<h3 class="fn"><a name="QPushButton-2" />QPushButton.__init__ (<i>self</i>, QString, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a push button with the parent <i>parent</i> and the text <i>text</i>.</p>
42
 
<h3 class="fn"><a name="QPushButton-3" />QPushButton.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a>, QString, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a push button with an <i>icon</i> and a <i>text</i>, and a <i>parent</i>.</p>
43
 
<p>Note that you can also pass a <a href="qpixmap.html">QPixmap</a> object as an icon (thanks to the implicit type conversion provided by C++).</p>
44
 
<a name="//apple_ref/cpp/instm/QPushButton/~QPushButton" />
 
115
 
 
116
 
 
117
<h3 class="fn"><a name="QPushButton-2" />QPushButton.__init__ (<i>self</i>, QString, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a push button with the parent <i>parent</i> and the
 
118
text <i>text</i>.</p>
 
119
 
 
120
 
 
121
<h3 class="fn"><a name="QPushButton-3" />QPushButton.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a>, QString, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a push button with an <i>icon</i> and a <i>text</i>,
 
122
and a <i>parent</i>.</p>
 
123
<p>Note that you can also pass a <a href="qpixmap.html">QPixmap</a>
 
124
object as an icon (thanks to the implicit type conversion provided
 
125
by C++).</p>
 
126
 
 
127
 
45
128
<h3 class="fn"><a name="autoDefault" />bool QPushButton.autoDefault (<i>self</i>)</h3><h3 class="fn"><a name="event" />bool QPushButton.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
46
 
<a name="//apple_ref/cpp/instm/QPushButton/focusInEvent" />
 
129
 
 
130
 
47
131
<h3 class="fn"><a name="focusInEvent" />QPushButton.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p>
48
 
<a name="//apple_ref/cpp/instm/QPushButton/focusOutEvent" />
 
132
 
 
133
 
49
134
<h3 class="fn"><a name="focusOutEvent" />QPushButton.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p>
50
 
<a name="//apple_ref/cpp/instm/QPushButton/initStyleOption" />
51
 
<h3 class="fn"><a name="initStyleOption" />QPushButton.initStyleOption (<i>self</i>, <a href="qstyleoptionbutton.html">QStyleOptionButton</a>)</h3><p>Initialize <i>option</i> with the values from this <a href="qpushbutton.html">QPushButton</a>. This method is useful for subclasses when they need a <a href="qstyleoptionbutton.html">QStyleOptionButton</a>, but don't want to fill in all the information themselves.</p>
 
135
 
 
136
 
 
137
<h3 class="fn"><a name="initStyleOption" />QPushButton.initStyleOption (<i>self</i>, <a href="qstyleoptionbutton.html">QStyleOptionButton</a>)</h3><p>Initialize <i>option</i> with the values from this <a href="qpushbutton.html">QPushButton</a>. This method is useful for
 
138
subclasses when they need a <a href="qstyleoptionbutton.html">QStyleOptionButton</a>, but don't want to
 
139
fill in all the information themselves.</p>
52
140
<p>See also <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>().</p>
53
 
<a name="//apple_ref/cpp/instm/QPushButton/keyPressEvent" />
 
141
 
 
142
 
54
143
<h3 class="fn"><a name="isDefault" />bool QPushButton.isDefault (<i>self</i>)</h3><h3 class="fn"><a name="isFlat" />bool QPushButton.isFlat (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QPushButton.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>
55
 
<a name="//apple_ref/cpp/instm/QPushButton/menu" />
56
 
<h3 class="fn"><a name="menu" /><a href="qmenu.html">QMenu</a> QPushButton.menu (<i>self</i>)</h3><p>Returns the button's associated popup menu or 0 if no popup menu has been set.</p>
 
144
 
 
145
 
 
146
<h3 class="fn"><a name="menu" /><a href="qmenu.html">QMenu</a> QPushButton.menu (<i>self</i>)</h3><p>Returns the button's associated popup menu or 0 if no popup menu
 
147
has been set.</p>
57
148
<p>See also <a href="qpushbutton.html#setMenu">setMenu</a>().</p>
58
 
<a name="//apple_ref/cpp/instm/QPushButton/minimumSizeHint" />
 
149
 
 
150
 
59
151
<h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QPushButton.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>
60
 
<a name="//apple_ref/cpp/instm/QPushButton/paintEvent" />
 
152
 
 
153
 
61
154
<h3 class="fn"><a name="paintEvent" />QPushButton.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
62
 
<a name="//apple_ref/cpp/instm/QPushButton/setMenu" />
63
 
<h3 class="fn"><a name="setAutoDefault" />QPushButton.setAutoDefault (<i>self</i>, bool)</h3><h3 class="fn"><a name="setDefault" />QPushButton.setDefault (<i>self</i>, bool)</h3><h3 class="fn"><a name="setFlat" />QPushButton.setFlat (<i>self</i>, bool)</h3><h3 class="fn"><a name="setMenu" />QPushButton.setMenu (<i>self</i>, <a href="qmenu.html">QMenu</a>)</h3><p>Associates the popup menu <i>menu</i> with this push button. This turns the button into a menu button, which in some styles will produce a small triangle to the right of the button's text.</p>
64
 
<p>Ownership of the menu is <i>not</i> transferred to the push button.</p>
65
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="100%">
66
 
<tr class="odd" valign="top"><td><img alt="Screenshot of a Plastique style push button with popup menu." src="images/plastique-pushbutton-menu.png" /></td><td><img alt="Screenshot of a Cleanlooks style push button with popup menu." src="images/cleanlooks-pushbutton-menu.png" /></td><td>Push buttons with popup menus shown in the <a href="gallery-plastique.html">Plastique widget style</a> (left) and <a href="gallery-cleanlooks.html">Cleanlooks widget style</a> (right).</td></tr>
67
 
</table></p>
 
155
 
 
156
 
 
157
<h3 class="fn"><a name="setAutoDefault" />QPushButton.setAutoDefault (<i>self</i>, bool)</h3><h3 class="fn"><a name="setDefault" />QPushButton.setDefault (<i>self</i>, bool)</h3><h3 class="fn"><a name="setFlat" />QPushButton.setFlat (<i>self</i>, bool)</h3><h3 class="fn"><a name="setMenu" />QPushButton.setMenu (<i>self</i>, <a href="qmenu.html">QMenu</a>)</h3><p>Associates the popup menu <i>menu</i> with this push button.
 
158
This turns the button into a menu button, which in some styles will
 
159
produce a small triangle to the right of the button's text.</p>
 
160
<p>Ownership of the menu is <i>not</i> transferred to the push
 
161
button.</p>
 
162
<table class="generic">
 
163
<tr class="odd topAlign">
 
164
<td>
 
165
<p><img alt="Screenshot of a Plastique style push button with popup menu." src="images/plastique-pushbutton-menu.png" /></p>
 
166
</td>
 
167
<td>
 
168
<p><img alt="Screenshot of a Cleanlooks style push button with popup menu." src="images/cleanlooks-pushbutton-menu.png" /></p>
 
169
</td>
 
170
<td>
 
171
<p>Push buttons with popup menus shown in the <a href="gallery-plastique.html">Plastique widget style</a> (left) and
 
172
<a href="gallery-cleanlooks.html">Cleanlooks widget style</a>
 
173
(right).</p>
 
174
</td>
 
175
</tr>
 
176
</table>
68
177
<p>See also <a href="qpushbutton.html#menu">menu</a>().</p>
69
 
<a name="//apple_ref/cpp/instm/QPushButton/showMenu" />
70
 
<h3 class="fn"><a name="showMenu" />QPushButton.showMenu (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showMenu()</tt>.</p><p>Shows (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.</p>
71
 
<a name="//apple_ref/cpp/instm/QPushButton/sizeHint" />
 
178
 
 
179
 
 
180
<h3 class="fn"><a name="showMenu" />QPushButton.showMenu (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showMenu()</tt>.</p><p>Shows (pops up) the associated popup menu. If there is no such
 
181
menu, this function does nothing. This function does not return
 
182
until the popup menu has been closed by the user.</p>
 
183
 
 
184
 
72
185
<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QPushButton.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
73
 
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.7 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.3</td></tr></table></div></address></body></html>
 
 
b'\\ No newline at end of file'
 
186
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.8.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.7.0</td></tr></table></div></address></body></html>
 
 
b'\\ No newline at end of file'