⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qbutton.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QButton 3qt "9 December 2002" "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 NAMEQButton \- The abstract base class of button widgets, providing functionality common to buttons.SH SYNOPSIS\fC#include <qbutton.h>\fR.PPInherits QWidget..PPInherited by QCheckBox, QPushButton, QRadioButton, and QToolButton..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQButton\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )".br.ti -1c.BI "\fB~QButton\fR ()".br.ti -1c.BI "QString \fBtext\fR () const".br.ti -1c.BI "virtual void \fBsetText\fR ( const QString & )".br.ti -1c.BI "const QPixmap * \fBpixmap\fR () const".br.ti -1c.BI "virtual void \fBsetPixmap\fR ( const QPixmap & )".br.ti -1c.BI "QKeySequence \fBaccel\fR () const".br.ti -1c.BI "virtual void \fBsetAccel\fR ( const QKeySequence & )".br.ti -1c.BI "bool \fBisToggleButton\fR () const".br.ti -1c.BI "enum \fBToggleType\fR { SingleShot, Toggle, Tristate }".br.ti -1c.BI "ToggleType \fBtoggleType\fR () const".br.ti -1c.BI "virtual void \fBsetDown\fR ( bool )".br.ti -1c.BI "bool \fBisDown\fR () const".br.ti -1c.BI "bool \fBisOn\fR () const".br.ti -1c.BI "enum \fBToggleState\fR { Off, NoChange, On }".br.ti -1c.BI "ToggleState \fBstate\fR () const".br.ti -1c.BI "bool autoResize () const  \fI(obsolete)\fR".br.ti -1c.BI "void setAutoResize ( bool )  \fI(obsolete)\fR".br.ti -1c.BI "bool \fBautoRepeat\fR () const".br.ti -1c.BI "virtual void \fBsetAutoRepeat\fR ( bool )".br.ti -1c.BI "bool \fBisExclusiveToggle\fR () const".br.ti -1c.BI "QButtonGroup * \fBgroup\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "void \fBanimateClick\fR ()".br.ti -1c.BI "void \fBtoggle\fR ()".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBpressed\fR ()".br.ti -1c.BI "void \fBreleased\fR ()".br.ti -1c.BI "void \fBclicked\fR ()".br.ti -1c.BI "void \fBtoggled\fR ( bool on )".br.ti -1c.BI "void \fBstateChanged\fR ( int state )".br.in -1c.SS "Properties".in +1c.ti -1c.BI "QKeySequence \fBaccel\fR - the accelerator associated with the button".br.ti -1c.BI "bool \fBautoRepeat\fR - whether autoRepeat is enabled".br.ti -1c.BI "bool autoResize - whether autoResize is enabled  \fI(obsolete)\fR".br.ti -1c.BI "bool \fBdown\fR - whether the button is pressed".br.ti -1c.BI "bool \fBexclusiveToggle\fR - whether the button is an exclusive toggle  \fI(read " "only" ")\fR".br.ti -1c.BI "bool \fBon\fR - whether the button is toggled  \fI(read " "only" ")\fR".br.ti -1c.BI "QPixmap \fBpixmap\fR - the pixmap shown on the button".br.ti -1c.BI "QString \fBtext\fR - the text shown on the button".br.ti -1c.BI "bool \fBtoggleButton\fR - whether the button is a toggle button  \fI(read " "only" ")\fR".br.ti -1c.BI "ToggleState \fBtoggleState\fR - the state of the toggle button  \fI(read " "only" ")\fR".br.ti -1c.BI "ToggleType \fBtoggleType\fR - the type of toggle on the button  \fI(read " "only" ")\fR".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetToggleButton\fR ( bool b )".br.ti -1c.BI "virtual void \fBsetToggleType\fR ( ToggleType type )".br.ti -1c.BI "void \fBsetOn\fR ( bool on )".br.ti -1c.BI "virtual void \fBsetState\fR ( ToggleState s )".br.ti -1c.BI "virtual bool \fBhitButton\fR ( const QPoint & pos ) const".br.ti -1c.BI "virtual void \fBdrawButton\fR ( QPainter * )".br.ti -1c.BI "virtual void \fBdrawButtonLabel\fR ( QPainter * )".br.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * )".br.in -1c.SH DESCRIPTIONThe QButton class is the abstract base class of button widgets, providing functionality common to buttons..PP\fBIf you want to create a button use QPushButton.\fR.PPThe QButton class implements an \fIabstract\fR button, and lets subclasses specify how to reply to user actions and how to draw the button..PPQButton provides both push and toggle buttons. The QRadioButton and QCheckBox classes provide only toggle buttons; QPushButton and QToolButton provide both toggle and push buttons..PPAny button can have either a text or pixmap label. setText() sets the button to be a text button and setPixmap() sets it to be a pixmap button. The text/pixmap is manipulated as necessary to create the "disabled" appearance when the button is disabled..PPQButton provides most of the states used for buttons:.TPisDown() indicates whether the button is \fIpressed\fR down..TPisOn() indicates whether the button is \fIon\fR. Only toggle buttons can be switched on and off (see below)..TPisEnabled() indicates whether the button can be pressed by the user..TPsetAutoRepeat() sets whether the button will auto-repeat if the user holds it down..TPsetToggleButton() sets whether the button is a toggle button or not..PPThe difference between isDown() and isOn() is as follows: When the user clicks a toggle button to toggle it on, the button is first \fIpressed\fR and then released into the \fIon\fR state. When the user clicks it again (to toggle it off), the button moves first to the \fIpressed\fR state, then to the \fIoff\fR state (isOn() and isDown() are both FALSE)..PPDefault buttons (as used in many dialogs) are provided by QPushButton::setDefault() and QPushButton::setAutoDefault()..PPQButton provides five signals: <ol type=1>.TPpressed() is emitted when the left mouse button is pressed while the mouse cursor is inside the button..TPreleased() is emitted when the left mouse button is released..TPclicked() is emitted when the button is first pressed and then released when the accelerator key is typed, or when animateClick() is called..TPtoggled(bool) is emitted when the state of a toggle button changes..TPstateChanged(int) is emitted when the state of a tristate toggle button changes..PPIf the button is a text button with an ampersand (&) in its text, QButton creates an automatic accelerator key. This code creates a push button labelled "Ro<u>c</u>k & Roll" (where the c is underlined). The button gets an automatic accelerator key, Alt+C:.PP.nf.br        QPushButton *p = new QPushButton( "Ro&ck && Roll", this );.br.fi.PPIn this example, when the user presses Alt+C the button will call animateClick()..PPYou can also set a custom accelerator using the setAccel() function. This is useful mostly for pixmap buttons because they have no automatic accelerator..PP.nf.br        p->setPixmap( QPixmap("print.png") );.br        p->setAccel( ALT+Key_F7 );.br.fi.PPAll of the buttons provided by Qt (QPushButton, QToolButton, QCheckBox and QRadioButton) can display both text and pixmaps..PPTo subclass QButton, you must reimplement at least drawButton() (to draw the button's outline) and drawButtonLabel() (to draw its text or pixmap). It is generally advisable to reimplement sizeHint() as well, and sometimes hitButton() (to determine whether a button press is within the button)..PPTo reduce flickering, QButton::paintEvent() sets up a pixmap that the drawButton() function draws in. You should not reimplement paintEvent() for a subclass of QButton unless you want to take over all drawing..PPSee also QButtonGroup and Abstract Widget Classes..SS "Member Type Documentation".SH "QButton::ToggleState"This enum defines the state of a toggle button.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -