[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 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 | **
|
---|
[561] | 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.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at qt-info@nokia.com.
|
---|
[2] | 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>
|
---|
[561] | 47 | #include <QtCore/qmargins.h>
|
---|
[2] | 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;
|
---|
[561] | 99 | class QGraphicsEffect;
|
---|
[2] | 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)
|
---|
[561] | 214 | Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
|
---|
[2] | 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 |
|
---|
[561] | 291 | #ifdef Q_QDOC
|
---|
| 292 | void setupUi(QWidget *widget);
|
---|
| 293 | #endif
|
---|
| 294 |
|
---|
[2] | 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 |
|
---|
[561] | 358 | #ifndef QT_NO_GRAPHICSEFFECT
|
---|
| 359 | QGraphicsEffect *graphicsEffect() const;
|
---|
| 360 | void setGraphicsEffect(QGraphicsEffect *effect);
|
---|
| 361 | #endif //QT_NO_GRAPHICSEFFECT
|
---|
| 362 |
|
---|
[846] | 363 | #ifndef QT_NO_GESTURES
|
---|
[561] | 364 | void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
|
---|
| 365 | void ungrabGesture(Qt::GestureType type);
|
---|
[846] | 366 | #endif
|
---|
[561] | 367 |
|
---|
[2] | 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); }
|
---|
[561] | 486 | #ifndef Q_WS_WINCE
|
---|
[2] | 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);
|
---|
[561] | 538 | void setContentsMargins(const QMargins &margins);
|
---|
[2] | 539 | void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
|
---|
[561] | 540 | QMargins contentsMargins() const;
|
---|
| 541 |
|
---|
[2] | 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;
|
---|
[561] | 559 | QWidget *previousInFocusChain() const;
|
---|
[2] | 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;
|
---|
[115] | 603 | #elif defined(Q_WS_PM)
|
---|
[352] | 604 | WId internalFrameWinId() const;
|
---|
| 605 | WId effectiveFrameWinId() const;
|
---|
[115] | 606 | HPS getPS() const;
|
---|
| 607 | void releasePS(HPS) const;
|
---|
[705] | 608 |
|
---|
| 609 | struct PmEventFilter {
|
---|
| 610 | virtual bool pmEventFilter(QMSG *message, MRESULT *result) = 0;
|
---|
| 611 | };
|
---|
| 612 | void addPmEventFilter(PmEventFilter *filter);
|
---|
| 613 | void removePmEventFilter(PmEventFilter *filter);
|
---|
[2] | 614 | #else
|
---|
| 615 | Qt::HANDLE handle() const;
|
---|
| 616 | #endif
|
---|
| 617 |
|
---|
| 618 | void setAttribute(Qt::WidgetAttribute, bool on = true);
|
---|
| 619 | inline bool testAttribute(Qt::WidgetAttribute) const;
|
---|
| 620 |
|
---|
| 621 | QPaintEngine *paintEngine() const;
|
---|
| 622 |
|
---|
| 623 | void ensurePolished() const;
|
---|
| 624 |
|
---|
| 625 | QInputContext *inputContext();
|
---|
| 626 | void setInputContext(QInputContext *);
|
---|
| 627 |
|
---|
| 628 | bool isAncestorOf(const QWidget *child) const;
|
---|
| 629 |
|
---|
| 630 | #ifdef QT_KEYPAD_NAVIGATION
|
---|
| 631 | bool hasEditFocus() const;
|
---|
| 632 | void setEditFocus(bool on);
|
---|
| 633 | #endif
|
---|
| 634 |
|
---|
| 635 | bool autoFillBackground() const;
|
---|
| 636 | void setAutoFillBackground(bool enabled);
|
---|
| 637 |
|
---|
| 638 | void setWindowSurface(QWindowSurface *surface);
|
---|
| 639 | QWindowSurface *windowSurface() const;
|
---|
| 640 |
|
---|
| 641 | Q_SIGNALS:
|
---|
| 642 | void customContextMenuRequested(const QPoint &pos);
|
---|
| 643 |
|
---|
| 644 | protected:
|
---|
| 645 | // Event handlers
|
---|
| 646 | bool event(QEvent *);
|
---|
| 647 | virtual void mousePressEvent(QMouseEvent *);
|
---|
| 648 | virtual void mouseReleaseEvent(QMouseEvent *);
|
---|
| 649 | virtual void mouseDoubleClickEvent(QMouseEvent *);
|
---|
| 650 | virtual void mouseMoveEvent(QMouseEvent *);
|
---|
| 651 | #ifndef QT_NO_WHEELEVENT
|
---|
| 652 | virtual void wheelEvent(QWheelEvent *);
|
---|
| 653 | #endif
|
---|
| 654 | virtual void keyPressEvent(QKeyEvent *);
|
---|
| 655 | virtual void keyReleaseEvent(QKeyEvent *);
|
---|
| 656 | virtual void focusInEvent(QFocusEvent *);
|
---|
| 657 | virtual void focusOutEvent(QFocusEvent *);
|
---|
| 658 | virtual void enterEvent(QEvent *);
|
---|
| 659 | virtual void leaveEvent(QEvent *);
|
---|
| 660 | virtual void paintEvent(QPaintEvent *);
|
---|
| 661 | virtual void moveEvent(QMoveEvent *);
|
---|
| 662 | virtual void resizeEvent(QResizeEvent *);
|
---|
| 663 | virtual void closeEvent(QCloseEvent *);
|
---|
| 664 | #ifndef QT_NO_CONTEXTMENU
|
---|
| 665 | virtual void contextMenuEvent(QContextMenuEvent *);
|
---|
| 666 | #endif
|
---|
| 667 | #ifndef QT_NO_TABLETEVENT
|
---|
| 668 | virtual void tabletEvent(QTabletEvent *);
|
---|
| 669 | #endif
|
---|
| 670 | #ifndef QT_NO_ACTION
|
---|
| 671 | virtual void actionEvent(QActionEvent *);
|
---|
| 672 | #endif
|
---|
| 673 |
|
---|
| 674 | #ifndef QT_NO_DRAGANDDROP
|
---|
| 675 | virtual void dragEnterEvent(QDragEnterEvent *);
|
---|
| 676 | virtual void dragMoveEvent(QDragMoveEvent *);
|
---|
| 677 | virtual void dragLeaveEvent(QDragLeaveEvent *);
|
---|
| 678 | virtual void dropEvent(QDropEvent *);
|
---|
| 679 | #endif
|
---|
| 680 |
|
---|
| 681 | virtual void showEvent(QShowEvent *);
|
---|
| 682 | virtual void hideEvent(QHideEvent *);
|
---|
| 683 |
|
---|
| 684 | #if defined(Q_WS_MAC)
|
---|
| 685 | virtual bool macEvent(EventHandlerCallRef, EventRef);
|
---|
| 686 | #endif
|
---|
| 687 | #if defined(Q_WS_WIN)
|
---|
| 688 | virtual bool winEvent(MSG *message, long *result);
|
---|
| 689 | #endif
|
---|
[92] | 690 | #if defined(Q_WS_PM)
|
---|
| 691 | virtual bool pmEvent(QMSG *message, MRESULT *result);
|
---|
| 692 | #endif
|
---|
[2] | 693 | #if defined(Q_WS_X11)
|
---|
| 694 | virtual bool x11Event(XEvent *);
|
---|
| 695 | #endif
|
---|
| 696 | #if defined(Q_WS_QWS)
|
---|
| 697 | virtual bool qwsEvent(QWSEvent *);
|
---|
| 698 | #endif
|
---|
| 699 |
|
---|
| 700 | // Misc. protected functions
|
---|
| 701 | virtual void changeEvent(QEvent *);
|
---|
| 702 |
|
---|
| 703 | int metric(PaintDeviceMetric) const;
|
---|
| 704 |
|
---|
| 705 | virtual void inputMethodEvent(QInputMethodEvent *);
|
---|
| 706 | public:
|
---|
| 707 | virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const;
|
---|
[561] | 708 |
|
---|
| 709 | Qt::InputMethodHints inputMethodHints() const;
|
---|
| 710 | void setInputMethodHints(Qt::InputMethodHints hints);
|
---|
| 711 |
|
---|
[2] | 712 | protected:
|
---|
| 713 | void resetInputContext();
|
---|
| 714 | protected Q_SLOTS:
|
---|
| 715 | void updateMicroFocus();
|
---|
| 716 | protected:
|
---|
| 717 |
|
---|
| 718 | void create(WId = 0, bool initializeWindow = true,
|
---|
| 719 | bool destroyOldWindow = true);
|
---|
| 720 | void destroy(bool destroyWindow = true,
|
---|
| 721 | bool destroySubWindows = true);
|
---|
| 722 |
|
---|
| 723 | virtual bool focusNextPrevChild(bool next);
|
---|
| 724 | inline bool focusNextChild() { return focusNextPrevChild(true); }
|
---|
| 725 | inline bool focusPreviousChild() { return focusNextPrevChild(false); }
|
---|
| 726 |
|
---|
| 727 | protected:
|
---|
| 728 | QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f);
|
---|
| 729 | private:
|
---|
| 730 |
|
---|
| 731 | bool testAttribute_helper(Qt::WidgetAttribute) const;
|
---|
| 732 |
|
---|
| 733 | QLayout *takeLayout();
|
---|
| 734 |
|
---|
| 735 | friend class QBackingStoreDevice;
|
---|
| 736 | friend class QWidgetBackingStore;
|
---|
| 737 | friend class QApplication;
|
---|
| 738 | friend class QApplicationPrivate;
|
---|
| 739 | friend class QBaseApplication;
|
---|
| 740 | friend class QPainter;
|
---|
| 741 | friend class QPainterPrivate;
|
---|
| 742 | friend class QPixmap; // for QPixmap::fill()
|
---|
| 743 | friend class QFontMetrics;
|
---|
| 744 | friend class QFontInfo;
|
---|
| 745 | friend class QETWidget;
|
---|
| 746 | friend class QLayout;
|
---|
| 747 | friend class QWidgetItem;
|
---|
| 748 | friend class QWidgetItemV2;
|
---|
| 749 | friend class QGLContext;
|
---|
| 750 | friend class QGLWidget;
|
---|
| 751 | friend class QGLWindowSurface;
|
---|
| 752 | friend class QX11PaintEngine;
|
---|
| 753 | friend class QWin32PaintEngine;
|
---|
| 754 | friend class QShortcutPrivate;
|
---|
| 755 | friend class QShortcutMap;
|
---|
| 756 | friend class QWindowSurface;
|
---|
| 757 | friend class QGraphicsProxyWidget;
|
---|
| 758 | friend class QGraphicsProxyWidgetPrivate;
|
---|
| 759 | friend class QStyleSheetStyle;
|
---|
[561] | 760 | friend struct QWidgetExceptionCleaner;
|
---|
[846] | 761 | #ifndef QT_NO_GESTURES
|
---|
[561] | 762 | friend class QGestureManager;
|
---|
| 763 | friend class QWinNativePanGestureRecognizer;
|
---|
[846] | 764 | #endif // QT_NO_GESTURES
|
---|
[561] | 765 | friend class QWidgetEffectSourcePrivate;
|
---|
[2] | 766 |
|
---|
| 767 | #ifdef Q_WS_MAC
|
---|
| 768 | friend class QCoreGraphicsPaintEnginePrivate;
|
---|
| 769 | friend QPoint qt_mac_posInWindow(const QWidget *w);
|
---|
| 770 | friend OSWindowRef qt_mac_window_for(const QWidget *w);
|
---|
| 771 | friend bool qt_mac_is_metal(const QWidget *w);
|
---|
| 772 | friend OSViewRef qt_mac_nativeview_for(const QWidget *w);
|
---|
| 773 | friend void qt_event_request_window_change(QWidget *widget);
|
---|
| 774 | friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref);
|
---|
| 775 | #endif
|
---|
| 776 | #ifdef Q_WS_QWS
|
---|
| 777 | friend class QWSBackingStore;
|
---|
| 778 | friend class QWSManager;
|
---|
| 779 | friend class QWSManagerPrivate;
|
---|
| 780 | friend class QDecoration;
|
---|
| 781 | friend class QWSWindowSurface;
|
---|
| 782 | friend class QScreen;
|
---|
| 783 | friend class QVNCScreen;
|
---|
| 784 | friend bool isWidgetOpaque(const QWidget *);
|
---|
| 785 | friend class QGLWidgetPrivate;
|
---|
| 786 | #endif
|
---|
[561] | 787 | #ifdef Q_OS_SYMBIAN
|
---|
| 788 | friend class QSymbianControl;
|
---|
| 789 | friend class QS60WindowSurface;
|
---|
| 790 | #endif
|
---|
[2] | 791 | #ifdef Q_WS_X11
|
---|
| 792 | friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
|
---|
| 793 | friend void qt_net_remove_user_time(QWidget *tlw);
|
---|
[846] | 794 | friend void qt_set_winid_on_widget(QWidget*, Qt::HANDLE);
|
---|
[2] | 795 | #endif
|
---|
| 796 |
|
---|
| 797 | friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget);
|
---|
| 798 | friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget);
|
---|
| 799 |
|
---|
| 800 | private:
|
---|
| 801 | Q_DISABLE_COPY(QWidget)
|
---|
| 802 | Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
|
---|
[561] | 803 | #ifdef Q_OS_SYMBIAN
|
---|
| 804 | Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId))
|
---|
| 805 | #endif
|
---|
[2] | 806 |
|
---|
| 807 | QWidgetData *data;
|
---|
| 808 |
|
---|
| 809 | #ifdef QT3_SUPPORT
|
---|
| 810 | public:
|
---|
| 811 | inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); }
|
---|
| 812 | QT3_SUPPORT QStyle *setStyle(const QString&);
|
---|
| 813 | inline QT3_SUPPORT bool isVisibleToTLW() const;
|
---|
| 814 | QT3_SUPPORT QRect visibleRect() const;
|
---|
| 815 | inline QT3_SUPPORT void iconify() { showMinimized(); }
|
---|
| 816 | inline QT3_SUPPORT void constPolish() const { ensurePolished(); }
|
---|
| 817 | inline QT3_SUPPORT void polish() { ensurePolished(); }
|
---|
| 818 | inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
|
---|
| 819 | { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
|
---|
| 820 | inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false)
|
---|
| 821 | { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
|
---|
| 822 | inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false)
|
---|
| 823 | { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
|
---|
| 824 | inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
|
---|
| 825 | { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);}
|
---|
| 826 | inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); }
|
---|
| 827 | #ifndef QT_NO_CURSOR
|
---|
| 828 | inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); }
|
---|
| 829 | #endif
|
---|
| 830 | inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); }
|
---|
| 831 | inline QT3_SUPPORT void unsetFont() { setFont(QFont()); }
|
---|
| 832 | inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); }
|
---|
| 833 | inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); }
|
---|
| 834 | Qt::BackgroundMode QT3_SUPPORT backgroundMode() const;
|
---|
| 835 | void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground);
|
---|
| 836 | const QT3_SUPPORT QColor &eraseColor() const;
|
---|
| 837 | void QT3_SUPPORT setEraseColor(const QColor &);
|
---|
| 838 | const QT3_SUPPORT QColor &foregroundColor() const;
|
---|
| 839 | const QT3_SUPPORT QPixmap *erasePixmap() const;
|
---|
| 840 | void QT3_SUPPORT setErasePixmap(const QPixmap &);
|
---|
| 841 | const QT3_SUPPORT QColor &paletteForegroundColor() const;
|
---|
| 842 | void QT3_SUPPORT setPaletteForegroundColor(const QColor &);
|
---|
| 843 | const QT3_SUPPORT QColor &paletteBackgroundColor() const;
|
---|
| 844 | void QT3_SUPPORT setPaletteBackgroundColor(const QColor &);
|
---|
| 845 | const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const;
|
---|
| 846 | void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &);
|
---|
| 847 | const QT3_SUPPORT QBrush& backgroundBrush() const;
|
---|
| 848 | const QT3_SUPPORT QColor &backgroundColor() const;
|
---|
| 849 | const QT3_SUPPORT QPixmap *backgroundPixmap() const;
|
---|
| 850 | void QT3_SUPPORT setBackgroundPixmap(const QPixmap &);
|
---|
| 851 | QT3_SUPPORT void setBackgroundColor(const QColor &);
|
---|
| 852 | QT3_SUPPORT QColorGroup colorGroup() const;
|
---|
| 853 | QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const;
|
---|
| 854 | inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); }
|
---|
| 855 | inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
|
---|
| 856 | inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
|
---|
| 857 | enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
|
---|
[561] | 858 | inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
|
---|
[2] | 859 | inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
|
---|
| 860 | inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
|
---|
| 861 | inline QT3_SUPPORT void repaint(bool) { repaint(); }
|
---|
| 862 | inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); }
|
---|
| 863 | inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); }
|
---|
| 864 | inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); }
|
---|
| 865 | QT3_SUPPORT void erase();
|
---|
| 866 | inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); }
|
---|
| 867 | QT3_SUPPORT void erase(const QRect &);
|
---|
| 868 | QT3_SUPPORT void erase(const QRegion &);
|
---|
| 869 | QT3_SUPPORT void drawText(const QPoint &p, const QString &s)
|
---|
| 870 | { drawText_helper(p.x(), p.y(), s); }
|
---|
| 871 | inline QT3_SUPPORT void drawText(int x, int y, const QString &s)
|
---|
| 872 | { drawText_helper(x, y, s); }
|
---|
| 873 | QT3_SUPPORT bool close(bool);
|
---|
| 874 | inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const
|
---|
| 875 | {
|
---|
| 876 | QWidget *w = childAt(x, y);
|
---|
| 877 | return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0);
|
---|
| 878 | }
|
---|
| 879 | inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const
|
---|
| 880 | {
|
---|
| 881 | QWidget *w = childAt(p);
|
---|
| 882 | return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0);
|
---|
| 883 | }
|
---|
| 884 | inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); }
|
---|
| 885 | QT3_SUPPORT void setIcon(const QPixmap &i);
|
---|
| 886 | inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); }
|
---|
| 887 | inline QT3_SUPPORT QString caption() const { return windowTitle(); }
|
---|
| 888 | QT3_SUPPORT const QPixmap *icon() const;
|
---|
| 889 | inline QT3_SUPPORT QString iconText() const { return windowIconText(); }
|
---|
| 890 | inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); }
|
---|
| 891 | inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); }
|
---|
| 892 | inline QT3_SUPPORT void setActiveWindow() { activateWindow(); }
|
---|
| 893 | inline QT3_SUPPORT bool isShown() const { return !isHidden(); }
|
---|
| 894 | inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; }
|
---|
| 895 | inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; }
|
---|
| 896 | inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; }
|
---|
| 897 |
|
---|
| 898 |
|
---|
| 899 | private:
|
---|
| 900 | void drawText_helper(int x, int y, const QString &);
|
---|
| 901 | void erase_helper(int x, int y, int w, int h);
|
---|
| 902 | #endif // QT3_SUPPORT
|
---|
| 903 |
|
---|
| 904 | protected:
|
---|
| 905 | virtual void styleChange(QStyle&); // compat
|
---|
| 906 | virtual void enabledChange(bool); // compat
|
---|
| 907 | virtual void paletteChange(const QPalette &); // compat
|
---|
| 908 | virtual void fontChange(const QFont &); // compat
|
---|
| 909 | virtual void windowActivationChange(bool); // compat
|
---|
| 910 | virtual void languageChange(); // compat
|
---|
| 911 | };
|
---|
| 912 |
|
---|
| 913 | Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
|
---|
| 914 |
|
---|
| 915 | #if defined Q_CC_MSVC && _MSC_VER < 1300
|
---|
| 916 | template <> inline QWidget *qobject_cast_helper<QWidget*>(QObject *o, QWidget *)
|
---|
| 917 | {
|
---|
| 918 | if (!o || !o->isWidgetType()) return 0;
|
---|
| 919 | return (QWidget*)(o);
|
---|
| 920 | }
|
---|
| 921 | #else
|
---|
| 922 | template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
|
---|
| 923 | {
|
---|
| 924 | if (!o || !o->isWidgetType()) return 0;
|
---|
| 925 | return static_cast<QWidget*>(o);
|
---|
| 926 | }
|
---|
| 927 | template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
|
---|
| 928 | {
|
---|
| 929 | if (!o || !o->isWidgetType()) return 0;
|
---|
| 930 | return static_cast<const QWidget*>(o);
|
---|
| 931 | }
|
---|
| 932 | #endif
|
---|
| 933 |
|
---|
| 934 | inline QWidget *QWidget::childAt(int ax, int ay) const
|
---|
| 935 | { return childAt(QPoint(ax, ay)); }
|
---|
| 936 |
|
---|
| 937 | inline Qt::WindowType QWidget::windowType() const
|
---|
| 938 | { return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); }
|
---|
| 939 | inline Qt::WindowFlags QWidget::windowFlags() const
|
---|
| 940 | { return data->window_flags; }
|
---|
| 941 |
|
---|
| 942 | inline bool QWidget::isTopLevel() const
|
---|
| 943 | { return (windowType() & Qt::Window); }
|
---|
| 944 |
|
---|
| 945 | inline bool QWidget::isWindow() const
|
---|
| 946 | { return (windowType() & Qt::Window); }
|
---|
| 947 |
|
---|
| 948 | inline bool QWidget::isEnabled() const
|
---|
| 949 | { return !testAttribute(Qt::WA_Disabled); }
|
---|
| 950 |
|
---|
| 951 | inline bool QWidget::isModal() const
|
---|
| 952 | { return data->window_modality != Qt::NonModal; }
|
---|
| 953 |
|
---|
| 954 | inline bool QWidget::isEnabledToTLW() const
|
---|
| 955 | { return isEnabled(); }
|
---|
| 956 |
|
---|
| 957 | inline int QWidget::minimumWidth() const
|
---|
| 958 | { return minimumSize().width(); }
|
---|
| 959 |
|
---|
| 960 | inline int QWidget::minimumHeight() const
|
---|
| 961 | { return minimumSize().height(); }
|
---|
| 962 |
|
---|
| 963 | inline int QWidget::maximumWidth() const
|
---|
| 964 | { return maximumSize().width(); }
|
---|
| 965 |
|
---|
| 966 | inline int QWidget::maximumHeight() const
|
---|
| 967 | { return maximumSize().height(); }
|
---|
| 968 |
|
---|
| 969 | inline void QWidget::setMinimumSize(const QSize &s)
|
---|
| 970 | { setMinimumSize(s.width(),s.height()); }
|
---|
| 971 |
|
---|
| 972 | inline void QWidget::setMaximumSize(const QSize &s)
|
---|
| 973 | { setMaximumSize(s.width(),s.height()); }
|
---|
| 974 |
|
---|
| 975 | inline void QWidget::setSizeIncrement(const QSize &s)
|
---|
| 976 | { setSizeIncrement(s.width(),s.height()); }
|
---|
| 977 |
|
---|
| 978 | inline void QWidget::setBaseSize(const QSize &s)
|
---|
| 979 | { setBaseSize(s.width(),s.height()); }
|
---|
| 980 |
|
---|
| 981 | inline const QFont &QWidget::font() const
|
---|
| 982 | { return data->fnt; }
|
---|
| 983 |
|
---|
| 984 | inline QFontMetrics QWidget::fontMetrics() const
|
---|
| 985 | { return QFontMetrics(data->fnt); }
|
---|
| 986 |
|
---|
| 987 | inline QFontInfo QWidget::fontInfo() const
|
---|
| 988 | { return QFontInfo(data->fnt); }
|
---|
| 989 |
|
---|
| 990 | inline void QWidget::setMouseTracking(bool enable)
|
---|
| 991 | { setAttribute(Qt::WA_MouseTracking, enable); }
|
---|
| 992 |
|
---|
| 993 | inline bool QWidget::hasMouseTracking() const
|
---|
| 994 | { return testAttribute(Qt::WA_MouseTracking); }
|
---|
| 995 |
|
---|
| 996 | inline bool QWidget::underMouse() const
|
---|
| 997 | { return testAttribute(Qt::WA_UnderMouse); }
|
---|
| 998 |
|
---|
| 999 | inline bool QWidget::updatesEnabled() const
|
---|
| 1000 | { return !testAttribute(Qt::WA_UpdatesDisabled); }
|
---|
| 1001 |
|
---|
| 1002 | inline void QWidget::update(int ax, int ay, int aw, int ah)
|
---|
| 1003 | { update(QRect(ax, ay, aw, ah)); }
|
---|
| 1004 |
|
---|
| 1005 | inline bool QWidget::isVisible() const
|
---|
| 1006 | { return testAttribute(Qt::WA_WState_Visible); }
|
---|
| 1007 |
|
---|
| 1008 | inline bool QWidget::isHidden() const
|
---|
| 1009 | { return testAttribute(Qt::WA_WState_Hidden); }
|
---|
| 1010 |
|
---|
| 1011 | inline void QWidget::move(int ax, int ay)
|
---|
| 1012 | { move(QPoint(ax, ay)); }
|
---|
| 1013 |
|
---|
| 1014 | inline void QWidget::resize(int w, int h)
|
---|
| 1015 | { resize(QSize(w, h)); }
|
---|
| 1016 |
|
---|
| 1017 | inline void QWidget::setGeometry(int ax, int ay, int aw, int ah)
|
---|
| 1018 | { setGeometry(QRect(ax, ay, aw, ah)); }
|
---|
| 1019 |
|
---|
| 1020 | inline QRect QWidget::rect() const
|
---|
| 1021 | { return QRect(0,0,data->crect.width(),data->crect.height()); }
|
---|
| 1022 |
|
---|
| 1023 | inline const QRect &QWidget::geometry() const
|
---|
| 1024 | { return data->crect; }
|
---|
| 1025 |
|
---|
| 1026 | inline QSize QWidget::size() const
|
---|
| 1027 | { return data->crect.size(); }
|
---|
| 1028 |
|
---|
| 1029 | inline int QWidget::width() const
|
---|
| 1030 | { return data->crect.width(); }
|
---|
| 1031 |
|
---|
| 1032 | inline int QWidget::height() const
|
---|
| 1033 | { return data->crect.height(); }
|
---|
| 1034 |
|
---|
| 1035 | inline QWidget *QWidget::parentWidget() const
|
---|
| 1036 | { return static_cast<QWidget *>(QObject::parent()); }
|
---|
| 1037 |
|
---|
| 1038 | inline void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver)
|
---|
| 1039 | { setSizePolicy(QSizePolicy(hor, ver)); }
|
---|
| 1040 |
|
---|
| 1041 | inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const
|
---|
| 1042 | {
|
---|
| 1043 | if (attribute < int(8*sizeof(uint)))
|
---|
| 1044 | return data->widget_attributes & (1<<attribute);
|
---|
| 1045 | return testAttribute_helper(attribute);
|
---|
| 1046 | }
|
---|
| 1047 |
|
---|
| 1048 | #ifdef QT3_SUPPORT
|
---|
| 1049 | inline bool QWidget::isVisibleToTLW() const
|
---|
| 1050 | { return isVisible(); }
|
---|
| 1051 | inline QWidget *QWidget::parentWidget(bool sameWindow) const
|
---|
| 1052 | {
|
---|
| 1053 | if (sameWindow && isWindow())
|
---|
| 1054 | return 0;
|
---|
| 1055 | return static_cast<QWidget *>(QObject::parent());
|
---|
| 1056 | }
|
---|
| 1057 | inline QColorGroup QWidget::colorGroup() const
|
---|
| 1058 | { return QColorGroup(palette()); }
|
---|
| 1059 | inline void QWidget::setPaletteForegroundColor(const QColor &c)
|
---|
| 1060 | { QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); }
|
---|
| 1061 | inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); }
|
---|
| 1062 | inline void QWidget::setBackgroundPixmap(const QPixmap &pm)
|
---|
| 1063 | { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
|
---|
| 1064 | inline const QPixmap *QWidget::backgroundPixmap() const { return 0; }
|
---|
| 1065 | inline void QWidget::setBackgroundColor(const QColor &c)
|
---|
| 1066 | { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
|
---|
| 1067 | inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); }
|
---|
| 1068 | inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());}
|
---|
| 1069 | inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); }
|
---|
| 1070 | inline void QWidget::setEraseColor(const QColor &c)
|
---|
| 1071 | { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
|
---|
| 1072 | inline const QPixmap *QWidget::erasePixmap() const { return 0; }
|
---|
| 1073 | inline void QWidget::setErasePixmap(const QPixmap &pm)
|
---|
| 1074 | { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
|
---|
| 1075 | inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());}
|
---|
| 1076 | inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); }
|
---|
| 1077 | inline void QWidget::setPaletteBackgroundColor(const QColor &c)
|
---|
| 1078 | { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
|
---|
| 1079 | inline const QPixmap *QWidget::paletteBackgroundPixmap() const
|
---|
| 1080 | { return 0; }
|
---|
| 1081 | inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm)
|
---|
| 1082 | { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
|
---|
| 1083 | inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); }
|
---|
| 1084 | inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); }
|
---|
| 1085 | #endif
|
---|
| 1086 |
|
---|
| 1087 | #define QWIDGETSIZE_MAX ((1<<24)-1)
|
---|
| 1088 |
|
---|
| 1089 | QT_END_NAMESPACE
|
---|
| 1090 |
|
---|
| 1091 | QT_END_HEADER
|
---|
| 1092 |
|
---|
| 1093 | #endif // QWIDGET_H
|
---|