Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1215

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QToolButton Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</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="index.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">QToolButton Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QToolButton class provides a quick-access button to commands
or options, usually used inside a <a href="qtoolbar.html">QToolBar</a>. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractbutton.html">QAbstractButton</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtoolbutton.html#ToolButtonPopupMode-enum">ToolButtonPopupMode</a></b> { DelayedPopup, MenuButtonPopup, InstantPopup }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtoolbutton.html#QToolButton">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qtoolbutton.html#actionEvent">actionEvent</a></b> (<i>self</i>, QActionEvent)</li><li><div class="fn" />Qt.ArrowType <b><a href="qtoolbutton.html#arrowType">arrowType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtoolbutton.html#autoRaise">autoRaise</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QAction <b><a href="qtoolbutton.html#defaultAction">defaultAction</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#enterEvent">enterEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qtoolbutton.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />bool <b><a href="qtoolbutton.html#hitButton">hitButton</a></b> (<i>self</i>, QPoint&#160;<i>pos</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionToolButton&#160;<i>option</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#leaveEvent">leaveEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QMenu <b><a href="qtoolbutton.html#menu">menu</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qtoolbutton.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qtoolbutton.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qtoolbutton.html#nextCheckState">nextCheckState</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" />ToolButtonPopupMode <b><a href="qtoolbutton.html#popupMode">popupMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setArrowType">setArrowType</a></b> (<i>self</i>, Qt.ArrowType&#160;<i>type</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setAutoRaise">setAutoRaise</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setDefaultAction">setDefaultAction</a></b> (<i>self</i>, QAction)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setMenu">setMenu</a></b> (<i>self</i>, QMenu&#160;<i>menu</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setPopupMode">setPopupMode</a></b> (<i>self</i>, ToolButtonPopupMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#setToolButtonStyle">setToolButtonStyle</a></b> (<i>self</i>, Qt.ToolButtonStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#showMenu">showMenu</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qtoolbutton.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtoolbutton.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent)</li><li><div class="fn" />Qt.ToolButtonStyle <b><a href="qtoolbutton.html#toolButtonStyle">toolButtonStyle</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qtoolbutton.html#triggered">triggered</a></b> (QAction *)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QToolButton class provides a quick-access button to commands
or options, usually used inside a <a href="qtoolbar.html">QToolBar</a>.</p>
<p>A tool button is a special button that provides quick-access to
specific commands or options. As opposed to a normal command
button, a tool button usually doesn't show a text label, but shows
an icon instead.</p>
<p>Tool buttons are normally created when new <a href="qaction.html">QAction</a> instances are created with <a href="qtoolbar.html#addAction">QToolBar.addAction</a>() or existing
actions are added to a toolbar with <a href="qtoolbar.html#addAction">QToolBar.addAction</a>(). It is also
possible to construct tool buttons in the same way as any other
widget, and arrange them alongside other widgets in layouts.</p>
<p>One classic use of a tool button is to select tools; for
example, the "pen" tool in a drawing program. This would be
implemented by using a QToolButton as a toggle button (see <a class="compat" href="qabstractbutton-qt3.html#setToggleButton">setToggleButton</a>()).</p>
<p>QToolButton supports auto-raising. In auto-raise mode, the
button draws a 3D frame only when the mouse points at it. The
feature is automatically turned on when a button is used inside a
<a href="qtoolbar.html">QToolBar</a>. Change it with <a href="qtoolbutton.html#autoRaise-prop">setAutoRaise</a>().</p>
<p>A tool button's icon is set as <a href="qicon.html">QIcon</a>.
This makes it possible to specify different pixmaps for the
disabled and active state. The disabled pixmap is used when the
button's functionality is not available. The active pixmap is
displayed when the button is auto-raised because the mouse pointer
is hovering over it.</p>
<p>The button's look and dimension is adjustable with <a href="qtoolbutton.html#toolButtonStyle-prop">setToolButtonStyle</a>()
and <a href="qabstractbutton.html#iconSize-prop">setIconSize</a>().
When used inside a <a href="qtoolbar.html">QToolBar</a> in a
<a href="qmainwindow.html">QMainWindow</a>, the button
automatically adjusts to <a href="qmainwindow.html">QMainWindow</a>'s settings (see <a href="qmainwindow.html#toolButtonStyle-prop">QMainWindow.setToolButtonStyle</a>()
and <a href="qmainwindow.html#iconSize-prop">QMainWindow.setIconSize</a>()).
Instead of an icon, a tool button can also display an arrow symbol,
specified with <a href="qtoolbutton.html#arrowType-prop">arrowType</a>.</p>
<p>A tool button can offer additional choices in a popup menu. The
popup menu can be set using <a href="qtoolbutton.html#setMenu">setMenu</a>(). Use <a href="qtoolbutton.html#popupMode-prop">setPopupMode</a>() to configure
the different modes available for tool buttons with a menu set. The
default mode is DelayedPopupMode which is sometimes used with the
"Back" button in a web browser. After pressing and holding the
button down for a while, a menu pops up showing a list of possible
pages to jump to. The default delay is 600 ms; you can adjust it
with <a class="compat" href="qtoolbutton-qt3.html#setPopupDelay">setPopupDelay</a>().</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Qt Assistant's toolbar with tool buttons" src="images/assistant-toolbar.png" /></td>
</tr>
<tr class="even" valign="top">
<td>Qt Assistant's toolbar contains tool buttons that are
associated with actions used in other parts of the main
window.</td>
</tr>
</table>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ToolButtonPopupMode-enum" />QToolButton.ToolButtonPopupMode</h3><p>Describes how a menu should be popped up for tool buttons that
has a menu set or contains a list of actions.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QToolButton.DelayedPopup</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">After pressing and holding the tool button
down for a certain amount of time (the timeout is style dependant,
see <a href="qstyle.html#StyleHint-enum">QStyle.SH_ToolButton_PopupDelay</a>),
the menu is displayed. A typical application example is the "back"
button in some web browsers's tool bars. If the user clicks it, the
browser simply browses back to the previous page. If the user
presses and holds the button down for a while, the tool button
shows a menu containing the current history list</td>
</tr>
<tr>
<td class="topAlign"><tt>QToolButton.MenuButtonPopup</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">In this mode the tool button displays a
special arrow to indicate that a menu is present. The menu is
displayed when the arrow part of the button is pressed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QToolButton.InstantPopup</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The menu is displayed, without delay, when the
tool button is pressed. In this mode, the button's own action is
not triggered.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QToolButton" />QToolButton.__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 an empty tool button with parent <i>parent</i>.</p>


<h3 class="fn"><a name="actionEvent" />QToolButton.actionEvent (<i>self</i>, <a href="qactionevent.html">QActionEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#actionEvent">QWidget.actionEvent</a>().</p>


<h3 class="fn"><a name="arrowType" /><a href="qt.html#ArrowType-enum">Qt.ArrowType</a> QToolButton.arrowType (<i>self</i>)</h3><h3 class="fn"><a name="autoRaise" />bool QToolButton.autoRaise (<i>self</i>)</h3><h3 class="fn"><a name="changeEvent" />QToolButton.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<h3 class="fn"><a name="defaultAction" /><a href="qaction.html">QAction</a> QToolButton.defaultAction (<i>self</i>)</h3><p>Returns the default action.</p>
<p><b>See also</b> <a href="qtoolbutton.html#setDefaultAction">setDefaultAction</a>().</p>


<h3 class="fn"><a name="enterEvent" />QToolButton.enterEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#enterEvent">QWidget.enterEvent</a>().</p>


<h3 class="fn"><a name="event" />bool QToolButton.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="hitButton" />bool QToolButton.hitButton (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>)</h3><p>Reimplemented from <a href="qabstractbutton.html#hitButton">QAbstractButton.hitButton</a>().</p>


<h3 class="fn"><a name="initStyleOption" />QToolButton.initStyleOption (<i>self</i>, <a href="qstyleoptiontoolbutton.html">QStyleOptionToolButton</a>&#160;<i>option</i>)</h3><p>Initialize <i>option</i> with the values from this <a href="qtoolbutton.html">QToolButton</a>. This method is useful for
subclasses when they need a <a href="qstyleoptiontoolbutton.html">QStyleOptionToolButton</a>, but don't
want to fill in all the information themselves.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>().</p>


<h3 class="fn"><a name="leaveEvent" />QToolButton.leaveEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#leaveEvent">QWidget.leaveEvent</a>().</p>


<h3 class="fn"><a name="menu" /><a href="qmenu.html">QMenu</a> QToolButton.menu (<i>self</i>)</h3><p>Returns the associated menu, or 0 if no menu has been
defined.</p>
<p><b>See also</b> <a href="qtoolbutton.html#setMenu">setMenu</a>().</p>


<h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QToolButton.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QToolButton.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QToolButton.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="nextCheckState" />QToolButton.nextCheckState (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractbutton.html#nextCheckState">QAbstractButton.nextCheckState</a>().</p>


<h3 class="fn"><a name="paintEvent" />QToolButton.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>Paints the button in response to the paint <i>event</i>.</p>


<h3 class="fn"><a name="popupMode" /><a href="qtoolbutton.html#ToolButtonPopupMode-enum">ToolButtonPopupMode</a> QToolButton.popupMode (<i>self</i>)</h3><h3 class="fn"><a name="setArrowType" />QToolButton.setArrowType (<i>self</i>, <a href="qt.html#ArrowType-enum">Qt.ArrowType</a>&#160;<i>type</i>)</h3><h3 class="fn"><a name="setAutoRaise" />QToolButton.setAutoRaise (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setDefaultAction" />QToolButton.setDefaultAction (<i>self</i>, <a href="qaction.html">QAction</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setDefaultAction(QAction *)</tt>.</p><p>Sets the default action to <i>action</i>.</p>
<p>If a tool button has a default action, the action defines the
button's properties like text, icon, tool tip, etc.</p>
<p><b>See also</b> <a href="qtoolbutton.html#defaultAction">defaultAction</a>().</p>


<h3 class="fn"><a name="setMenu" />QToolButton.setMenu (<i>self</i>, <a href="qmenu.html">QMenu</a>&#160;<i>menu</i>)</h3><p>Associates the given <i>menu</i> with this tool button.</p>
<p>The menu will be shown according to the button's <a href="qtoolbutton.html#popupMode-prop">popupMode</a>.</p>
<p>Ownership of the menu is not transferred to the tool button.</p>
<p><b>See also</b> <a href="qtoolbutton.html#menu">menu</a>().</p>


<h3 class="fn"><a name="setPopupMode" />QToolButton.setPopupMode (<i>self</i>, <a href="qtoolbutton.html#ToolButtonPopupMode-enum">ToolButtonPopupMode</a>&#160;<i>mode</i>)</h3><h3 class="fn"><a name="setToolButtonStyle" />QToolButton.setToolButtonStyle (<i>self</i>, <a href="qt.html#ToolButtonStyle-enum">Qt.ToolButtonStyle</a>&#160;<i>style</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setToolButtonStyle(Qt::ToolButtonStyle)</tt>.</p><h3 class="fn"><a name="showMenu" />QToolButton.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>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QToolButton.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>


<h3 class="fn"><a name="timerEvent" />QToolButton.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#timerEvent">QObject.timerEvent</a>().</p>


<h3 class="fn"><a name="toolButtonStyle" /><a href="qt.html#ToolButtonStyle-enum">Qt.ToolButtonStyle</a> QToolButton.toolButtonStyle (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="triggered" />void triggered (QAction *)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the given <i>action</i> is
triggered.</p>
<p>The action may also be associated with other parts of the user
interface, such as menu items and keyboard shortcuts. Sharing
actions in this way helps make the user interface more consistent
and is often less work to implement.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 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> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>