📄 qbutton.3qt
字号:
.PPSee also: setAccel()..SH "void QButton::animateClick () \fC[slot]\fR"Performs an animated click: The button is pressed and a short while later released..PPpressed(), released(), clicked(), toggled(), and stateChanged() signals are emitted as appropriate..PPThis function does nothing if the button is disabled..PPSee also: setAccel()..SH "bool QButton::autoRepeat () const"Returns TRUE if the button is auto-repeating, else FALSE..PPThe default is FALSE..PPSee also: setAutoRepeat()..SH "bool QButton::autoResize () const"Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is disabled..PPAuto-resizing is disabled by default..PPSee also: setAutoResize()..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)..PPSee also: pressed(), released() and toggled()..SH "void QButton::drawButton ( QPainter * ) \fC[virtual protected]\fR"Draws the button. The default implementation does nothing..PPThis virtual function is reimplemented by subclasses to draw real buttons..PPReimplemented in QRadioButton, QCheckBox, QToolButton and QPushButton..SH "void QButton::drawButtonLabel ( QPainter * ) \fC[virtual protected]\fR"Draws the button text or pixmap..PPThis virtual function is reimplemented by subclasses to draw real buttons..PPReimplemented in QToolButton, QCheckBox, QRadioButton and QPushButton..SH "void QButton::enabledChange ( bool e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QButton::focusInEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Handles focus in events for the button..PPSee also: focusOutEvent()..PPReimplemented from QWidget..SH "bool QButton::focusNextPrevChild ( bool next ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QButton::focusOutEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Handles focus out events for the button..PPSee also: focusInEvent()..PPReimplemented from QWidget..SH "bool QButton::hitButton ( const QPoint & pos ) const \fC[virtual protected]\fR"Returns TRUE if \fIpos\fR is inside the widget rectangle, or FALSE if it is outside..PPThis virtual function is reimplemented by subclasses..PPReimplemented in QRadioButton..SH "bool QButton::isDown () const"Returns TRUE if the button pressed down, or FALSE if it is standing up..PPSee also: setDown()..SH "bool QButton::isExclusiveToggle () const"Returns TRUE if this button behaves exclusively inside a QButtonGroup. In that case, this button can only be toggled off by another buton beinhg toggled on..SH "bool QButton::isOn () const"Returns TRUE if this toggle button is switched on, or FALSE if it is switched off..PPSee also: setOn() and toggleButton()..PPExamples:.(lqmag/qmag.cpp.)l.SH "bool QButton::isToggleButton () const"Returns TRUE if the button is a toggle button..PPSee also: setToggleButton()..SH "void QButton::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Handles keyboard events for the button..PPSpace calls animateClick(), the arrow keys cause focus changes..PPReimplemented from QWidget..SH "void QButton::mouseMoveEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Handles mouse move events for the button..PPSee also: mousePressEvent() and mouseReleaseEvent()..PPReimplemented from QWidget..SH "void QButton::mousePressEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Handles mouse press events for the button..PPSee also: mouseReleaseEvent()..PPReimplemented from QWidget..SH "void QButton::mouseReleaseEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Handles mouse release events for the button..PPSee also: mousePressEvent()..PPReimplemented from QWidget..SH "void QButton::paintEvent ( QPaintEvent * event ) \fC[virtual protected]\fR"Handles paint events for the button..PPOpens the painter on the button and calls drawButton()..PPReimplemented from QWidget..SH "const QPixmap * QButton::pixmap () const"Returns the button pixmap, or 0 if the button has no pixmap..SH "void QButton::pressed () \fC[signal]\fR"This signal is emitted when the button is pressed down..PPSee also: released() and clicked()..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 ( int key ) \fC[virtual]\fR"Specifies an accelerator \fIkey\fR for the button, or removes the accelerator if \fIkey\fR is 0..PPSetting a button text containing a shortcut character (for example the 'x' in E&xit) automatically defines an ALT+letter accelerator for the button. You only need to call this function in order to specify a custom accelerator..PPExample:.PP.nf.br QPushButton *b1 = new QPushButton;.br b1->setText( "&OK" ); // sets accel ALT+'O'.br.br QPushButton *b2 = new QPushButton;.br b2->setPixmap( printIcon ); // pixmap instead of text.br b2->setAccel( CTRL+'P' ); // custom accel.fi.PPSee also: accel(), setText() and QAccel..SH "void QButton::setAutoRepeat ( bool enable ) \fC[virtual]\fR"Turns on auto-repeat for the button if \fIenable\fR is TRUE, or turns it off if \fIenable\fR is FALSE..PPWhen auto-repeat is enabled, the clicked() signal is emitted at regular intervals while the buttons is down..PPsetAutoRepeat() has no effect for toggle buttons..PPSee also: isDown(), autoRepeat() and clicked()..SH "void QButton::setAutoResize ( bool enable ) \fC[virtual]\fR"Enables auto-resizing if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPWhen auto-resizing is enabled, the button will resize itself whenever the contents change..PPSee also: autoResize() and adjustSize()..SH "void QButton::setDown ( bool enable ) \fC[virtual]\fR"Sets the state of the button to pressed down if \fIenable\fR is TRUE or to standing up if \fIenable\fR is FALSE..PPIf the button is a toggle button, it is \fInot\fR toggled. Call toggle() as well if you need to do that. The pressed() and released() signals are not emitted by this function..PPThis method is provided in case you need to override the mouse event handlers..PPSee also: isDown(), setOn(), toggle() and toggled()..SH "void QButton::setOn ( bool enable ) \fC[protected]\fR"Switches a toggle button on if \fIenable\fR is TRUE or off if \fIenable\fR is FALSE. This function should be called only for toggle buttons..PPSee also: isOn() and toggleButton()..SH "void QButton::setPixmap ( const QPixmap & pixmap ) \fC[virtual]\fR"Sets the button to display \fIpixmap\fR and repaints at once..PPIf \fIpixmap\fR is monochrome (i.e. it is a QBitmap or its depth is 1) and it does not have a mask, this function sets the pixmap to be its own mask. The purpose of this is to draw transparent bitmaps, which is important for e.g. toggle buttons..PPThe button resizes itself if auto-resizing is enabled, changes its minimum size if autoMinimumSize() is enabled, and always disables any accelerator..PPSee also: pixmap(), setText(), setAutoMinimumSize(), setAutoResize(), setAccel() and QPixmap::mask()..SH "void QButton::setState ( ToggleState ) \fC[virtual protected]\fR"Protected function to set the button state into one of the three states:.TP\fCQButton::Off\fR - isOn() is FALSE.TP\fCQButton::On\fR - isOn() is TRUE.TP\fCQButton::NoChange\fR - the button is in the NoChanged state..PPSee also: setToggleType()..SH "void QButton::setText ( const QString & text ) \fC[virtual]\fR"Sets the button to display \fItext\fR and repaints.PPThe button resizes itself if auto-resizing is enabled, changes its minimum size if autoMinimumSize() is enabled, and sets the appropriate accelerator..PPSee also: text(), setPixmap(), setAutoMinimumSize(), setAutoResize(), setAccel() and QPixmap::mask()..PPExamples:.(lxform/xform.cpp layout/layout.cpp qmag/qmag.cpp.)l.SH "void QButton::setToggleButton ( bool enable ) \fC[protected]\fR"Makes the button a toggle button if \fIenable\fR is TRUE, or a normal button if \fIenable\fR is FALSE..PPNote that this function is protected. It is called from subclasses to enable the toggle functionality. QCheckBox and QRadioButton are toggle buttons. QPushButton is initially not a toggle button, but QPushButton::setToggleButton() can be called to create toggle buttons..PPSee also: isToggleButton()..SH "void QButton::setToggleType ( ToggleType type ) \fC[virtual protected]\fR"Sets the type of toggling behavior. \fItype\fR is one of:.TP\fCSingleShot\fR - pressing the button causes an action, then the button returns to the unpressed state..TP\fCToggle\fR - pressing the button toggles between an On and and Off state..TP\fCTristate\fR - pressing the button cycles between three states - On, Off, and NoChanged..PPSubclasses use this, and present it with a more comfortable interface..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 button text, or null string if the button has no text..PPSee also: setText()..SH "void QButton::toggle () \fC[slot]\fR"if this is a toggle button, toggles it..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()..SH "SEE ALSO".BR http://www.troll.no/qt/qbutton.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -