<class name="QWidgetAction" doc="/** <p>The <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a> class extends <a href="QAction.html#QAction(com.trolltech.qt.gui.QIcon, java.lang.String, com.trolltech.qt.core.QObject)"><tt>QAction</tt></a> by an interface for inserting custom widgets into action based containers, such as toolbars.</p> <p>Most actions in application are represented as items in menus or buttons in toolbars. However sometimes more complex widgets are necessary. For example a zoom action in a word processor may be realized using a <a href="QComboBox.html"><tt>QComboBox</tt></a> in a <a href="QToolBar.html"><tt>QToolBar</tt></a>, presenting a range of different zoom levels. <a href="QToolBar.html"><tt>QToolBar</tt></a> provides QToolBar::insertWidget() as convenience function for inserting a single widget. However if you want to implement an action that uses custom widgets for visualization in multiple containers then you have to subclass <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a>.</p> <p>If a <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a> is added for example to a <a href="QToolBar.html"><tt>QToolBar</tt></a> then QWidgetAction::createWidget() is called. Reimplementations of that function should create a new custom widget with the specified parent.</p> <p>If the action is removed from a container widget then QWidgetAction::deleteWidget() is called with the previously created custom widget as argument. The default implementation hides the widget and deletes it using QObject::deleteLater().</p> <p>If you have only one single custom widget then you can set it as default widget using <a href="QWidgetAction.html#setDefaultWidget(com.trolltech.qt.gui.QWidget)"><tt>setDefaultWidget</tt></a>. That widget will then be used if the action is added to a <a href="QToolBar.html"><tt>QToolBar</tt></a>, or in general to an action container that supports <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a>. If a <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a> with only a default widget is added to two toolbars at the same time then the default widget is shown only in the first toolbar the action was added to. <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a> takes over ownership of the default widget.</p> <p>Note that it is up to the widget to activate the action, for example by reimplementing mouse event handlers and calling QAction::trigger().</p> <p><b>Mac OS X</b>: If you add widgets to a menu in the application's menu bar on Mac OS X, the widget will be added and function but there are some limitations:</p> <ol type="1"> <li>The widget is reparented away from the <a href="QMenu.html"><tt>QMenu</tt></a> to the native menu view. If you show the menu some other place (e.g&#x2e; as a popup menu), the widget will not be there.</li> <li>Focus/Keyboard handling of the widget is not possible</li> <li>Mouse tracking on the widget currently does not work</li> <li>Connecting the <a href="QWidgetAction.html#triggered(boolean)"><tt>triggered</tt></a> signal to a slot that opens a modal dialog will cause a crash in Mac OS X 10.4 (known bug acknowledged by Apple), a workaround is to use a QueuedConnection instead of a DirectConnection.</li> </ol> @see <a href="QAction.html#QAction(com.trolltech.qt.gui.QIcon, java.lang.String, com.trolltech.qt.core.QObject)"><tt>QAction</tt></a> @see <a href="QActionGroup.html"><tt>QActionGroup</tt></a> @see <a href="QWidget.html"><tt>QWidget</tt></a> */"> <signal name="protected final void changed()" doc="/** <p>This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for QWidget::actionEvent() sent with an QEvent::ActionChanged.</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><tt>QWidget::actionEvent</tt></dd> </dl> */"/> <signal name="protected final void hovered()" doc="/** <p>This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><tt>QAction::activate</tt></dd> </dl> */"/> <signal name="protected final void toggled(boolean arg__1)" doc="/** <p>This signal is emitted whenever a checkable action changes its <a href="QAction.html#isChecked()"><tt>isChecked</tt></a> status. This can be the result of a user interaction, or because <a href="QAction.html#setChecked(boolean)"><tt>setChecked</tt></a> was called.</p> <p><tt>arg__1</tt> is true if the action is checked, or false if the action is unchecked.</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(boolean arg__1)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><tt>QAction::activate</tt>, <tt>QAction::triggered</tt>, checked</tt></dd> </dl> */"/> <signal name="protected final void triggered(boolean checked)" doc="/** <p>This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when <a href="QAction.html#trigger()"><tt>trigger</tt></a> was called. Notably, it is <i>not</i> emitted when <a href="QAction.html#setChecked(boolean)"><tt>setChecked</tt></a> or <a href="QAction.html#toggle()"><tt>toggle</tt></a> is called.</p> <p>If the action is checkable, <tt>checked</tt> is true if the action is checked, or false if the action is unchecked.</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(boolean checked)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><tt>QAction::activate</tt>, <tt>QAction::toggled</tt>, checked</tt></dd> </dl> */"/> <method name="public QWidgetAction(com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs an action with <tt>parent</tt>.</p> */"/> <method name="protected final java.util.List<com.trolltech.qt.gui.QWidget> createdWidgets()" doc="/** <p>Returns the list of widgets that have been using <a href="QWidgetAction.html#createWidget(com.trolltech.qt.gui.QWidget)"><tt>createWidget</tt></a> and are currently in use by widgets the action has been added to.</p> */"/> <method name="public final com.trolltech.qt.gui.QWidget defaultWidget()" doc="/** <p>Returns the default widget.</p> @see <a href="QWidgetAction.html#setDefaultWidget(com.trolltech.qt.gui.QWidget)"><tt>setDefaultWidget</tt></a> */"/> <method name="public final void releaseWidget(com.trolltech.qt.gui.QWidget widget)" doc="/** <p>Releases the specified <tt>widget</tt>.</p> <p>Container widgets that support actions call this function when a widget action is removed.</p> @see <a href="QWidgetAction.html#requestWidget(com.trolltech.qt.gui.QWidget)"><tt>requestWidget</tt></a> @see <a href="QWidgetAction.html#deleteWidget(com.trolltech.qt.gui.QWidget)"><tt>deleteWidget</tt></a> @see <a href="QWidgetAction.html#defaultWidget()"><tt>defaultWidget</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QWidget requestWidget(com.trolltech.qt.gui.QWidget parent)" doc="/** <p>Returns a widget that represents the action, with the given <tt>parent</tt>.</p> <p>Container widgets that support actions can call this function to request a widget as visual representation of the action.</p> @see <a href="QWidgetAction.html#releaseWidget(com.trolltech.qt.gui.QWidget)"><tt>releaseWidget</tt></a> @see <a href="QWidgetAction.html#createWidget(com.trolltech.qt.gui.QWidget)"><tt>createWidget</tt></a> @see <a href="QWidgetAction.html#defaultWidget()"><tt>defaultWidget</tt></a> */"/> <method name="public final void setDefaultWidget(com.trolltech.qt.gui.QWidget w)" doc="/** <p>Sets <tt>w</tt> to be the default widget. The ownership is transferred to <a href="QWidgetAction.html#QWidgetAction(com.trolltech.qt.core.QObject)"><tt>QWidgetAction</tt></a>. Unless <a href="QWidgetAction.html#createWidget(com.trolltech.qt.gui.QWidget)"><tt>createWidget</tt></a> is reimplemented by a subclass to return a new widget the default widget is used when a container widget requests a widget through <a href="QWidgetAction.html#requestWidget(com.trolltech.qt.gui.QWidget)"><tt>requestWidget</tt></a>.</p> @see <a href="QWidgetAction.html#defaultWidget()"><tt>defaultWidget</tt></a> */"/> <method name="protected com.trolltech.qt.gui.QWidget createWidget(com.trolltech.qt.gui.QWidget parent)" doc="/** <p>This function is called whenever the action is added to a container widget that supports custom widgets. If you don't want a custom widget to be used as representation of the action in the specified <tt>parent</tt> widget then 0 should be returned.</p> @see <a href="QWidgetAction.html#deleteWidget(com.trolltech.qt.gui.QWidget)"><tt>deleteWidget</tt></a> */"/> <method name="protected void deleteWidget(com.trolltech.qt.gui.QWidget widget)" doc="/** <p>This function is called whenever the action is removed from a container widget that displays the action using a custom <tt>widget</tt> previously created using <a href="QWidgetAction.html#createWidget(com.trolltech.qt.gui.QWidget)"><tt>createWidget</tt></a>. The default implementation hides the <tt>widget</tt> and schedules it for deletion using QObject::deleteLater().</p> @see <a href="QWidgetAction.html#createWidget(com.trolltech.qt.gui.QWidget)"><tt>createWidget</tt></a> */"/> <method name="public boolean event(com.trolltech.qt.core.QEvent arg__1)" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> </class>