📄 qaction.3qt
字号:
.PPFor accelerators and status tips to work, \fIparent\fR must either be a widget, or an action group whose parent is a widget..PPThe \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 ()"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::activated ()\fC [signal]\fR"This signal is emitted when an action is activated by the user, i.e. when the user clicks a menu option or a toolbar button or presses an action's accelerator key combination..PPConnect to this signal for command actions. Connect to the toggled() signal for toggle actions..PPExamples:.)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..PPCurrently actions may be added to QToolBar and QPopupMenu widgets..PPAn 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..PPaddTo() 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.).PPSee also removeFrom()..PPExamples:.)l action/application.cpp, action/toggleaction/toggleaction.cpp, chart/chartform.cpp, and textedit/textedit.cpp..PPReimplemented 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..PPThis 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..PPReturns TRUE if the action was removed successfully; otherwise returns FALSE..PPSee 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::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..PPSee also on, 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()..PPThe \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..PPTo 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", TRUE );.fi.PP.nf.br QObject::connect( labelonoffaction, SIGNAL( toggled( bool ) ),.br window, SLOT( setUsesTextLabel( bool ) ) );.fi.PPSee also activated(), toggleAction, and on..PPExample: 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..PPThe keycodes can be found in Qt::Key and Qt::Modifier. There is no default accelerator key..PPSet 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..PPDisabled 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 greyed out..PPWhat's this? help on disabled actions is still available provided the QAction::whatsThis property is set..PPSet this property's value with setEnabled() and get this property's value with isEnabled()..SH "QIconSet iconSet"This property holds the action's icon..PPThe icon is used as the tool button icon and in the menu to the left of the menu text. There is no default icon..PPIf 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.).PPSet 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..PPIf 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..PPSee also text..PPSet 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..PPThis 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)..PPSee also toggleAction..PPSet 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..PPThe statusTip is displayed on all status bars that this action's toplevel parent widget provides..PPIf no status tip is defined, the action uses the tool tip text..PPThere is no default tooltip text..PPSee also statusTip and toolTip..PPSet 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..PPIf 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..PPSee also menuText, toolTip, and statusTip..PPSet 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..PPA 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..PPIn 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..PPSet 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..PPThis text is used for the tool tip. If no status tip has been set the tool tip will be used for the status tip..PPIf 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..PPThere is no default tool tip text..PPSee also statusTip and accel..PPSet 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)..PPIf \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..PPActions which are not visible are \fInot\fR just greyed out; they do not appear at all..PPSet 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..PPThe whats this text is used to provide a brief description of the action. The text may contain rich text (i.e. HTML tags -- see QStyleSheet for the list of supported tags). There is no default" What's This" text..PPSee also QWhatsThis..PPSet 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 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 help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf 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 Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -