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