You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
537 lines
24 KiB
537 lines
24 KiB
13 years ago
|
'\" t
|
||
|
.TH QAction 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
||
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
||
|
.\" license file included in the distribution for a complete license
|
||
|
.\" statement.
|
||
|
.\"
|
||
|
.ad l
|
||
|
.nh
|
||
|
.SH NAME
|
||
|
QAction \- Abstract user interface action that can appear both in menus and tool bars
|
||
|
.SH SYNOPSIS
|
||
|
\fC#include <qaction.h>\fR
|
||
|
.PP
|
||
|
Inherits QObject.
|
||
|
.PP
|
||
|
Inherited by QActionGroup.
|
||
|
.PP
|
||
|
.SS "Public Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "\fBQAction\fR ( QObject * parent, const char * name = 0 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fBQAction\fR ( const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fBQAction\fR ( const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QAction ( const QString & text, const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QAction ( const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QAction ( QObject * parent, const char * name, bool toggle ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fB~QAction\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetIconSet\fR ( const QIconSet & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QIconSet \fBiconSet\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetText\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBtext\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetMenuText\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBmenuText\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetToolTip\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBtoolTip\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetStatusTip\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBstatusTip\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetWhatsThis\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBwhatsThis\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetAccel\fR ( const QKeySequence & key )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QKeySequence \fBaccel\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetToggleAction\fR ( bool )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisToggleAction\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisOn\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisEnabled\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisVisible\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual bool \fBaddTo\fR ( QWidget * w )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual bool \fBremoveFrom\fR ( QWidget * w )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Public Slots"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBactivate\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBtoggle\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetOn\fR ( bool )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetEnabled\fR ( bool )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetDisabled\fR ( bool disable )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetVisible\fR ( bool )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Signals"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBactivated\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBtoggled\fR ( bool on )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Properties"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "QKeySequence \fBaccel\fR - the action's accelerator key"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBenabled\fR - whether the action is enabled"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QIconSet \fBiconSet\fR - the action's icon"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBmenuText\fR - the action's menu text"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBon\fR - whether a toggle action is on"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBstatusTip\fR - the action's status tip"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBtext\fR - the action's descriptive text"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBtoggleAction\fR - whether the action is a toggle action"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBtoolTip\fR - the action's tool tip"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBvisible\fR - whether the action can be seen (e.g. in menus and " "toolbars" ")"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBwhatsThis\fR - the action's ""What's This?"" help text"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Protected Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBaddedTo\fR ( QWidget * actionWidget, QWidget * container )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBaddedTo\fR ( int index, QPopupMenu * menu )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SH DESCRIPTION
|
||
|
The QAction class provides an abstract user interface action that can appear both in menus and tool bars.
|
||
|
.PP
|
||
|
In GUI applications many commands can be invoked via a menu option, a toolbar button and a keyboard accelerator. Since the same action must be performed regardless of how the action was invoked, and since the menu and toolbar should be kept in sync, it is useful to represent a command as an \fIaction\fR. An action can be added to a menu and a toolbar and will automatically keep them in sync. For example, if the user presses a Bold toolbar button the Bold menu item will automatically be checked.
|
||
|
.PP
|
||
|
A QAction may contain an icon, a menu text, an accelerator, a status text, a whats this text and a tool tip. Most of these can be set in the constructor. They can also be set independently with setIconSet(), setText(), setMenuText(), setToolTip(), setStatusTip(), setWhatsThis() and setAccel().
|
||
|
.PP
|
||
|
An action may be a toggle action e.g. a Bold toolbar button, or a command action, e.g. 'Open File' to invoke an open file dialog. Toggle actions emit the toggled() signal when their state changes. Both command and toggle actions emit the activated() signal when they are invoked. Use setToggleAction() to set an action's toggled status. To see if an action is a toggle action use isToggleAction(). A toggle action may be "on", isOn() returns TRUE, or "off", isOn() returns FALSE.
|
||
|
.PP
|
||
|
Actions are added to widgets (menus or toolbars) using addTo(), and removed using removeFrom().
|
||
|
.PP
|
||
|
Once a QAction has been created it should be added to the relevant menu and toolbar and then connected to the slot which will perform the action. For example:
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
fileOpenAction = new QAction( QPixmap( fileopen ), "&Open...",
|
||
|
.br
|
||
|
CTRL+Key_O, this, "open" );
|
||
|
.br
|
||
|
connect( fileOpenAction, SIGNAL( activated() ) , this, SLOT( choose() ) );
|
||
|
.fi
|
||
|
.PP
|
||
|
We create a "File Save" action with a menu text of "&Save" and \fICtrl+S\fR as the keyboard accelerator. We connect the fileSaveAction's activated() signal to our own save() slot. Note that at this point there is no menu or toolbar action, we'll add them next:
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QToolBar * fileTools = new QToolBar( this, "file operations" );
|
||
|
.fi
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
fileSaveAction->addTo( fileTools );
|
||
|
.fi
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QPopupMenu * file = new QPopupMenu( this );
|
||
|
.br
|
||
|
menuBar()->insertItem( "&File", file );
|
||
|
.fi
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
fileSaveAction->addTo( file );
|
||
|
.fi
|
||
|
.PP
|
||
|
We create a toolbar and add our fileSaveAction to it. Similarly we create a menu, add a top-level menu item, and add our fileSaveAction.
|
||
|
.PP
|
||
|
We recommend that actions are created as children of the window that they are used in. In most cases actions will be children of the application's main window.
|
||
|
.PP
|
||
|
To prevent recursion, don't create an action as a child of a widget that the action is later added to.
|
||
|
.PP
|
||
|
See also Main Window and Related Classes and Basic Widgets.
|
||
|
.SH MEMBER FUNCTION DOCUMENTATION
|
||
|
.SH "QAction::QAction ( QObject * parent, const char * name = 0 )"
|
||
|
Constructs an action called \fIname\fR with parent \fIparent\fR.
|
||
|
.PP
|
||
|
If \fIparent\fR is a QActionGroup, the new action inserts itself into \fIparent\fR.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.PP
|
||
|
\fBWarning:\fR To prevent recursion, don't create an action as a child of a widget that the action is later added to.
|
||
|
.SH "QAction::QAction ( const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )"
|
||
|
This constructor results in an icon-less action with the the menu text \fImenuText\fR and keyboard accelerator \fIaccel\fR. It is a child of \fIparent\fR and called \fIname\fR.
|
||
|
.PP
|
||
|
If \fIparent\fR is a QActionGroup, the action automatically becomes a member of it.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.PP
|
||
|
The action uses a stripped version of \fImenuText\fR (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for toolbuttons. You can override this by setting a specific description with setText(). The same text and \fIaccel\fR will be used for tool tips and status tips unless you provide text for these using setToolTip() and setStatusTip().
|
||
|
.PP
|
||
|
Call setToggleAction(TRUE) to make the action a toggle action.
|
||
|
.PP
|
||
|
\fBWarning:\fR To prevent recursion, don't create an action as a child of a widget that the action is later added to.
|
||
|
.SH "QAction::QAction ( const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0 )"
|
||
|
This constructor creates an action with the following properties: the icon or iconset \fIicon\fR, the menu text \fImenuText\fR and keyboard accelerator \fIaccel\fR. It is a child of \fIparent\fR and called \fIname\fR.
|
||
|
.PP
|
||
|
If \fIparent\fR is a QActionGroup, the action automatically becomes a member of it.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.PP
|
||
|
The action uses a stripped version of \fImenuText\fR (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for toolbuttons. You can override this by setting a specific description with setText(). The same text and \fIaccel\fR will be used for tool tips and status tips unless you provide text for these using setToolTip() and setStatusTip().
|
||
|
.PP
|
||
|
Call setToggleAction(TRUE) to make the action a toggle action.
|
||
|
.PP
|
||
|
\fBWarning:\fR To prevent recursion, don't create an action as a child of a widget that the action is later added to.
|
||
|
.SH "QAction::QAction ( const QString & text, const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This constructor creates an action with the following properties: the description \fItext\fR, the icon or iconset \fIicon\fR, the menu text \fImenuText\fR and keyboard accelerator \fIaccel\fR. It is a child of \fIparent\fR and called \fIname\fR. If \fItoggle\fR is TRUE the action will be a toggle action, otherwise it will be a command action.
|
||
|
.PP
|
||
|
If \fIparent\fR is a QActionGroup, the action automatically becomes a member of it.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.PP
|
||
|
The \fItext\fR and \fIaccel\fR will be used for tool tips and status tips unless you provide specific text for these using setToolTip() and setStatusTip().
|
||
|
.SH "QAction::QAction ( const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This constructor results in an icon-less action with the description \fItext\fR, the menu text \fImenuText\fR and the keyboard accelerator \fIaccel\fR. Its parent is \fIparent\fR and it is called \fIname\fR. If \fItoggle\fR is TRUE the action will be a toggle action, otherwise it will be a command action.
|
||
|
.PP
|
||
|
The action automatically becomes a member of \fIparent\fR if \fIparent\fR is a QActionGroup.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.PP
|
||
|
The \fItext\fR and \fIaccel\fR will be used for tool tips and status tips unless you provide specific text for these using setToolTip() and setStatusTip().
|
||
|
.SH "QAction::QAction ( QObject * parent, const char * name, bool toggle )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Constructs an action called \fIname\fR with parent \fIparent\fR.
|
||
|
.PP
|
||
|
If \fItoggle\fR is TRUE the action will be a toggle action, otherwise it will be a command action.
|
||
|
.PP
|
||
|
If \fIparent\fR is a QActionGroup, the new action inserts itself into \fIparent\fR.
|
||
|
.PP
|
||
|
For accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget.
|
||
|
.SH "QAction::~QAction ()"
|
||
|
Destroys the object and frees allocated resources.
|
||
|
.SH "QKeySequence QAction::accel () const"
|
||
|
Returns the action's accelerator key. See the "accel" property for details.
|
||
|
.SH "void QAction::activate ()\fC [slot]\fR"
|
||
|
Activates the action and executes all connected slots. This only works for actions that are not toggle action.
|
||
|
.PP
|
||
|
See also toggle().
|
||
|
.SH "void QAction::activated ()\fC [signal]\fR"
|
||
|
This signal is emitted when an action is activated by the user, e.g. when the user clicks a menu option or a toolbar button or presses an action's accelerator key combination.
|
||
|
.PP
|
||
|
Connect to this signal for command actions. Connect to the toggled() signal for toggle actions.
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l action/application.cpp, chart/chartform.cpp, and themes/themes.cpp.
|
||
|
.SH "bool QAction::addTo ( QWidget * w )\fC [virtual]\fR"
|
||
|
Adds this action to widget \fIw\fR.
|
||
|
.PP
|
||
|
Currently actions may be added to QToolBar and QPopupMenu widgets.
|
||
|
.PP
|
||
|
An action added to a tool bar is automatically displayed as a tool button; an action added to a pop up menu appears as a menu option.
|
||
|
.PP
|
||
|
addTo() returns TRUE if the action was added successfully and FALSE otherwise. (If \fIw\fR is not a QToolBar or QPopupMenu the action will not be added and FALSE will be returned.)
|
||
|
.PP
|
||
|
See also removeFrom().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l action/application.cpp, action/toggleaction/toggleaction.cpp, and chart/chartform.cpp.
|
||
|
.PP
|
||
|
Reimplemented in QActionGroup.
|
||
|
.SH "void QAction::addedTo ( QWidget * actionWidget, QWidget * container )\fC [virtual protected]\fR"
|
||
|
This function is called from the addTo() function when it has created a widget (\fIactionWidget\fR) for the action in the \fIcontainer\fR.
|
||
|
.SH "void QAction::addedTo ( int index, QPopupMenu * menu )\fC [virtual protected]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This function is called from the addTo() function when it has created a menu item at the index position \fIindex\fR in the popup menu \fImenu\fR.
|
||
|
.SH "QIconSet QAction::iconSet () const"
|
||
|
Returns the action's icon. See the "iconSet" property for details.
|
||
|
.SH "bool QAction::isEnabled () const"
|
||
|
Returns TRUE if the action is enabled; otherwise returns FALSE. See the "enabled" property for details.
|
||
|
.SH "bool QAction::isOn () const"
|
||
|
Returns TRUE if a toggle action is on; otherwise returns FALSE. See the "on" property for details.
|
||
|
.SH "bool QAction::isToggleAction () const"
|
||
|
Returns TRUE if the action is a toggle action; otherwise returns FALSE. See the "toggleAction" property for details.
|
||
|
.SH "bool QAction::isVisible () const"
|
||
|
Returns TRUE if the action can be seen (e.g. in menus and toolbars); otherwise returns FALSE. See the "visible" property for details.
|
||
|
.SH "QString QAction::menuText () const"
|
||
|
Returns the action's menu text. See the "menuText" property for details.
|
||
|
.SH "bool QAction::removeFrom ( QWidget * w )\fC [virtual]\fR"
|
||
|
Removes the action from widget \fIw\fR.
|
||
|
.PP
|
||
|
Returns TRUE if the action was removed successfully; otherwise returns FALSE.
|
||
|
.PP
|
||
|
See also addTo().
|
||
|
.SH "void QAction::setAccel ( const QKeySequence & key )\fC [virtual]\fR"
|
||
|
Sets the action's accelerator key to \fIkey\fR. See the "accel" property for details.
|
||
|
.SH "void QAction::setDisabled ( bool disable )\fC [slot]\fR"
|
||
|
Disables the action if \fIdisable\fR is TRUE; otherwise enables the action.
|
||
|
.PP
|
||
|
See the enabled documentation for more information.
|
||
|
.SH "void QAction::setEnabled ( bool )\fC [virtual slot]\fR"
|
||
|
Sets whether the action is enabled. See the "enabled" property for details.
|
||
|
.SH "void QAction::setIconSet ( const QIconSet & )\fC [virtual]\fR"
|
||
|
Sets the action's icon. See the "iconSet" property for details.
|
||
|
.SH "void QAction::setMenuText ( const QString & )\fC [virtual]\fR"
|
||
|
Sets the action's menu text. See the "menuText" property for details.
|
||
|
.SH "void QAction::setOn ( bool )\fC [virtual slot]\fR"
|
||
|
Sets whether a toggle action is on. See the "on" property for details.
|
||
|
.SH "void QAction::setStatusTip ( const QString & )\fC [virtual]\fR"
|
||
|
Sets the action's status tip. See the "statusTip" property for details.
|
||
|
.SH "void QAction::setText ( const QString & )\fC [virtual]\fR"
|
||
|
Sets the action's descriptive text. See the "text" property for details.
|
||
|
.SH "void QAction::setToggleAction ( bool )\fC [virtual]\fR"
|
||
|
Sets whether the action is a toggle action. See the "toggleAction" property for details.
|
||
|
.SH "void QAction::setToolTip ( const QString & )\fC [virtual]\fR"
|
||
|
Sets the action's tool tip. See the "toolTip" property for details.
|
||
|
.SH "void QAction::setVisible ( bool )\fC [slot]\fR"
|
||
|
Sets whether the action can be seen (e.g. in menus and toolbars). See the "visible" property for details.
|
||
|
.SH "void QAction::setWhatsThis ( const QString & )\fC [virtual]\fR"
|
||
|
Sets the action's "What's This?" help text. See the "whatsThis" property for details.
|
||
|
.SH "QString QAction::statusTip () const"
|
||
|
Returns the action's status tip. See the "statusTip" property for details.
|
||
|
.SH "QString QAction::text () const"
|
||
|
Returns the action's descriptive text. See the "text" property for details.
|
||
|
.SH "void QAction::toggle ()\fC [slot]\fR"
|
||
|
Toggles the state of a toggle action.
|
||
|
.PP
|
||
|
See also on, activate(), toggled(), and toggleAction.
|
||
|
.SH "void QAction::toggled ( bool on )\fC [signal]\fR"
|
||
|
This signal is emitted when a toggle action changes state; command actions and QActionGroups don't emit toggled().
|
||
|
.PP
|
||
|
The \fIon\fR argument denotes the new state: If \fIon\fR is TRUE the toggle action is switched on, and if \fIon\fR is FALSE the toggle action is switched off.
|
||
|
.PP
|
||
|
To trigger a user command depending on whether a toggle action has been switched on or off connect it to a slot that takes a bool to indicate the state, e.g.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QMainWindow * window = new QMainWindow;
|
||
|
.fi
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QAction * labelonoffaction = new QAction( window, "labelonoff" );
|
||
|
.fi
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QObject::connect( labelonoffaction, SIGNAL( toggled( bool ) ),
|
||
|
.br
|
||
|
window, SLOT( setUsesTextLabel( bool ) ) );
|
||
|
.fi
|
||
|
.PP
|
||
|
See also activated(), toggleAction, and on.
|
||
|
.PP
|
||
|
Example: action/toggleaction/toggleaction.cpp.
|
||
|
.SH "QString QAction::toolTip () const"
|
||
|
Returns the action's tool tip. See the "toolTip" property for details.
|
||
|
.SH "QString QAction::whatsThis () const"
|
||
|
Returns the action's "What's This?" help text. See the "whatsThis" property for details.
|
||
|
.SS "Property Documentation"
|
||
|
.SH "QKeySequence accel"
|
||
|
This property holds the action's accelerator key.
|
||
|
.PP
|
||
|
The keycodes can be found in Qt::Key and Qt::Modifier. There is no default accelerator key.
|
||
|
.PP
|
||
|
Set this property's value with setAccel() and get this property's value with accel().
|
||
|
.SH "bool enabled"
|
||
|
This property holds whether the action is enabled.
|
||
|
.PP
|
||
|
Disabled actions can't be chosen by the user. They don't disappear from the menu/tool bar but are displayed in a way which indicates that they are unavailable, e.g. they might be displayed grayed out.
|
||
|
.PP
|
||
|
What's this? help on disabled actions is still available provided the QAction::whatsThis property is set.
|
||
|
.PP
|
||
|
Set this property's value with setEnabled() and get this property's value with isEnabled().
|
||
|
.SH "QIconSet iconSet"
|
||
|
This property holds the action's icon.
|
||
|
.PP
|
||
|
The icon is used as the tool button icon and in the menu to the left of the menu text. There is no default icon.
|
||
|
.PP
|
||
|
If a null icon (QIconSet::isNull() is passed into this function, the icon of the action is cleared.
|
||
|
.PP
|
||
|
(See the action/toggleaction/toggleaction.cpp example.)
|
||
|
.PP
|
||
|
Set this property's value with setIconSet() and get this property's value with iconSet().
|
||
|
.SH "QString menuText"
|
||
|
This property holds the action's menu text.
|
||
|
.PP
|
||
|
If the action is added to a menu the menu option will consist of the icon (if there is one), the menu text and the accelerator (if there is one). If the menu text is not explicitly set in the constructor or by using setMenuText() the action's description text will be used as the menu text. There is no default menu text.
|
||
|
.PP
|
||
|
See also text.
|
||
|
.PP
|
||
|
Set this property's value with setMenuText() and get this property's value with menuText().
|
||
|
.SH "bool on"
|
||
|
This property holds whether a toggle action is on.
|
||
|
.PP
|
||
|
This property is always on (TRUE) for command actions and QActionGroups; setOn() has no effect on them. For action's where isToggleAction() is TRUE, this property's default value is off (FALSE).
|
||
|
.PP
|
||
|
See also toggleAction.
|
||
|
.PP
|
||
|
Set this property's value with setOn() and get this property's value with isOn().
|
||
|
.SH "QString statusTip"
|
||
|
This property holds the action's status tip.
|
||
|
.PP
|
||
|
The statusTip is displayed on all status bars that this action's toplevel parent widget provides.
|
||
|
.PP
|
||
|
If no status tip is defined, the action uses the tool tip text.
|
||
|
.PP
|
||
|
There is no default statusTip text.
|
||
|
.PP
|
||
|
See also statusTip and toolTip.
|
||
|
.PP
|
||
|
Set this property's value with setStatusTip() and get this property's value with statusTip().
|
||
|
.SH "QString text"
|
||
|
This property holds the action's descriptive text.
|
||
|
.PP
|
||
|
If QMainWindow::usesTextLabel is TRUE, the text appears as a label in the relevant tool button. It also serves as the default text in menus and tool tips if these have not been specifically defined. There is no default text.
|
||
|
.PP
|
||
|
See also menuText, toolTip, and statusTip.
|
||
|
.PP
|
||
|
Set this property's value with setText() and get this property's value with text().
|
||
|
.SH "bool toggleAction"
|
||
|
This property holds whether the action is a toggle action.
|
||
|
.PP
|
||
|
A toggle action is one which has an on/off state. For example a Bold toolbar button is either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. This property's default is FALSE.
|
||
|
.PP
|
||
|
In some situations, the state of one toggle action should depend on the state of others. For example, "Left Align", "Center" and" Right Align" toggle actions are mutually exclusive. To achieve exclusive toggling, add the relevant toggle actions to a QActionGroup with the QActionGroup::exclusive property set to TRUE.
|
||
|
.PP
|
||
|
Set this property's value with setToggleAction() and get this property's value with isToggleAction().
|
||
|
.SH "QString toolTip"
|
||
|
This property holds the action's tool tip.
|
||
|
.PP
|
||
|
This text is used for the tool tip. If no status tip has been set the tool tip will be used for the status tip.
|
||
|
.PP
|
||
|
If no tool tip is specified the action's text is used, and if that hasn't been specified the description text is used as the tool tip text.
|
||
|
.PP
|
||
|
There is no default tool tip text.
|
||
|
.PP
|
||
|
See also statusTip and accel.
|
||
|
.PP
|
||
|
Set this property's value with setToolTip() and get this property's value with toolTip().
|
||
|
.SH "bool visible"
|
||
|
This property holds whether the action can be seen (e.g. in menus and toolbars).
|
||
|
.PP
|
||
|
If \fIvisible\fR is TRUE the action can be seen (e.g. in menus and toolbars) and chosen by the user; if \fIvisible\fR is FALSE the action cannot be seen or chosen by the user.
|
||
|
.PP
|
||
|
Actions which are not visible are \fInot\fR grayed out; they do not appear at all.
|
||
|
.PP
|
||
|
Set this property's value with setVisible() and get this property's value with isVisible().
|
||
|
.SH "QString whatsThis"
|
||
|
This property holds the action's "What's This?" help text.
|
||
|
.PP
|
||
|
The whats this text is used to provide a brief description of the action. The text may contain rich text (HTML-like tags -- see QStyleSheet for the list of supported tags). There is no default" What's This" text.
|
||
|
.PP
|
||
|
See also QWhatsThis.
|
||
|
.PP
|
||
|
Set this property's value with setWhatsThis() and get this property's value with whatsThis().
|
||
|
|
||
|
.SH "SEE ALSO"
|
||
|
.BR http://doc.trolltech.com/qaction.html
|
||
|
.BR http://www.trolltech.com/faq/tech.html
|
||
|
.SH COPYRIGHT
|
||
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
||
|
license file included in the distribution for a complete license
|
||
|
statement.
|
||
|
.SH AUTHOR
|
||
|
Generated automatically from the source code.
|
||
|
.SH BUGS
|
||
|
If you find a bug in Qt, please report it as described in
|
||
|
.BR http://doc.trolltech.com/bughowto.html .
|
||
|
Good bug reports help us to help you. Thank you.
|
||
|
.P
|
||
|
The definitive Qt documentation is provided in HTML format; it is
|
||
|
located at $QTDIR/doc/html and can be read using Qt Assistant or with
|
||
|
a web browser. This man page is provided as a convenience for those
|
||
|
users who prefer man pages, although this format is not officially
|
||
|
supported by Trolltech.
|
||
|
.P
|
||
|
If you find errors in this manual page, please report them to
|
||
|
.BR qt-bugs@trolltech.com .
|
||
|
Please include the name of the manual page (qaction.3qt) and the Qt
|
||
|
version (3.3.8).
|