author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QWIDGET_H |
|
43 |
#define QWIDGET_H |
|
44 |
||
45 |
#include <QtGui/qwindowdefs.h> |
|
46 |
#include <QtCore/qobject.h> |
|
47 |
#include <QtCore/qmargins.h> |
|
48 |
#include <QtGui/qpaintdevice.h> |
|
49 |
#include <QtGui/qpalette.h> |
|
50 |
#include <QtGui/qfont.h> |
|
51 |
#include <QtGui/qfontmetrics.h> |
|
52 |
#include <QtGui/qfontinfo.h> |
|
53 |
#include <QtGui/qsizepolicy.h> |
|
54 |
#include <QtGui/qregion.h> |
|
55 |
#include <QtGui/qbrush.h> |
|
56 |
#include <QtGui/qcursor.h> |
|
57 |
#include <QtGui/qkeysequence.h> |
|
58 |
||
59 |
#ifdef QT_INCLUDE_COMPAT |
|
60 |
#include <QtGui/qevent.h> |
|
61 |
#endif |
|
62 |
||
63 |
QT_BEGIN_HEADER |
|
64 |
||
65 |
QT_BEGIN_NAMESPACE |
|
66 |
||
67 |
QT_MODULE(Gui) |
|
68 |
||
69 |
class QLayout; |
|
70 |
class QWSRegionManager; |
|
71 |
class QStyle; |
|
72 |
class QAction; |
|
73 |
class QVariant; |
|
74 |
||
75 |
class QActionEvent; |
|
76 |
class QMouseEvent; |
|
77 |
class QWheelEvent; |
|
78 |
class QHoverEvent; |
|
79 |
class QKeyEvent; |
|
80 |
class QFocusEvent; |
|
81 |
class QPaintEvent; |
|
82 |
class QMoveEvent; |
|
83 |
class QResizeEvent; |
|
84 |
class QCloseEvent; |
|
85 |
class QContextMenuEvent; |
|
86 |
class QInputMethodEvent; |
|
87 |
class QTabletEvent; |
|
88 |
class QDragEnterEvent; |
|
89 |
class QDragMoveEvent; |
|
90 |
class QDragLeaveEvent; |
|
91 |
class QDropEvent; |
|
92 |
class QShowEvent; |
|
93 |
class QHideEvent; |
|
94 |
class QInputContext; |
|
95 |
class QIcon; |
|
96 |
class QWindowSurface; |
|
97 |
class QLocale; |
|
98 |
class QGraphicsProxyWidget; |
|
99 |
class QGraphicsEffect; |
|
100 |
#if defined(Q_WS_X11) |
|
101 |
class QX11Info; |
|
102 |
#endif |
|
103 |
||
104 |
class QWidgetData |
|
105 |
{ |
|
106 |
public: |
|
107 |
WId winid; |
|
108 |
uint widget_attributes; |
|
109 |
Qt::WindowFlags window_flags; |
|
110 |
uint window_state : 4; |
|
111 |
uint focus_policy : 4; |
|
112 |
uint sizehint_forced :1; |
|
113 |
uint is_closing :1; |
|
114 |
uint in_show : 1; |
|
115 |
uint in_set_window_state : 1; |
|
116 |
mutable uint fstrut_dirty : 1; |
|
117 |
uint context_menu_policy : 3; |
|
118 |
uint window_modality : 2; |
|
119 |
uint in_destructor : 1; |
|
120 |
uint unused : 13; |
|
121 |
QRect crect; |
|
122 |
mutable QPalette pal; |
|
123 |
QFont fnt; |
|
124 |
#if defined(Q_WS_QWS) |
|
125 |
// QRegion req_region; // Requested region |
|
126 |
// mutable QRegion paintable_region; // Paintable region |
|
127 |
// mutable bool paintable_region_dirty;// needs to be recalculated |
|
128 |
// mutable QRegion alloc_region; // Allocated region |
|
129 |
// mutable bool alloc_region_dirty; // needs to be recalculated |
|
130 |
// mutable int overlapping_children; // Handle overlapping children |
|
131 |
||
132 |
int alloc_region_index; |
|
133 |
// int alloc_region_revision; |
|
134 |
#endif |
|
135 |
QRect wrect; |
|
136 |
}; |
|
137 |
||
138 |
class QWidgetPrivate; |
|
139 |
||
140 |
class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice |
|
141 |
{ |
|
142 |
Q_OBJECT |
|
143 |
Q_DECLARE_PRIVATE(QWidget) |
|
144 |
||
145 |
Q_PROPERTY(bool modal READ isModal) |
|
146 |
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality) |
|
147 |
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) |
|
148 |
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) |
|
149 |
Q_PROPERTY(QRect frameGeometry READ frameGeometry) |
|
150 |
Q_PROPERTY(QRect normalGeometry READ normalGeometry) |
|
151 |
Q_PROPERTY(int x READ x) |
|
152 |
Q_PROPERTY(int y READ y) |
|
153 |
Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false) |
|
154 |
Q_PROPERTY(QSize frameSize READ frameSize) |
|
155 |
Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false) |
|
156 |
Q_PROPERTY(int width READ width) |
|
157 |
Q_PROPERTY(int height READ height) |
|
158 |
Q_PROPERTY(QRect rect READ rect) |
|
159 |
Q_PROPERTY(QRect childrenRect READ childrenRect) |
|
160 |
Q_PROPERTY(QRegion childrenRegion READ childrenRegion) |
|
161 |
Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) |
|
162 |
Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) |
|
163 |
Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) |
|
164 |
Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false) |
|
165 |
Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false) |
|
166 |
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false) |
|
167 |
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false) |
|
168 |
Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement) |
|
169 |
Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize) |
|
170 |
Q_PROPERTY(QPalette palette READ palette WRITE setPalette) |
|
171 |
Q_PROPERTY(QFont font READ font WRITE setFont) |
|
172 |
#ifndef QT_NO_CURSOR |
|
173 |
Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) |
|
174 |
#endif |
|
175 |
Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking) |
|
176 |
Q_PROPERTY(bool isActiveWindow READ isActiveWindow) |
|
177 |
Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) |
|
178 |
Q_PROPERTY(bool focus READ hasFocus) |
|
179 |
Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy) |
|
180 |
Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false) |
|
181 |
Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false) |
|
182 |
Q_PROPERTY(bool minimized READ isMinimized) |
|
183 |
Q_PROPERTY(bool maximized READ isMaximized) |
|
184 |
Q_PROPERTY(bool fullScreen READ isFullScreen) |
|
185 |
Q_PROPERTY(QSize sizeHint READ sizeHint) |
|
186 |
Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint) |
|
187 |
Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops) |
|
188 |
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow) |
|
189 |
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow) |
|
190 |
Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow) |
|
191 |
Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow) |
|
192 |
Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow) |
|
193 |
#ifndef QT_NO_TOOLTIP |
|
194 |
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) |
|
195 |
#endif |
|
196 |
#ifndef QT_NO_STATUSTIP |
|
197 |
Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) |
|
198 |
#endif |
|
199 |
#ifndef QT_NO_WHATSTHIS |
|
200 |
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) |
|
201 |
#endif |
|
202 |
#ifndef QT_NO_ACCESSIBILITY |
|
203 |
Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName) |
|
204 |
Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription) |
|
205 |
#endif |
|
206 |
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) |
|
207 |
QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) |
|
208 |
Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) |
|
209 |
#ifndef QT_NO_STYLE_STYLESHEET |
|
210 |
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) |
|
211 |
#endif |
|
212 |
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale) |
|
213 |
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow) |
|
214 |
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) |
|
215 |
||
216 |
public: |
|
217 |
enum RenderFlag { |
|
218 |
DrawWindowBackground = 0x1, |
|
219 |
DrawChildren = 0x2, |
|
220 |
IgnoreMask = 0x4 |
|
221 |
}; |
|
222 |
Q_DECLARE_FLAGS(RenderFlags, RenderFlag) |
|
223 |
||
224 |
explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); |
|
225 |
#ifdef QT3_SUPPORT |
|
226 |
QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0); |
|
227 |
#endif |
|
228 |
~QWidget(); |
|
229 |
||
230 |
int devType() const; |
|
231 |
||
232 |
WId winId() const; |
|
233 |
void createWinId(); // internal, going away |
|
234 |
inline WId internalWinId() const { return data->winid; } |
|
235 |
WId effectiveWinId() const; |
|
236 |
||
237 |
// GUI style setting |
|
238 |
QStyle *style() const; |
|
239 |
void setStyle(QStyle *); |
|
240 |
// Widget types and states |
|
241 |
||
242 |
bool isTopLevel() const; |
|
243 |
bool isWindow() const; |
|
244 |
||
245 |
bool isModal() const; |
|
246 |
Qt::WindowModality windowModality() const; |
|
247 |
void setWindowModality(Qt::WindowModality windowModality); |
|
248 |
||
249 |
bool isEnabled() const; |
|
250 |
bool isEnabledTo(QWidget*) const; |
|
251 |
bool isEnabledToTLW() const; |
|
252 |
||
253 |
public Q_SLOTS: |
|
254 |
void setEnabled(bool); |
|
255 |
void setDisabled(bool); |
|
256 |
void setWindowModified(bool); |
|
257 |
||
258 |
// Widget coordinates |
|
259 |
||
260 |
public: |
|
261 |
QRect frameGeometry() const; |
|
262 |
const QRect &geometry() const; |
|
263 |
QRect normalGeometry() const; |
|
264 |
||
265 |
int x() const; |
|
266 |
int y() const; |
|
267 |
QPoint pos() const; |
|
268 |
QSize frameSize() const; |
|
269 |
QSize size() const; |
|
270 |
inline int width() const; |
|
271 |
inline int height() const; |
|
272 |
inline QRect rect() const; |
|
273 |
QRect childrenRect() const; |
|
274 |
QRegion childrenRegion() const; |
|
275 |
||
276 |
QSize minimumSize() const; |
|
277 |
QSize maximumSize() const; |
|
278 |
int minimumWidth() const; |
|
279 |
int minimumHeight() const; |
|
280 |
int maximumWidth() const; |
|
281 |
int maximumHeight() const; |
|
282 |
void setMinimumSize(const QSize &); |
|
283 |
void setMinimumSize(int minw, int minh); |
|
284 |
void setMaximumSize(const QSize &); |
|
285 |
void setMaximumSize(int maxw, int maxh); |
|
286 |
void setMinimumWidth(int minw); |
|
287 |
void setMinimumHeight(int minh); |
|
288 |
void setMaximumWidth(int maxw); |
|
289 |
void setMaximumHeight(int maxh); |
|
290 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
291 |
#ifdef Q_QDOC |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
292 |
void setupUi(QWidget *widget); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
293 |
#endif |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
294 |
|
0 | 295 |
QSize sizeIncrement() const; |
296 |
void setSizeIncrement(const QSize &); |
|
297 |
void setSizeIncrement(int w, int h); |
|
298 |
QSize baseSize() const; |
|
299 |
void setBaseSize(const QSize &); |
|
300 |
void setBaseSize(int basew, int baseh); |
|
301 |
||
302 |
void setFixedSize(const QSize &); |
|
303 |
void setFixedSize(int w, int h); |
|
304 |
void setFixedWidth(int w); |
|
305 |
void setFixedHeight(int h); |
|
306 |
||
307 |
// Widget coordinate mapping |
|
308 |
||
309 |
QPoint mapToGlobal(const QPoint &) const; |
|
310 |
QPoint mapFromGlobal(const QPoint &) const; |
|
311 |
QPoint mapToParent(const QPoint &) const; |
|
312 |
QPoint mapFromParent(const QPoint &) const; |
|
313 |
QPoint mapTo(QWidget *, const QPoint &) const; |
|
314 |
QPoint mapFrom(QWidget *, const QPoint &) const; |
|
315 |
||
316 |
QWidget *window() const; |
|
317 |
QWidget *nativeParentWidget() const; |
|
318 |
inline QWidget *topLevelWidget() const { return window(); } |
|
319 |
||
320 |
// Widget appearance functions |
|
321 |
const QPalette &palette() const; |
|
322 |
void setPalette(const QPalette &); |
|
323 |
||
324 |
void setBackgroundRole(QPalette::ColorRole); |
|
325 |
QPalette::ColorRole backgroundRole() const; |
|
326 |
||
327 |
void setForegroundRole(QPalette::ColorRole); |
|
328 |
QPalette::ColorRole foregroundRole() const; |
|
329 |
||
330 |
const QFont &font() const; |
|
331 |
void setFont(const QFont &); |
|
332 |
QFontMetrics fontMetrics() const; |
|
333 |
QFontInfo fontInfo() const; |
|
334 |
||
335 |
#ifndef QT_NO_CURSOR |
|
336 |
QCursor cursor() const; |
|
337 |
void setCursor(const QCursor &); |
|
338 |
void unsetCursor(); |
|
339 |
#endif |
|
340 |
||
341 |
void setMouseTracking(bool enable); |
|
342 |
bool hasMouseTracking() const; |
|
343 |
bool underMouse() const; |
|
344 |
||
345 |
void setMask(const QBitmap &); |
|
346 |
void setMask(const QRegion &); |
|
347 |
QRegion mask() const; |
|
348 |
void clearMask(); |
|
349 |
||
350 |
void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(), |
|
351 |
const QRegion &sourceRegion = QRegion(), |
|
352 |
RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); |
|
353 |
||
354 |
void render(QPainter *painter, const QPoint &targetOffset = QPoint(), |
|
355 |
const QRegion &sourceRegion = QRegion(), |
|
356 |
RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); |
|
357 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 359 |
QGraphicsEffect *graphicsEffect() const; |
360 |
void setGraphicsEffect(QGraphicsEffect *effect); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 362 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
363 |
#ifndef QT_NO_GESTURES |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
364 |
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
void ungrabGesture(Qt::GestureType type); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
366 |
#endif |
0 | 367 |
|
368 |
public Q_SLOTS: |
|
369 |
void setWindowTitle(const QString &); |
|
370 |
#ifndef QT_NO_STYLE_STYLESHEET |
|
371 |
void setStyleSheet(const QString& styleSheet); |
|
372 |
#endif |
|
373 |
public: |
|
374 |
#ifndef QT_NO_STYLE_STYLESHEET |
|
375 |
QString styleSheet() const; |
|
376 |
#endif |
|
377 |
QString windowTitle() const; |
|
378 |
void setWindowIcon(const QIcon &icon); |
|
379 |
QIcon windowIcon() const; |
|
380 |
void setWindowIconText(const QString &); |
|
381 |
QString windowIconText() const; |
|
382 |
void setWindowRole(const QString &); |
|
383 |
QString windowRole() const; |
|
384 |
void setWindowFilePath(const QString &filePath); |
|
385 |
QString windowFilePath() const; |
|
386 |
||
387 |
void setWindowOpacity(qreal level); |
|
388 |
qreal windowOpacity() const; |
|
389 |
||
390 |
bool isWindowModified() const; |
|
391 |
#ifndef QT_NO_TOOLTIP |
|
392 |
void setToolTip(const QString &); |
|
393 |
QString toolTip() const; |
|
394 |
#endif |
|
395 |
#ifndef QT_NO_STATUSTIP |
|
396 |
void setStatusTip(const QString &); |
|
397 |
QString statusTip() const; |
|
398 |
#endif |
|
399 |
#ifndef QT_NO_WHATSTHIS |
|
400 |
void setWhatsThis(const QString &); |
|
401 |
QString whatsThis() const; |
|
402 |
#endif |
|
403 |
#ifndef QT_NO_ACCESSIBILITY |
|
404 |
QString accessibleName() const; |
|
405 |
void setAccessibleName(const QString &name); |
|
406 |
QString accessibleDescription() const; |
|
407 |
void setAccessibleDescription(const QString &description); |
|
408 |
#endif |
|
409 |
||
410 |
void setLayoutDirection(Qt::LayoutDirection direction); |
|
411 |
Qt::LayoutDirection layoutDirection() const; |
|
412 |
void unsetLayoutDirection(); |
|
413 |
||
414 |
void setLocale(const QLocale &locale); |
|
415 |
QLocale locale() const; |
|
416 |
void unsetLocale(); |
|
417 |
||
418 |
inline bool isRightToLeft() const { return layoutDirection() == Qt::RightToLeft; } |
|
419 |
inline bool isLeftToRight() const { return layoutDirection() == Qt::LeftToRight; } |
|
420 |
||
421 |
public Q_SLOTS: |
|
422 |
inline void setFocus() { setFocus(Qt::OtherFocusReason); } |
|
423 |
||
424 |
public: |
|
425 |
bool isActiveWindow() const; |
|
426 |
void activateWindow(); |
|
427 |
void clearFocus(); |
|
428 |
||
429 |
void setFocus(Qt::FocusReason reason); |
|
430 |
Qt::FocusPolicy focusPolicy() const; |
|
431 |
void setFocusPolicy(Qt::FocusPolicy policy); |
|
432 |
bool hasFocus() const; |
|
433 |
static void setTabOrder(QWidget *, QWidget *); |
|
434 |
void setFocusProxy(QWidget *); |
|
435 |
QWidget *focusProxy() const; |
|
436 |
Qt::ContextMenuPolicy contextMenuPolicy() const; |
|
437 |
void setContextMenuPolicy(Qt::ContextMenuPolicy policy); |
|
438 |
||
439 |
// Grab functions |
|
440 |
void grabMouse(); |
|
441 |
#ifndef QT_NO_CURSOR |
|
442 |
void grabMouse(const QCursor &); |
|
443 |
#endif |
|
444 |
void releaseMouse(); |
|
445 |
void grabKeyboard(); |
|
446 |
void releaseKeyboard(); |
|
447 |
#ifndef QT_NO_SHORTCUT |
|
448 |
int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut); |
|
449 |
void releaseShortcut(int id); |
|
450 |
void setShortcutEnabled(int id, bool enable = true); |
|
451 |
void setShortcutAutoRepeat(int id, bool enable = true); |
|
452 |
#endif |
|
453 |
static QWidget *mouseGrabber(); |
|
454 |
static QWidget *keyboardGrabber(); |
|
455 |
||
456 |
// Update/refresh functions |
|
457 |
inline bool updatesEnabled() const; |
|
458 |
void setUpdatesEnabled(bool enable); |
|
459 |
||
460 |
#if 0 //def Q_WS_QWS |
|
461 |
void repaintUnclipped(const QRegion &, bool erase = true); |
|
462 |
#endif |
|
463 |
||
464 |
#ifndef QT_NO_GRAPHICSVIEW |
|
465 |
QGraphicsProxyWidget *graphicsProxyWidget() const; |
|
466 |
#endif |
|
467 |
||
468 |
public Q_SLOTS: |
|
469 |
void update(); |
|
470 |
void repaint(); |
|
471 |
||
472 |
public: |
|
473 |
inline void update(int x, int y, int w, int h); |
|
474 |
void update(const QRect&); |
|
475 |
void update(const QRegion&); |
|
476 |
||
477 |
void repaint(int x, int y, int w, int h); |
|
478 |
void repaint(const QRect &); |
|
479 |
void repaint(const QRegion &); |
|
480 |
||
481 |
public Q_SLOTS: |
|
482 |
// Widget management functions |
|
483 |
||
484 |
virtual void setVisible(bool visible); |
|
485 |
inline void setHidden(bool hidden) { setVisible(!hidden); } |
|
486 |
#ifndef Q_WS_WINCE |
|
487 |
inline void show() { setVisible(true); } |
|
488 |
#else |
|
489 |
void show(); |
|
490 |
#endif |
|
491 |
inline void hide() { setVisible(false); } |
|
492 |
inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); } |
|
493 |
||
494 |
void showMinimized(); |
|
495 |
void showMaximized(); |
|
496 |
void showFullScreen(); |
|
497 |
void showNormal(); |
|
498 |
||
499 |
bool close(); |
|
500 |
void raise(); |
|
501 |
void lower(); |
|
502 |
||
503 |
public: |
|
504 |
void stackUnder(QWidget*); |
|
505 |
void move(int x, int y); |
|
506 |
void move(const QPoint &); |
|
507 |
void resize(int w, int h); |
|
508 |
void resize(const QSize &); |
|
509 |
inline void setGeometry(int x, int y, int w, int h); |
|
510 |
void setGeometry(const QRect &); |
|
511 |
QByteArray saveGeometry() const; |
|
512 |
bool restoreGeometry(const QByteArray &geometry); |
|
513 |
void adjustSize(); |
|
514 |
bool isVisible() const; |
|
515 |
bool isVisibleTo(QWidget*) const; |
|
516 |
// ### Qt 5: bool isVisibleTo(_const_ QWidget *) const |
|
517 |
inline bool isHidden() const; |
|
518 |
||
519 |
bool isMinimized() const; |
|
520 |
bool isMaximized() const; |
|
521 |
bool isFullScreen() const; |
|
522 |
||
523 |
Qt::WindowStates windowState() const; |
|
524 |
void setWindowState(Qt::WindowStates state); |
|
525 |
void overrideWindowState(Qt::WindowStates state); |
|
526 |
||
527 |
virtual QSize sizeHint() const; |
|
528 |
virtual QSize minimumSizeHint() const; |
|
529 |
||
530 |
QSizePolicy sizePolicy() const; |
|
531 |
void setSizePolicy(QSizePolicy); |
|
532 |
inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical); |
|
533 |
virtual int heightForWidth(int) const; |
|
534 |
||
535 |
QRegion visibleRegion() const; |
|
536 |
||
537 |
void setContentsMargins(int left, int top, int right, int bottom); |
|
538 |
void setContentsMargins(const QMargins &margins); |
|
539 |
void getContentsMargins(int *left, int *top, int *right, int *bottom) const; |
|
540 |
QMargins contentsMargins() const; |
|
541 |
||
542 |
QRect contentsRect() const; |
|
543 |
||
544 |
public: |
|
545 |
QLayout *layout() const; |
|
546 |
void setLayout(QLayout *); |
|
547 |
void updateGeometry(); |
|
548 |
||
549 |
void setParent(QWidget *parent); |
|
550 |
void setParent(QWidget *parent, Qt::WindowFlags f); |
|
551 |
||
552 |
void scroll(int dx, int dy); |
|
553 |
void scroll(int dx, int dy, const QRect&); |
|
554 |
||
555 |
// Misc. functions |
|
556 |
||
557 |
QWidget *focusWidget() const; |
|
558 |
QWidget *nextInFocusChain() const; |
|
559 |
QWidget *previousInFocusChain() const; |
|
560 |
||
561 |
// drag and drop |
|
562 |
bool acceptDrops() const; |
|
563 |
void setAcceptDrops(bool on); |
|
564 |
||
565 |
#ifndef QT_NO_ACTION |
|
566 |
//actions |
|
567 |
void addAction(QAction *action); |
|
568 |
void addActions(QList<QAction*> actions); |
|
569 |
void insertAction(QAction *before, QAction *action); |
|
570 |
void insertActions(QAction *before, QList<QAction*> actions); |
|
571 |
void removeAction(QAction *action); |
|
572 |
QList<QAction*> actions() const; |
|
573 |
#endif |
|
574 |
||
575 |
QWidget *parentWidget() const; |
|
576 |
||
577 |
void setWindowFlags(Qt::WindowFlags type); |
|
578 |
inline Qt::WindowFlags windowFlags() const; |
|
579 |
void overrideWindowFlags(Qt::WindowFlags type); |
|
580 |
||
581 |
inline Qt::WindowType windowType() const; |
|
582 |
||
583 |
static QWidget *find(WId); |
|
584 |
#ifdef QT3_SUPPORT |
|
585 |
static QT3_SUPPORT QWidgetMapper *wmapper(); |
|
586 |
#endif |
|
587 |
inline QWidget *childAt(int x, int y) const; |
|
588 |
QWidget *childAt(const QPoint &p) const; |
|
589 |
||
590 |
#if defined(Q_WS_X11) |
|
591 |
const QX11Info &x11Info() const; |
|
592 |
Qt::HANDLE x11PictureHandle() const; |
|
593 |
#endif |
|
594 |
||
595 |
#if defined(Q_WS_MAC) |
|
596 |
Qt::HANDLE macQDHandle() const; |
|
597 |
Qt::HANDLE macCGHandle() const; |
|
598 |
#endif |
|
599 |
||
600 |
#if defined(Q_WS_WIN) |
|
601 |
HDC getDC() const; |
|
602 |
void releaseDC(HDC) const; |
|
603 |
#else |
|
604 |
Qt::HANDLE handle() const; |
|
605 |
#endif |
|
606 |
||
607 |
void setAttribute(Qt::WidgetAttribute, bool on = true); |
|
608 |
inline bool testAttribute(Qt::WidgetAttribute) const; |
|
609 |
||
610 |
QPaintEngine *paintEngine() const; |
|
611 |
||
612 |
void ensurePolished() const; |
|
613 |
||
614 |
QInputContext *inputContext(); |
|
615 |
void setInputContext(QInputContext *); |
|
616 |
||
617 |
bool isAncestorOf(const QWidget *child) const; |
|
618 |
||
619 |
#ifdef QT_KEYPAD_NAVIGATION |
|
620 |
bool hasEditFocus() const; |
|
621 |
void setEditFocus(bool on); |
|
622 |
#endif |
|
623 |
||
624 |
bool autoFillBackground() const; |
|
625 |
void setAutoFillBackground(bool enabled); |
|
626 |
||
627 |
void setWindowSurface(QWindowSurface *surface); |
|
628 |
QWindowSurface *windowSurface() const; |
|
629 |
||
630 |
Q_SIGNALS: |
|
631 |
void customContextMenuRequested(const QPoint &pos); |
|
632 |
||
633 |
protected: |
|
634 |
// Event handlers |
|
635 |
bool event(QEvent *); |
|
636 |
virtual void mousePressEvent(QMouseEvent *); |
|
637 |
virtual void mouseReleaseEvent(QMouseEvent *); |
|
638 |
virtual void mouseDoubleClickEvent(QMouseEvent *); |
|
639 |
virtual void mouseMoveEvent(QMouseEvent *); |
|
640 |
#ifndef QT_NO_WHEELEVENT |
|
641 |
virtual void wheelEvent(QWheelEvent *); |
|
642 |
#endif |
|
643 |
virtual void keyPressEvent(QKeyEvent *); |
|
644 |
virtual void keyReleaseEvent(QKeyEvent *); |
|
645 |
virtual void focusInEvent(QFocusEvent *); |
|
646 |
virtual void focusOutEvent(QFocusEvent *); |
|
647 |
virtual void enterEvent(QEvent *); |
|
648 |
virtual void leaveEvent(QEvent *); |
|
649 |
virtual void paintEvent(QPaintEvent *); |
|
650 |
virtual void moveEvent(QMoveEvent *); |
|
651 |
virtual void resizeEvent(QResizeEvent *); |
|
652 |
virtual void closeEvent(QCloseEvent *); |
|
653 |
#ifndef QT_NO_CONTEXTMENU |
|
654 |
virtual void contextMenuEvent(QContextMenuEvent *); |
|
655 |
#endif |
|
656 |
#ifndef QT_NO_TABLETEVENT |
|
657 |
virtual void tabletEvent(QTabletEvent *); |
|
658 |
#endif |
|
659 |
#ifndef QT_NO_ACTION |
|
660 |
virtual void actionEvent(QActionEvent *); |
|
661 |
#endif |
|
662 |
||
663 |
#ifndef QT_NO_DRAGANDDROP |
|
664 |
virtual void dragEnterEvent(QDragEnterEvent *); |
|
665 |
virtual void dragMoveEvent(QDragMoveEvent *); |
|
666 |
virtual void dragLeaveEvent(QDragLeaveEvent *); |
|
667 |
virtual void dropEvent(QDropEvent *); |
|
668 |
#endif |
|
669 |
||
670 |
virtual void showEvent(QShowEvent *); |
|
671 |
virtual void hideEvent(QHideEvent *); |
|
672 |
||
673 |
#if defined(Q_WS_MAC) |
|
674 |
virtual bool macEvent(EventHandlerCallRef, EventRef); |
|
675 |
#endif |
|
676 |
#if defined(Q_WS_WIN) |
|
677 |
virtual bool winEvent(MSG *message, long *result); |
|
678 |
#endif |
|
679 |
#if defined(Q_WS_X11) |
|
680 |
virtual bool x11Event(XEvent *); |
|
681 |
#endif |
|
682 |
#if defined(Q_WS_QWS) |
|
683 |
virtual bool qwsEvent(QWSEvent *); |
|
684 |
#endif |
|
685 |
||
686 |
// Misc. protected functions |
|
687 |
virtual void changeEvent(QEvent *); |
|
688 |
||
689 |
int metric(PaintDeviceMetric) const; |
|
690 |
||
691 |
virtual void inputMethodEvent(QInputMethodEvent *); |
|
692 |
public: |
|
693 |
virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; |
|
694 |
||
695 |
Qt::InputMethodHints inputMethodHints() const; |
|
696 |
void setInputMethodHints(Qt::InputMethodHints hints); |
|
697 |
||
698 |
protected: |
|
699 |
void resetInputContext(); |
|
700 |
protected Q_SLOTS: |
|
701 |
void updateMicroFocus(); |
|
702 |
protected: |
|
703 |
||
704 |
void create(WId = 0, bool initializeWindow = true, |
|
705 |
bool destroyOldWindow = true); |
|
706 |
void destroy(bool destroyWindow = true, |
|
707 |
bool destroySubWindows = true); |
|
708 |
||
709 |
virtual bool focusNextPrevChild(bool next); |
|
710 |
inline bool focusNextChild() { return focusNextPrevChild(true); } |
|
711 |
inline bool focusPreviousChild() { return focusNextPrevChild(false); } |
|
712 |
||
713 |
protected: |
|
714 |
QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f); |
|
715 |
private: |
|
716 |
||
717 |
bool testAttribute_helper(Qt::WidgetAttribute) const; |
|
718 |
||
719 |
QLayout *takeLayout(); |
|
720 |
||
721 |
friend class QBackingStoreDevice; |
|
722 |
friend class QWidgetBackingStore; |
|
723 |
friend class QApplication; |
|
724 |
friend class QApplicationPrivate; |
|
725 |
friend class QBaseApplication; |
|
726 |
friend class QPainter; |
|
727 |
friend class QPainterPrivate; |
|
728 |
friend class QPixmap; // for QPixmap::fill() |
|
729 |
friend class QFontMetrics; |
|
730 |
friend class QFontInfo; |
|
731 |
friend class QETWidget; |
|
732 |
friend class QLayout; |
|
733 |
friend class QWidgetItem; |
|
734 |
friend class QWidgetItemV2; |
|
735 |
friend class QGLContext; |
|
736 |
friend class QGLWidget; |
|
737 |
friend class QGLWindowSurface; |
|
738 |
friend class QX11PaintEngine; |
|
739 |
friend class QWin32PaintEngine; |
|
740 |
friend class QShortcutPrivate; |
|
741 |
friend class QShortcutMap; |
|
742 |
friend class QWindowSurface; |
|
743 |
friend class QGraphicsProxyWidget; |
|
744 |
friend class QGraphicsProxyWidgetPrivate; |
|
745 |
friend class QStyleSheetStyle; |
|
746 |
friend struct QWidgetExceptionCleaner; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
747 |
#ifndef QT_NO_GESTURES |
0 | 748 |
friend class QGestureManager; |
749 |
friend class QWinNativePanGestureRecognizer; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
750 |
#endif // QT_NO_GESTURES |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
751 |
friend class QWidgetEffectSourcePrivate; |
0 | 752 |
|
753 |
#ifdef Q_WS_MAC |
|
754 |
friend class QCoreGraphicsPaintEnginePrivate; |
|
755 |
friend QPoint qt_mac_posInWindow(const QWidget *w); |
|
756 |
friend OSWindowRef qt_mac_window_for(const QWidget *w); |
|
757 |
friend bool qt_mac_is_metal(const QWidget *w); |
|
758 |
friend OSViewRef qt_mac_nativeview_for(const QWidget *w); |
|
759 |
friend void qt_event_request_window_change(QWidget *widget); |
|
760 |
friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref); |
|
761 |
#endif |
|
762 |
#ifdef Q_WS_QWS |
|
763 |
friend class QWSBackingStore; |
|
764 |
friend class QWSManager; |
|
765 |
friend class QWSManagerPrivate; |
|
766 |
friend class QDecoration; |
|
767 |
friend class QWSWindowSurface; |
|
768 |
friend class QScreen; |
|
769 |
friend class QVNCScreen; |
|
770 |
friend bool isWidgetOpaque(const QWidget *); |
|
771 |
friend class QGLWidgetPrivate; |
|
772 |
#endif |
|
773 |
#ifdef Q_OS_SYMBIAN |
|
774 |
friend class QSymbianControl; |
|
775 |
friend class QS60WindowSurface; |
|
776 |
#endif |
|
777 |
#ifdef Q_WS_X11 |
|
778 |
friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); |
|
779 |
friend void qt_net_remove_user_time(QWidget *tlw); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
780 |
friend void qt_set_winid_on_widget(QWidget*, Qt::HANDLE); |
0 | 781 |
#endif |
782 |
||
783 |
friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); |
|
784 |
friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); |
|
785 |
||
786 |
private: |
|
787 |
Q_DISABLE_COPY(QWidget) |
|
788 |
Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) |
|
789 |
#ifdef Q_OS_SYMBIAN |
|
790 |
Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId)) |
|
791 |
#endif |
|
792 |
||
793 |
QWidgetData *data; |
|
794 |
||
795 |
#ifdef QT3_SUPPORT |
|
796 |
public: |
|
797 |
inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); } |
|
798 |
QT3_SUPPORT QStyle *setStyle(const QString&); |
|
799 |
inline QT3_SUPPORT bool isVisibleToTLW() const; |
|
800 |
QT3_SUPPORT QRect visibleRect() const; |
|
801 |
inline QT3_SUPPORT void iconify() { showMinimized(); } |
|
802 |
inline QT3_SUPPORT void constPolish() const { ensurePolished(); } |
|
803 |
inline QT3_SUPPORT void polish() { ensurePolished(); } |
|
804 |
inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false) |
|
805 |
{ setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } |
|
806 |
inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false) |
|
807 |
{ setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } |
|
808 |
inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false) |
|
809 |
{ setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } |
|
810 |
inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw) |
|
811 |
{ QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);} |
|
812 |
inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); } |
|
813 |
#ifndef QT_NO_CURSOR |
|
814 |
inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); } |
|
815 |
#endif |
|
816 |
inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); } |
|
817 |
inline QT3_SUPPORT void unsetFont() { setFont(QFont()); } |
|
818 |
inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); } |
|
819 |
inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); } |
|
820 |
Qt::BackgroundMode QT3_SUPPORT backgroundMode() const; |
|
821 |
void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground); |
|
822 |
const QT3_SUPPORT QColor &eraseColor() const; |
|
823 |
void QT3_SUPPORT setEraseColor(const QColor &); |
|
824 |
const QT3_SUPPORT QColor &foregroundColor() const; |
|
825 |
const QT3_SUPPORT QPixmap *erasePixmap() const; |
|
826 |
void QT3_SUPPORT setErasePixmap(const QPixmap &); |
|
827 |
const QT3_SUPPORT QColor &paletteForegroundColor() const; |
|
828 |
void QT3_SUPPORT setPaletteForegroundColor(const QColor &); |
|
829 |
const QT3_SUPPORT QColor &paletteBackgroundColor() const; |
|
830 |
void QT3_SUPPORT setPaletteBackgroundColor(const QColor &); |
|
831 |
const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const; |
|
832 |
void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &); |
|
833 |
const QT3_SUPPORT QBrush& backgroundBrush() const; |
|
834 |
const QT3_SUPPORT QColor &backgroundColor() const; |
|
835 |
const QT3_SUPPORT QPixmap *backgroundPixmap() const; |
|
836 |
void QT3_SUPPORT setBackgroundPixmap(const QPixmap &); |
|
837 |
QT3_SUPPORT void setBackgroundColor(const QColor &); |
|
838 |
QT3_SUPPORT QColorGroup colorGroup() const; |
|
839 |
QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const; |
|
840 |
inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); } |
|
841 |
inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); } |
|
842 |
inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); } |
|
843 |
enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin }; |
|
844 |
inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {} |
|
845 |
inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; } |
|
846 |
inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); } |
|
847 |
inline QT3_SUPPORT void repaint(bool) { repaint(); } |
|
848 |
inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); } |
|
849 |
inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); } |
|
850 |
inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); } |
|
851 |
QT3_SUPPORT void erase(); |
|
852 |
inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); } |
|
853 |
QT3_SUPPORT void erase(const QRect &); |
|
854 |
QT3_SUPPORT void erase(const QRegion &); |
|
855 |
QT3_SUPPORT void drawText(const QPoint &p, const QString &s) |
|
856 |
{ drawText_helper(p.x(), p.y(), s); } |
|
857 |
inline QT3_SUPPORT void drawText(int x, int y, const QString &s) |
|
858 |
{ drawText_helper(x, y, s); } |
|
859 |
QT3_SUPPORT bool close(bool); |
|
860 |
inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const |
|
861 |
{ |
|
862 |
QWidget *w = childAt(x, y); |
|
863 |
return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0); |
|
864 |
} |
|
865 |
inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const |
|
866 |
{ |
|
867 |
QWidget *w = childAt(p); |
|
868 |
return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0); |
|
869 |
} |
|
870 |
inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); } |
|
871 |
QT3_SUPPORT void setIcon(const QPixmap &i); |
|
872 |
inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); } |
|
873 |
inline QT3_SUPPORT QString caption() const { return windowTitle(); } |
|
874 |
QT3_SUPPORT const QPixmap *icon() const; |
|
875 |
inline QT3_SUPPORT QString iconText() const { return windowIconText(); } |
|
876 |
inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); } |
|
877 |
inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); } |
|
878 |
inline QT3_SUPPORT void setActiveWindow() { activateWindow(); } |
|
879 |
inline QT3_SUPPORT bool isShown() const { return !isHidden(); } |
|
880 |
inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; } |
|
881 |
inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; } |
|
882 |
inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; } |
|
883 |
||
884 |
||
885 |
private: |
|
886 |
void drawText_helper(int x, int y, const QString &); |
|
887 |
void erase_helper(int x, int y, int w, int h); |
|
888 |
#endif // QT3_SUPPORT |
|
889 |
||
890 |
protected: |
|
891 |
virtual void styleChange(QStyle&); // compat |
|
892 |
virtual void enabledChange(bool); // compat |
|
893 |
virtual void paletteChange(const QPalette &); // compat |
|
894 |
virtual void fontChange(const QFont &); // compat |
|
895 |
virtual void windowActivationChange(bool); // compat |
|
896 |
virtual void languageChange(); // compat |
|
897 |
}; |
|
898 |
||
899 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags) |
|
900 |
||
901 |
#if defined Q_CC_MSVC && _MSC_VER < 1300 |
|
902 |
template <> inline QWidget *qobject_cast_helper<QWidget*>(QObject *o, QWidget *) |
|
903 |
{ |
|
904 |
if (!o || !o->isWidgetType()) return 0; |
|
905 |
return (QWidget*)(o); |
|
906 |
} |
|
907 |
#else |
|
908 |
template <> inline QWidget *qobject_cast<QWidget*>(QObject *o) |
|
909 |
{ |
|
910 |
if (!o || !o->isWidgetType()) return 0; |
|
911 |
return static_cast<QWidget*>(o); |
|
912 |
} |
|
913 |
template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o) |
|
914 |
{ |
|
915 |
if (!o || !o->isWidgetType()) return 0; |
|
916 |
return static_cast<const QWidget*>(o); |
|
917 |
} |
|
918 |
#endif |
|
919 |
||
920 |
inline QWidget *QWidget::childAt(int ax, int ay) const |
|
921 |
{ return childAt(QPoint(ax, ay)); } |
|
922 |
||
923 |
inline Qt::WindowType QWidget::windowType() const |
|
924 |
{ return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); } |
|
925 |
inline Qt::WindowFlags QWidget::windowFlags() const |
|
926 |
{ return data->window_flags; } |
|
927 |
||
928 |
inline bool QWidget::isTopLevel() const |
|
929 |
{ return (windowType() & Qt::Window); } |
|
930 |
||
931 |
inline bool QWidget::isWindow() const |
|
932 |
{ return (windowType() & Qt::Window); } |
|
933 |
||
934 |
inline bool QWidget::isEnabled() const |
|
935 |
{ return !testAttribute(Qt::WA_Disabled); } |
|
936 |
||
937 |
inline bool QWidget::isModal() const |
|
938 |
{ return data->window_modality != Qt::NonModal; } |
|
939 |
||
940 |
inline bool QWidget::isEnabledToTLW() const |
|
941 |
{ return isEnabled(); } |
|
942 |
||
943 |
inline int QWidget::minimumWidth() const |
|
944 |
{ return minimumSize().width(); } |
|
945 |
||
946 |
inline int QWidget::minimumHeight() const |
|
947 |
{ return minimumSize().height(); } |
|
948 |
||
949 |
inline int QWidget::maximumWidth() const |
|
950 |
{ return maximumSize().width(); } |
|
951 |
||
952 |
inline int QWidget::maximumHeight() const |
|
953 |
{ return maximumSize().height(); } |
|
954 |
||
955 |
inline void QWidget::setMinimumSize(const QSize &s) |
|
956 |
{ setMinimumSize(s.width(),s.height()); } |
|
957 |
||
958 |
inline void QWidget::setMaximumSize(const QSize &s) |
|
959 |
{ setMaximumSize(s.width(),s.height()); } |
|
960 |
||
961 |
inline void QWidget::setSizeIncrement(const QSize &s) |
|
962 |
{ setSizeIncrement(s.width(),s.height()); } |
|
963 |
||
964 |
inline void QWidget::setBaseSize(const QSize &s) |
|
965 |
{ setBaseSize(s.width(),s.height()); } |
|
966 |
||
967 |
inline const QFont &QWidget::font() const |
|
968 |
{ return data->fnt; } |
|
969 |
||
970 |
inline QFontMetrics QWidget::fontMetrics() const |
|
971 |
{ return QFontMetrics(data->fnt); } |
|
972 |
||
973 |
inline QFontInfo QWidget::fontInfo() const |
|
974 |
{ return QFontInfo(data->fnt); } |
|
975 |
||
976 |
inline void QWidget::setMouseTracking(bool enable) |
|
977 |
{ setAttribute(Qt::WA_MouseTracking, enable); } |
|
978 |
||
979 |
inline bool QWidget::hasMouseTracking() const |
|
980 |
{ return testAttribute(Qt::WA_MouseTracking); } |
|
981 |
||
982 |
inline bool QWidget::underMouse() const |
|
983 |
{ return testAttribute(Qt::WA_UnderMouse); } |
|
984 |
||
985 |
inline bool QWidget::updatesEnabled() const |
|
986 |
{ return !testAttribute(Qt::WA_UpdatesDisabled); } |
|
987 |
||
988 |
inline void QWidget::update(int ax, int ay, int aw, int ah) |
|
989 |
{ update(QRect(ax, ay, aw, ah)); } |
|
990 |
||
991 |
inline bool QWidget::isVisible() const |
|
992 |
{ return testAttribute(Qt::WA_WState_Visible); } |
|
993 |
||
994 |
inline bool QWidget::isHidden() const |
|
995 |
{ return testAttribute(Qt::WA_WState_Hidden); } |
|
996 |
||
997 |
inline void QWidget::move(int ax, int ay) |
|
998 |
{ move(QPoint(ax, ay)); } |
|
999 |
||
1000 |
inline void QWidget::resize(int w, int h) |
|
1001 |
{ resize(QSize(w, h)); } |
|
1002 |
||
1003 |
inline void QWidget::setGeometry(int ax, int ay, int aw, int ah) |
|
1004 |
{ setGeometry(QRect(ax, ay, aw, ah)); } |
|
1005 |
||
1006 |
inline QRect QWidget::rect() const |
|
1007 |
{ return QRect(0,0,data->crect.width(),data->crect.height()); } |
|
1008 |
||
1009 |
inline const QRect &QWidget::geometry() const |
|
1010 |
{ return data->crect; } |
|
1011 |
||
1012 |
inline QSize QWidget::size() const |
|
1013 |
{ return data->crect.size(); } |
|
1014 |
||
1015 |
inline int QWidget::width() const |
|
1016 |
{ return data->crect.width(); } |
|
1017 |
||
1018 |
inline int QWidget::height() const |
|
1019 |
{ return data->crect.height(); } |
|
1020 |
||
1021 |
inline QWidget *QWidget::parentWidget() const |
|
1022 |
{ return static_cast<QWidget *>(QObject::parent()); } |
|
1023 |
||
1024 |
inline void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) |
|
1025 |
{ setSizePolicy(QSizePolicy(hor, ver)); } |
|
1026 |
||
1027 |
inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const |
|
1028 |
{ |
|
1029 |
if (attribute < int(8*sizeof(uint))) |
|
1030 |
return data->widget_attributes & (1<<attribute); |
|
1031 |
return testAttribute_helper(attribute); |
|
1032 |
} |
|
1033 |
||
1034 |
#ifdef QT3_SUPPORT |
|
1035 |
inline bool QWidget::isVisibleToTLW() const |
|
1036 |
{ return isVisible(); } |
|
1037 |
inline QWidget *QWidget::parentWidget(bool sameWindow) const |
|
1038 |
{ |
|
1039 |
if (sameWindow && isWindow()) |
|
1040 |
return 0; |
|
1041 |
return static_cast<QWidget *>(QObject::parent()); |
|
1042 |
} |
|
1043 |
inline QColorGroup QWidget::colorGroup() const |
|
1044 |
{ return QColorGroup(palette()); } |
|
1045 |
inline void QWidget::setPaletteForegroundColor(const QColor &c) |
|
1046 |
{ QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); } |
|
1047 |
inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); } |
|
1048 |
inline void QWidget::setBackgroundPixmap(const QPixmap &pm) |
|
1049 |
{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } |
|
1050 |
inline const QPixmap *QWidget::backgroundPixmap() const { return 0; } |
|
1051 |
inline void QWidget::setBackgroundColor(const QColor &c) |
|
1052 |
{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } |
|
1053 |
inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); } |
|
1054 |
inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());} |
|
1055 |
inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); } |
|
1056 |
inline void QWidget::setEraseColor(const QColor &c) |
|
1057 |
{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } |
|
1058 |
inline const QPixmap *QWidget::erasePixmap() const { return 0; } |
|
1059 |
inline void QWidget::setErasePixmap(const QPixmap &pm) |
|
1060 |
{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } |
|
1061 |
inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());} |
|
1062 |
inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); } |
|
1063 |
inline void QWidget::setPaletteBackgroundColor(const QColor &c) |
|
1064 |
{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } |
|
1065 |
inline const QPixmap *QWidget::paletteBackgroundPixmap() const |
|
1066 |
{ return 0; } |
|
1067 |
inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm) |
|
1068 |
{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } |
|
1069 |
inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); } |
|
1070 |
inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); } |
|
1071 |
#endif |
|
1072 |
||
1073 |
#define QWIDGETSIZE_MAX ((1<<24)-1) |
|
1074 |
||
1075 |
QT_END_NAMESPACE |
|
1076 |
||
1077 |
QT_END_HEADER |
|
1078 |
||
1079 |
#endif // QWIDGET_H |