source: trunk/doc/html/qbutton-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 7.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qbutton.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qbutton.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qbutton.h</h1>
33
34<p>This is the verbatim text of the qbutton.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: qbutton-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QButton widget class
41**
42** Created : 940206
43**
44** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
45**
46** This file is part of the widgets module of the Qt GUI Toolkit.
47**
48** This file may be distributed under the terms of the Q Public License
49** as defined by Trolltech ASA of Norway and appearing in the file
50** LICENSE.QPL included in the packaging of this file.
51**
52** This file may be distributed and/or modified under the terms of the
53** GNU General Public License version 2 as published by the Free Software
54** Foundation and appearing in the file LICENSE.GPL included in the
55** packaging of this file.
56**
57** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
58** licenses may use this file in accordance with the Qt Commercial License
59** Agreement provided with the Software.
60**
61** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
62** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63**
64** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
65** information about Qt Commercial License Agreements.
66** See http://www.trolltech.com/qpl/ for QPL licensing information.
67** See http://www.trolltech.com/gpl/ for GPL licensing information.
68**
69** Contact info@trolltech.com if any conditions of this licensing are
70** not clear to you.
71**
72**********************************************************************/
73
74#ifndef QBUTTON_H
75#define QBUTTON_H
76
77#ifndef QT_H
78#include "qwidget.h"
79#include "qkeysequence.h"
80#endif // QT_H
81
82#ifndef QT_NO_BUTTON
83
84
85class QButtonGroup;
86class QToolBar;
87class QButtonData;
88
89class Q_EXPORT QButton : public QWidget
90{
91 Q_OBJECT
92 Q_ENUMS( ToggleType ToggleState )
93 Q_PROPERTY( QString text READ text WRITE setText )
94 Q_PROPERTY( QPixmap pixmap READ pixmap WRITE setPixmap )
95 Q_PROPERTY( QKeySequence accel READ accel WRITE setAccel )
96 Q_PROPERTY( bool toggleButton READ isToggleButton )
97 Q_PROPERTY( ToggleType toggleType READ toggleType )
98 Q_PROPERTY( bool down READ isDown WRITE setDown DESIGNABLE false )
99 Q_PROPERTY( bool on READ isOn )
100 Q_PROPERTY( ToggleState toggleState READ state )
101 Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false )
102 Q_PROPERTY( bool autoRepeat READ autoRepeat WRITE setAutoRepeat )
103 Q_PROPERTY( bool exclusiveToggle READ isExclusiveToggle )
104
105public:
106 QButton( QWidget* parent=0, const char* name=0, WFlags f=0 );
107 ~QButton();
108
109 QString text() const;
110 virtual void setText( const QString &amp;);
111 const QPixmap *pixmap() const;
112 virtual void setPixmap( const QPixmap &amp; );
113
114#ifndef QT_NO_ACCEL
115 QKeySequence accel() const;
116 virtual void setAccel( const QKeySequence&amp; );
117#endif
118
119 bool isToggleButton() const;
120
121 enum ToggleType { SingleShot, Toggle, Tristate };
122 ToggleType toggleType() const;
123
124 virtual void setDown( bool );
125 bool isDown() const;
126
127 bool isOn() const;
128
129 enum ToggleState { Off, NoChange, On };
130 ToggleState state() const;
131
132#ifndef QT_NO_COMPAT
133 bool autoResize() const;
134 void setAutoResize( bool );
135#endif
136
137 bool autoRepeat() const;
138 virtual void setAutoRepeat( bool );
139 bool isExclusiveToggle() const;
140
141 QButtonGroup *group() const;
142
143public slots:
144 void animateClick();
145 void toggle();
146
147signals:
148 void pressed();
149 void released();
150 void clicked();
151 void toggled( bool );
152 void stateChanged( int );
153
154protected:
155 void setToggleButton( bool );
156 virtual void setToggleType( ToggleType );
157 void setOn( bool );
158 virtual void setState( ToggleState );
159
160 virtual bool hitButton( const QPoint &amp;pos ) const;
161 virtual void drawButton( QPainter * );
162 virtual void drawButtonLabel( QPainter * );
163
164 void keyPressEvent( QKeyEvent *);
165 void keyReleaseEvent( QKeyEvent *);
166 void mousePressEvent( QMouseEvent * );
167 void mouseReleaseEvent( QMouseEvent * );
168 void mouseMoveEvent( QMouseEvent * );
169 void paintEvent( QPaintEvent * );
170 void focusInEvent( QFocusEvent * );
171 void focusOutEvent( QFocusEvent * );
172
173 void enabledChange( bool );
174
175private slots:
176 void animateTimeout();
177 void autoRepeatTimeout();
178 void emulateClick();
179
180private:
181 QString btext;
182 QPixmap *bpixmap;
183 uint toggleTyp : 2;
184 uint buttonDown : 1;
185 uint stat : 2;
186 uint mlbDown : 1;
187 uint autoresize : 1;
188 uint animation : 1;
189 uint repeat : 1;
190 QButtonData *d;
191
192 friend class QButtonGroup;
193 friend class QToolBar;
194 void ensureData();
195 virtual void setGroup( QButtonGroup* );
196 QTimer *timer();
197 void nextState();
198
199private: // Disabled copy constructor and operator=
200#if defined(Q_DISABLE_COPY)
201 QButton( const QButton &amp; );
202 QButton &amp;operator=( const QButton &amp; );
203#endif
204};
205
206
207inline QString QButton::text() const
208{
209 return btext;
210}
211
212inline const QPixmap *QButton::pixmap() const
213{
214 return bpixmap;
215}
216
217inline bool QButton::isToggleButton() const
218{
219 return toggleTyp != SingleShot;
220}
221
222inline bool QButton::isDown() const
223{
224 return buttonDown;
225}
226
227inline bool QButton::isOn() const
228{
229 return stat != Off;
230}
231
232#ifndef QT_NO_COMPAT
233inline bool QButton::autoResize() const
234{
235 return autoresize;
236}
237#endif
238
239inline bool QButton::autoRepeat() const
240{
241 return repeat;
242}
243
244inline QButton::ToggleState QButton::state() const
245{
246 return ToggleState(stat);
247}
248
249inline void QButton::setToggleButton( bool b )
250{
251 setToggleType( b ? Toggle : SingleShot );
252}
253
254inline void QButton::setOn( bool y )
255{
256 setState( y ? On : Off );
257}
258
259inline QButton::ToggleType QButton::toggleType() const
260{
261 return ToggleType(toggleTyp);
262}
263
264
265#endif // QT_NO_BUTTON
266
267#endif // QBUTTON_H
268</pre>
269<!-- eof -->
270<p><address><hr><div align=center>
271<table width=100% cellspacing=0 border=0><tr>
272<td>Copyright &copy; 2007
273<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
274<td align=right><div align=right>Qt 3.3.8</div>
275</table></div></address></body>
276</html>
Note: See TracBrowser for help on using the repository browser.