📄 qaction.3qt
字号:
'\" t.TH QAction 3qt "17 July 2003" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQAction \- Abstracts a user interface action that can appear both in menus and tool bars.br.PP\fC#include <qaction.h>\fR.PPInherits QObject..PPInherited by QActionGroup..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQAction\fR ( QObject * " "parent" " = 0, const char * " "name" " = 0, bool " "toggle" " = FALSE ) ".br.ti -1c.BI "\fBQAction\fR ( const QString & " "text" ", const QIconSet & " "icon" ", const QString & " "menuText" ", int " "accel" ", QObject * " "parent" ", const char * " "name" " = 0, bool " "toggle" " = FALSE ) ".br.ti -1c.BI "\fBQAction\fR ( const QString & " "text" ", const QString & " "menuText" ", int " "accel" ", QObject * " "parent" ", const char * " "name" " = 0, bool " "toggle" " = FALSE ) ".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 ( int key ) ".br.ti -1c.BI "int \fBaccel\fR () const".br.ti -1c.BI "virtual void \fBsetToggleAction\fR ( bool ) ".br.ti -1c.BI "bool \fBisToggleAction\fR () const".br.ti -1c.BI "virtual void \fBsetOn\fR ( bool ) ".br.ti -1c.BI "bool \fBisOn\fR () const".br.ti -1c.BI "bool \fBisEnabled\fR () const".br.ti -1c.BI "virtual bool \fBaddTo\fR ( QWidget * ) ".br.ti -1c.BI "virtual bool \fBremoveFrom\fR ( QWidget * ) ".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetEnabled\fR ( bool ) ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBactivated\fR () ".br.ti -1c.BI "void \fBtoggled\fR ( bool ) ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE Optionsbool toggleAction isToggleAction setToggleActionbool on isOn setOnbool enabled isEnabled setEnabledQIconSet iconSet iconSet setIconSetQString text text setTextQString menuText menuText setMenuTextQString toolTip toolTip setToolTipQString statusTip statusTip setStatusTipQString whatsThis whatsThis setWhatsThisint accel accel setAccel.TE.fi.SH DESCRIPTIONThe QAction class abstracts a user interface action that can appear both in menus and tool bars..PPThere are two basic kind of user interface actions, command actions and options. QAction usually models a command action, for example" open file". When the actual action shall be performed, it emits the activated() signal. Options, for example the drawing tools in a paint program, are represented by toggle actions (see setToggleAction() ). A toggle action emits a toggled() signal whenever it changes state. Several toggle actions can be combined in a QActionGroup..PPTo provide an action to the user, use addTo() to add it to either a menu or a tool bar, for example:.PP.nf.br QPopupMenu* popup = new QPopupMenu;.br QAction* myAction= new QAction;.br myAction->setText( "MyAction" );.br myAction->addTo( popup );.fi.PPYou can add an action to an arbitrary number of menus and toolbars and remove it again with removeFrom()..PPChanging an action's properties, for example using setEnabled(), setOn() or setText(), immediately shows up in all representations. Other properties that define the way an action is presented to the user are iconSet(), menuText(), toolTip(), statusTip() and whatsThis()..PPAn action may also be triggered by an accelerator key declared with setAccel(). Since accelerators are window specific, the application window has to be an ancestor of the action. Generally, it is therefore a good idea to always create actions as direct children of the main window..SH MEMBER FUNCTION DOCUMENTATION.SH "QAction::QAction ( QObject * parent = 0, const char * name = 0, bool toggle = FALSE )"Constructs an action with parent \fIparent\fR and name \fIname.\fR.PPIf \fItoggle\fR is TRUE, the action becomes a toggle action..PPIf the parent is a QActionGroup, the action automatically becomes a member of it..PPNote: for accelerators to work, the parent or one of its ancestors has to be the application window..SH "QAction::QAction ( const QString & text, const QIconSet & icon, const QString & menuText, int accel, QObject * parent, const char * name = 0, bool toggle = FALSE )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPConstructs an action with text \fItext,\fR icon \fIicon,\fR menu text \fImenuText,\fR a keyboard accelerator \fIaccel,\fR a \fIparent\fR and name \fIname. text\fR will also show up in tooltips, unless you call setToolTip() with a different tip later..PPIf the parent is a QActionGroup, the action automatically becomes a member of it..PPNote: for accelerators to work, the parent or one of its ancestors has to be the application window..SH "QAction::QAction ( const QString & text, const QString & menuText, int accel, QObject * parent, const char * name = 0, bool toggle = FALSE )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPConstructs an action with text \fItext,\fR menu text \fImenuText,\fR a keyboard accelerator \fIaccel,\fR a \fIparent\fR and name \fIname. text\fR will also show up in tooltips, unless you call setToolTip() with a different tip later..PPIf \fItoggle\fR is TRUE, the action becomes a toggle action..PPIf the parent is a QActionGroup, the action automatically becomes a member of it..PPNote: for accelerators to work, the parent or one of its ancestors has to be the application window..SH "QAction::~QAction ()"Destroys the object and frees any allocated resources..SH "int QAction::accel () const"Returns the acceleration key..PPSee also setAccel()..SH "void QAction::activated () \fC[signal]\fR"This signal is emitted when the action was activated by the user..PPSee also toggled()..SH "bool QAction::addTo ( QWidget * w ) \fC[virtual]\fR"Adds this action to widget \fIw.\fR.PPCurrently supported widget types are QToolBar and QPopupMenu..PPReturns TRUE when the action was added successfully, FALSE otherwise..PPSee also removeFrom()..PPReimplemented in QActionGroup..SH "QIconSet QAction::iconSet () const"Returns the icon set..PPSee also setIconSet();..SH "bool QAction::isEnabled () const"Returns TRUE if the action is enabled, or FALSE if it is disabled..PPSee also setEnabled()..SH "bool QAction::isOn () const"Returns TRUE if this toggle action is switched on, or FALSE if it is switched off..PPSee also setOn() and isToggleAction()..SH "bool QAction::isToggleAction () const"Returns whether the action is a toggle action or not..PPSee also setToggleAction()..SH "QString QAction::menuText () const"Returns the text used for menu items..PPIf no menu text has been defined yet, this is the same as text()..PPSee also setMenuText() and text()..SH "bool QAction::removeFrom ( QWidget * w ) \fC[virtual]\fR"Removes the action from widget \fIw\fR.PPReturns TRUE when the action was removed successfully, FALSE otherwise..PPSee also addTo()..PPReimplemented in QActionGroup..SH "void QAction::setAccel ( int key ) \fC[virtual]\fR"Sets the action's accelerator to \fIkey.\fR.PPNote: For accelerators to work, the parent or one of its ancestors has to be the application window..PPSee also accel()..SH "void QAction::setEnabled ( bool enable ) \fC[virtual slot]\fR"Enables the action if \fIenable\fR is TRUE, otherwise disables it..PPMenu items and/or tool buttons presenting the action to the user are updated accordingly..PPSee also isEnabled()..PPReimplemented in QActionGroup..SH "void QAction::setIconSet ( const QIconSet & icon ) \fC[virtual]\fR"Sets the icon set to \fIicon.\fR.PPSee also iconSet();..SH "void QAction::setMenuText ( const QString & text ) \fC[virtual]\fR"Sets a special text \fItext\fR for menu items. Use this to specify ellipses or keyboard shortcuts that should not show up in tooltips or as button text..PPSee also setText() and menuText()..SH "void QAction::setOn ( bool enable ) \fC[virtual]\fR"Switches a toggle action on if \fIenable\fR is TRUE or off if \fIenable\fR is FALSE..PPThis function should be called only for toggle actions..PPSee also isOn() and setToggleAction()..SH "void QAction::setStatusTip ( const QString & tip ) \fC[virtual]\fR"Sets the status tip to \fItip.\fR The tip will be displayed on all status bars the topmost parent of the action provides..PPSee also statusTip()..SH "void QAction::setText ( const QString & text ) \fC[virtual]\fR"Sets the text to \fItext.\fR.PPSee also setMenuText() and text()..SH "void QAction::setToggleAction ( bool enable ) \fC[virtual]\fR"Makes the action a toggle action if \fIenable\fR is TRUE, or a normal action if \fIenable\fR is FALSE..PPYou may want to add toggle actions to a QActionGroup for exclusive toggling..PPSee also isToggleAction()..SH "void QAction::setToolTip ( const QString & tip ) \fC[virtual]\fR"Sets the tool tip to \fItip.\fR.PPSee also toolTip()..SH "void QAction::setWhatsThis ( const QString & whatsThis ) \fC[virtual]\fR"Sets What's This help to \fIwhatsThis.\fR.PPSee also whatsThis()..SH "QString QAction::statusTip () const"Returns the current status tip..PPIf not status tip has been defined yet, this is the same as toolTip().PPSee also setStatusTip() and toolTip()..SH "QString QAction::text () const"Returns the current text..PPSee also setText() and menuText()..SH "void QAction::toggled ( bool ) \fC[signal]\fR"This signal is emitted when a toggle action changes state..PPSee also activated() and setToggleAction()..SH "QString QAction::toolTip () const"Returns the current tool tip..PPIf no tool tip has been defined yet, it returns text and a hotkey hint..PPSee also setToolTip() and text()..SH "QString QAction::whatsThis () const"Returns the What's This help for this action..PPSee also setWhatsThis()..SH "SEE ALSO".BR http://doc.trolltech.com/qaction.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qaction.3qt) and the Qtversion (2.3.7).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -