📄 qpushbutton.3qt
字号:
Constructs a push button with no text..PPThe \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor..SH "QPushButton::QPushButton ( const QString & text, QWidget * parent, const char * name = 0 )"Constructs a push button called \fIname\fR with the parent \fIparent\fR and the text \fItext\fR..SH "QPushButton::QPushButton ( const QIconSet & icon, const QString & text, QWidget * parent, const char * name = 0 )"Constructs a push button with an \fIicon\fR and a \fItext\fR..PPNote that you can also pass a QPixmap object as an icon (thanks to the implicit type conversion provided by C++)..PPThe \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor..SH "QPushButton::~QPushButton ()"Destroys the push button.SH "QKeySequence QButton::accel () const"Returns the accelerator associated with the button. See the "accel" property for details..SH "bool QPushButton::autoDefault () const"Returns TRUE if the push button is the auto default button; otherwise returns FALSE. See the "autoDefault" property for details..SH "bool QButton::autoRepeat () const"Returns TRUE if autoRepeat is enabled; otherwise returns FALSE. See the "autoRepeat" property for details..SH "void QButton::clicked ()\fC [signal]\fR"This signal is emitted when the button is activated (i.e. first pressed down and then released when the mouse cursor is inside the button), when the accelerator key is typed or when animateClick() is called..PPThe QButtonGroup::clicked() signal does the same job, if you want to connect several buttons to the same slot..PPSee also pressed(), released() and toggled()..PPExamples:.)l fonts/simple-qfont-demo/viewer.cpp, listbox/listbox.cpp, network/clientserver/client/client.cpp, network/ftpclient/ftpmainwindow.cpp, richtext/richtext.cpp, t2/main.cpp and t4/main.cpp..SH "QButtonGroup * QButton::group () const"Returns a pointer to the group of which this button is a member..PPIf the button is not a member of any QButtonGroup, this function returns 0..PPSee also QButtonGroup..SH "QIconSet * QPushButton::iconSet () const"Returns the icon set on the push button. See the "iconSet" property for details..SH "bool QPushButton::isDefault () const"Returns TRUE if the push button is the default button; otherwise returns FALSE. See the "default" property for details..SH "bool QButton::isDown () const"Returns TRUE if the button is pressed; otherwise returns FALSE. See the "down" property for details..SH "bool QButton::isExclusiveToggle () const"Returns TRUE if the button is an exclusive toggle; otherwise returns FALSE. See the "exclusiveToggle" property for details..SH "bool QPushButton::isFlat () const"Returns TRUE if the border is disabled; otherwise returns FALSE. See the "flat" property for details..SH "bool QPushButton::isMenuButton () const"Returns TRUE if the push button has a menu button on it; otherwise returns FALSE. See the "menuButton" property for details..SH "bool QButton::isOn () const"Returns TRUE if the button is toggled; otherwise returns FALSE. See the "on" property for details..SH "bool QButton::isToggleButton () const"Returns TRUE if the button is a toggle button; otherwise returns FALSE. See the "toggleButton" property for details..SH "const QPixmap * QButton::pixmap () const"Returns the pixmap shown on the button. See the "pixmap" property for details..SH "QPopupMenu * QPushButton::popup () const"Returns the button's associated popup menu or 0 if no popup menu has been defined..PPSee also setPopup()..SH "void QButton::pressed ()\fC [signal]\fR"This signal is emitted when the button is pressed down..PPSee also released() and clicked()..PPExamples:.)l network/httpd/httpd.cpp and popup/popup.cpp..SH "void QButton::released ()\fC [signal]\fR"This signal is emitted when the button is released..PPSee also pressed(), clicked() and toggled()..SH "void QButton::setAccel ( const QKeySequence & )\fC [virtual]\fR"Sets the accelerator associated with the button. See the "accel" property for details..SH "void QPushButton::setAutoDefault ( bool autoDef )\fC [virtual]\fR"Sets whether the push button is the auto default button to \fIautoDef\fR. See the "autoDefault" property for details..SH "void QButton::setAutoRepeat ( bool )\fC [virtual]\fR"Sets whether autoRepeat is enabled. See the "autoRepeat" property for details..SH "void QPushButton::setDefault ( bool def )\fC [virtual]\fR"Sets whether the push button is the default button to \fIdef\fR. See the "default" property for details..SH "void QButton::setDown ( bool )\fC [virtual]\fR"Sets whether the button is pressed. See the "down" property for details..SH "void QPushButton::setFlat ( bool )"Sets whether the border is disabled. See the "flat" property for details..SH "void QPushButton::setIconSet ( const QIconSet & )"Sets the icon set on the push button. See the "iconSet" property for details..SH "void QPushButton::setIsMenuButton ( bool enable )\fC [virtual]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..SH "void QPushButton::setOn ( bool )\fC [virtual slot]\fR"Sets whether the push button is toggled. See the "on" property for details..SH "void QButton::setPixmap ( const QPixmap & )\fC [virtual]\fR"Sets the pixmap shown on the button. See the "pixmap" property for details..SH "void QPushButton::setPopup ( QPopupMenu * popup )"Associates the popup menu \fIpopup\fR with this push button and thus turns it into a menu button..PPOwnership of the popup menu is \fInot\fR transferred to the push button..PPSee also popup()..PPExample: qdir/qdir.cpp..SH "void QButton::setText ( const QString & )\fC [virtual]\fR"Sets the text shown on the button. See the "text" property for details..SH "void QPushButton::setToggleButton ( bool )"Sets whether the button is a toggle button. See the "toggleButton" property for details..SH "ToggleState QButton::state () const"Returns TRUE if the button is toggled; otherwise returns FALSE. See the "toggleState" property for details..SH "void QButton::stateChanged ( int state )\fC [signal]\fR"This signal is emitted whenever a toggle button changes status. \fIstate\fR is 2 if the button is on, 1 if it is in the" no change" state or 0 if the button is off..PPThis may be the result of a user action, toggle() slot activation, setState(), or because setOn() was called..PPSee also clicked()..SH "QString QButton::text () const"Returns the text shown on the button. See the "text" property for details..SH "void QButton::toggle ()\fC [slot]\fR"Toggles the state of a toggle button..PPSee also on, on, toggled() and toggleButton..SH "void QButton::toggled ( bool on )\fC [signal]\fR"This signal is emitted whenever a toggle button changes status. \fIon\fR is TRUE if the button is on, or FALSE if the button is off..PPThis may be the result of a user action, toggle() slot activation, or because setOn() was called..PPSee also clicked()..PPExample: listbox/listbox.cpp..SS "Property Documentation".SH "QKeySequence accel"This property holds the accelerator associated with the button..PPThis property is 0 if there is no accelerator set. If you set this property to 0 then any current accelerator is removed..PPSet this property's value with setAccel() and get this property's value with accel()..SH "bool autoDefault"This property holds whether the push button is the auto default button..PPIf this property is set to TRUE then the push button will be the focused item in a dialog when the dialog is first shown..PPSet this property's value with setAutoDefault() and get this property's value with autoDefault()..SH "bool autoMask"This property holds whether the button is automatically masked..PPSee also QWidget::autoMask..SH "bool autoRepeat"This property holds whether autoRepeat is enabled..PPIf autoRepeat is enabled then the clicked() signal is emitted at regular intervals if the button is down. This property has no effect on toggle buttons..PPSet this property's value with setAutoRepeat() and get this property's value with autoRepeat()..SH "bool default"This property holds whether the push button is the default button..PPIf this property is set to TRUE then the push button will be pressed if the user hits the Enter key in a dialog..PPSet this property's value with setDefault() and get this property's value with isDefault()..SH "bool flat"This property holds whether the border is disabled..PPSet this property's value with setFlat() and get this property's value with isFlat()..SH "QIconSet iconSet"This property holds the icon set on the push button..PPThis property will return 0 if the push button has no iconset.PPSet this property's value with setIconSet() and get this property's value with iconSet()..SH "bool menuButton"This property holds whether the push button has a menu button on it..PP\fBThis property is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPIf this property is set to TRUE, then a down arrow is drawn on the push button to indicate that a menu will pop up if the user clicks on the arrow..PPGet this property's value with isMenuButton()..SH "bool on"This property holds whether the push button is toggled..PPThis property should only be set for toggle push buttons..PPSee also on, toggle(), toggled() and toggleButton..PPSet this property's value with setOn()..SH "QPixmap pixmap"This property holds the pixmap shown on the button..PPIf the pixmap is monochrome (i.e., it is a QBitmap or its depth is 1) and it does not have a mask, this property will set the pixmap to be its own mask. The purpose of this is to draw transparent bitmaps which are important for toggle buttons, for example..PPpixmap() returns 0 if no pixmap was set..PPSet this property's value with setPixmap() and get this property's value with pixmap()..SH "QString text"This property holds the text shown on the button..PPThis property will return a null string if the button has no text. If the text has an ampersand ('&') in it, then an accelerator is automatically created for it using the character after the '&' as the accelerator key..PPSet this property's value with setText() and get this property's value with text()..SH "bool toggleButton"This property holds whether the button is a toggle button..PPToggle buttons have an on/off state similar to check boxes. A push button is initially not a toggle button..PPSee also on, toggle(), toggleButton and toggled()..PPSet this property's value with setToggleButton()..SH "SEE ALSO".BR http://doc.trolltech.com/qpushbutton.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 (qpushbutton.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -