Qt 4.8
qwidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QWIDGET_H
43 #define QWIDGET_H
44 
45 #include <QtCore/qconfig.h>
46 #include <QtGui/qwindowdefs.h>
47 #include <QtCore/qobject.h>
48 #include <QtCore/qmargins.h>
49 #include <QtGui/qpaintdevice.h>
50 #include <QtGui/qpalette.h>
51 #include <QtGui/qfont.h>
52 #include <QtGui/qfontmetrics.h>
53 #include <QtGui/qfontinfo.h>
54 #include <QtGui/qsizepolicy.h>
55 #include <QtGui/qregion.h>
56 #include <QtGui/qbrush.h>
57 #include <QtGui/qcursor.h>
58 #include <QtGui/qkeysequence.h>
59 
60 #ifdef Q_WS_QPA //should this go somewhere else?
61 #include <QtGui/qplatformwindowformat_qpa.h>
62 #endif
63 
64 #ifdef QT_INCLUDE_COMPAT
65 #include <QtGui/qevent.h>
66 #endif
67 
69 
71 
72 QT_MODULE(Gui)
73 
74 class QLayout;
75 class QWSRegionManager;
76 class QStyle;
77 class QAction;
78 class QVariant;
79 
80 class QActionEvent;
81 class QMouseEvent;
82 class QWheelEvent;
83 class QHoverEvent;
84 class QKeyEvent;
85 class QFocusEvent;
86 class QPaintEvent;
87 class QMoveEvent;
88 class QResizeEvent;
89 class QCloseEvent;
90 class QContextMenuEvent;
91 class QInputMethodEvent;
92 class QTabletEvent;
93 class QDragEnterEvent;
94 class QDragMoveEvent;
95 class QDragLeaveEvent;
96 class QDropEvent;
97 class QShowEvent;
98 class QHideEvent;
99 #ifndef QT_NO_IM
100 class QInputContext;
101 #endif
102 class QIcon;
103 class QWindowSurface;
104 class QPlatformWindow;
105 class QLocale;
107 class QGraphicsEffect;
109 class QUnifiedToolbarSurface;
110 #if defined(Q_WS_X11)
111 class QX11Info;
112 #endif
113 
115 {
116 public:
119  Qt::WindowFlags window_flags;
126  mutable uint fstrut_dirty : 1;
130  uint unused : 13;
132  mutable QPalette pal;
134 #if defined(Q_WS_QWS)
135 // QRegion req_region; // Requested region
136 // mutable QRegion paintable_region; // Paintable region
137 // mutable bool paintable_region_dirty;// needs to be recalculated
138 // mutable QRegion alloc_region; // Allocated region
139 // mutable bool alloc_region_dirty; // needs to be recalculated
140 // mutable int overlapping_children; // Handle overlapping children
141 
143 // int alloc_region_revision;
144 #endif
146 };
147 
148 class QWidgetPrivate;
149 
150 class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice
151 {
152  Q_OBJECT
154 
155  bool modal;
156  Qt::WindowModality windowModality;
157  bool enabled;
158  QRect geometry;
159  QRect frameGeometry;
160  QRect normalGeometry;
161  int x;
162  int y;
163  QPoint pos;
164  QSize frameSize;
165  QSize size;
166  int width;
167  int height;
168  QRect rect;
169  QRect childrenRect;
170  QRegion childrenRegion;
171  QSizePolicy sizePolicy;
172  QSize minimumSize;
173  QSize maximumSize;
174  int minimumWidth;
175  int minimumHeight;
176  int maximumWidth;
177  int maximumHeight;
178  QSize sizeIncrement;
179  QSize baseSize;
180  QPalette palette;
181  QFont font;
182 #ifndef QT_NO_CURSOR
184 #endif
188  bool focus;
191  bool visible;
192  bool minimized;
193  bool maximized;
203 #ifndef QT_NO_TOOLTIP
205 #endif
206 #ifndef QT_NO_STATUSTIP
208 #endif
209 #ifndef QT_NO_WHATSTHIS
211 #endif
212 #ifndef QT_NO_ACCESSIBILITY
215 #endif
217  QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
218  bool autoFillBackground;
219 #ifndef QT_NO_STYLE_STYLESHEET
221 #endif
224  Qt::InputMethodHints inputMethodHints;
225 
226 public:
227  enum RenderFlag {
228  DrawWindowBackground = 0x1,
229  DrawChildren = 0x2,
230  IgnoreMask = 0x4
231  };
232  Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
233 
234  explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
235 #ifdef QT3_SUPPORT
236  QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0);
237 #endif
238  ~QWidget();
239 
240  int devType() const;
241 
242  WId winId() const;
243  void createWinId(); // internal, going away
244  inline WId internalWinId() const { return data->winid; }
245  WId effectiveWinId() const;
246 
247  // GUI style setting
248  QStyle *style() const;
249  void setStyle(QStyle *);
250  // Widget types and states
251 
252  bool isTopLevel() const;
253  bool isWindow() const;
254 
255  bool isModal() const;
256  Qt::WindowModality windowModality() const;
257  void setWindowModality(Qt::WindowModality windowModality);
258 
259  bool isEnabled() const;
260  bool isEnabledTo(QWidget*) const;
261  bool isEnabledToTLW() const;
262 
263 public Q_SLOTS:
264  void setEnabled(bool);
265  void setDisabled(bool);
266  void setWindowModified(bool);
267 
268  // Widget coordinates
269 
270 public:
271  QRect frameGeometry() const;
272  const QRect &geometry() const;
273  QRect normalGeometry() const;
274 
275  int x() const;
276  int y() const;
277  QPoint pos() const;
278  QSize frameSize() const;
279  QSize size() const;
280  inline int width() const;
281  inline int height() const;
282  inline QRect rect() const;
283  QRect childrenRect() const;
284  QRegion childrenRegion() const;
285 
286  QSize minimumSize() const;
287  QSize maximumSize() const;
288  int minimumWidth() const;
289  int minimumHeight() const;
290  int maximumWidth() const;
291  int maximumHeight() const;
292  void setMinimumSize(const QSize &);
293  void setMinimumSize(int minw, int minh);
294  void setMaximumSize(const QSize &);
295  void setMaximumSize(int maxw, int maxh);
296  void setMinimumWidth(int minw);
297  void setMinimumHeight(int minh);
298  void setMaximumWidth(int maxw);
299  void setMaximumHeight(int maxh);
300 
301 #ifdef Q_QDOC
302  void setupUi(QWidget *widget);
303 #endif
304 
305  QSize sizeIncrement() const;
306  void setSizeIncrement(const QSize &);
307  void setSizeIncrement(int w, int h);
308  QSize baseSize() const;
309  void setBaseSize(const QSize &);
310  void setBaseSize(int basew, int baseh);
311 
312  void setFixedSize(const QSize &);
313  void setFixedSize(int w, int h);
314  void setFixedWidth(int w);
315  void setFixedHeight(int h);
316 
317  // Widget coordinate mapping
318 
319  QPoint mapToGlobal(const QPoint &) const;
320  QPoint mapFromGlobal(const QPoint &) const;
321  QPoint mapToParent(const QPoint &) const;
322  QPoint mapFromParent(const QPoint &) const;
323  QPoint mapTo(QWidget *, const QPoint &) const;
324  QPoint mapFrom(QWidget *, const QPoint &) const;
325 
326  QWidget *window() const;
327  QWidget *nativeParentWidget() const;
328  inline QWidget *topLevelWidget() const { return window(); }
329 
330  // Widget appearance functions
331  const QPalette &palette() const;
332  void setPalette(const QPalette &);
333 
334  void setBackgroundRole(QPalette::ColorRole);
335  QPalette::ColorRole backgroundRole() const;
336 
337  void setForegroundRole(QPalette::ColorRole);
338  QPalette::ColorRole foregroundRole() const;
339 
340  const QFont &font() const;
341  void setFont(const QFont &);
342  QFontMetrics fontMetrics() const;
343  QFontInfo fontInfo() const;
344 
345 #ifndef QT_NO_CURSOR
346  QCursor cursor() const;
347  void setCursor(const QCursor &);
348  void unsetCursor();
349 #endif
350 
351  void setMouseTracking(bool enable);
352  bool hasMouseTracking() const;
353  bool underMouse() const;
354 
355  void setMask(const QBitmap &);
356  void setMask(const QRegion &);
357  QRegion mask() const;
358  void clearMask();
359 
360  void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(),
361  const QRegion &sourceRegion = QRegion(),
362  RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
363 
364  void render(QPainter *painter, const QPoint &targetOffset = QPoint(),
365  const QRegion &sourceRegion = QRegion(),
366  RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
367 
368 #ifndef QT_NO_GRAPHICSEFFECT
369  QGraphicsEffect *graphicsEffect() const;
370  void setGraphicsEffect(QGraphicsEffect *effect);
371 #endif //QT_NO_GRAPHICSEFFECT
372 
373 #ifndef QT_NO_GESTURES
374  void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
375  void ungrabGesture(Qt::GestureType type);
376 #endif
377 
378 public Q_SLOTS:
379  void setWindowTitle(const QString &);
380 #ifndef QT_NO_STYLE_STYLESHEET
381  void setStyleSheet(const QString& styleSheet);
382 #endif
383 public:
384 #ifndef QT_NO_STYLE_STYLESHEET
385  QString styleSheet() const;
386 #endif
387  QString windowTitle() const;
388  void setWindowIcon(const QIcon &icon);
389  QIcon windowIcon() const;
390  void setWindowIconText(const QString &);
391  QString windowIconText() const;
392  void setWindowRole(const QString &);
393  QString windowRole() const;
394  void setWindowFilePath(const QString &filePath);
395  QString windowFilePath() const;
396 
397  void setWindowOpacity(qreal level);
398  qreal windowOpacity() const;
399 
400  bool isWindowModified() const;
401 #ifndef QT_NO_TOOLTIP
402  void setToolTip(const QString &);
403  QString toolTip() const;
404 #endif
405 #ifndef QT_NO_STATUSTIP
406  void setStatusTip(const QString &);
407  QString statusTip() const;
408 #endif
409 #ifndef QT_NO_WHATSTHIS
410  void setWhatsThis(const QString &);
411  QString whatsThis() const;
412 #endif
413 #ifndef QT_NO_ACCESSIBILITY
414  QString accessibleName() const;
415  void setAccessibleName(const QString &name);
416  QString accessibleDescription() const;
417  void setAccessibleDescription(const QString &description);
418 #endif
419 
420  void setLayoutDirection(Qt::LayoutDirection direction);
421  Qt::LayoutDirection layoutDirection() const;
422  void unsetLayoutDirection();
423 
424  void setLocale(const QLocale &locale);
425  QLocale locale() const;
426  void unsetLocale();
427 
428  inline bool isRightToLeft() const { return layoutDirection() == Qt::RightToLeft; }
429  inline bool isLeftToRight() const { return layoutDirection() == Qt::LeftToRight; }
430 
431 public Q_SLOTS:
433 
434 public:
435  bool isActiveWindow() const;
436  void activateWindow();
437  void clearFocus();
438 
439  void setFocus(Qt::FocusReason reason);
440  Qt::FocusPolicy focusPolicy() const;
441  void setFocusPolicy(Qt::FocusPolicy policy);
442  bool hasFocus() const;
443  static void setTabOrder(QWidget *, QWidget *);
444  void setFocusProxy(QWidget *);
445  QWidget *focusProxy() const;
446  Qt::ContextMenuPolicy contextMenuPolicy() const;
447  void setContextMenuPolicy(Qt::ContextMenuPolicy policy);
448 
449  // Grab functions
450  void grabMouse();
451 #ifndef QT_NO_CURSOR
452  void grabMouse(const QCursor &);
453 #endif
454  void releaseMouse();
455  void grabKeyboard();
456  void releaseKeyboard();
457 #ifndef QT_NO_SHORTCUT
458  int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut);
459  void releaseShortcut(int id);
460  void setShortcutEnabled(int id, bool enable = true);
461  void setShortcutAutoRepeat(int id, bool enable = true);
462 #endif
463  static QWidget *mouseGrabber();
464  static QWidget *keyboardGrabber();
465 
466  // Update/refresh functions
467  inline bool updatesEnabled() const;
468  void setUpdatesEnabled(bool enable);
469 
470 #if 0 //def Q_WS_QWS
471  void repaintUnclipped(const QRegion &, bool erase = true);
472 #endif
473 
474 #ifndef QT_NO_GRAPHICSVIEW
475  QGraphicsProxyWidget *graphicsProxyWidget() const;
476 #endif
477 
478 public Q_SLOTS:
479  void update();
480  void repaint();
481 
482 public:
483  inline void update(int x, int y, int w, int h);
484  void update(const QRect&);
485  void update(const QRegion&);
486 
487  void repaint(int x, int y, int w, int h);
488  void repaint(const QRect &);
489  void repaint(const QRegion &);
490 
491 public Q_SLOTS:
492  // Widget management functions
493 
494  virtual void setVisible(bool visible);
495  inline void setHidden(bool hidden) { setVisible(!hidden); }
496 #ifndef Q_WS_WINCE
497  inline void show() { setVisible(true); }
498 #else
499  void show();
500 #endif
501  inline void hide() { setVisible(false); }
502  inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); }
503 
504  void showMinimized();
505  void showMaximized();
506  void showFullScreen();
507  void showNormal();
508 
509  bool close();
510  void raise();
511  void lower();
512 
513 public:
514  void stackUnder(QWidget*);
515  void move(int x, int y);
516  void move(const QPoint &);
517  void resize(int w, int h);
518  void resize(const QSize &);
519  inline void setGeometry(int x, int y, int w, int h);
520  void setGeometry(const QRect &);
521  QByteArray saveGeometry() const;
522  bool restoreGeometry(const QByteArray &geometry);
523  void adjustSize();
524  bool isVisible() const;
525  bool isVisibleTo(QWidget*) const;
526  // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const
527  inline bool isHidden() const;
528 
529  bool isMinimized() const;
530  bool isMaximized() const;
531  bool isFullScreen() const;
532 
533  Qt::WindowStates windowState() const;
534  void setWindowState(Qt::WindowStates state);
535  void overrideWindowState(Qt::WindowStates state);
536 
537  virtual QSize sizeHint() const;
538  virtual QSize minimumSizeHint() const;
539 
540  QSizePolicy sizePolicy() const;
541  void setSizePolicy(QSizePolicy);
542  inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical);
543  virtual int heightForWidth(int) const;
544 
545  QRegion visibleRegion() const;
546 
547  void setContentsMargins(int left, int top, int right, int bottom);
548  void setContentsMargins(const QMargins &margins);
549  void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
550  QMargins contentsMargins() const;
551 
552  QRect contentsRect() const;
553 
554 public:
555  QLayout *layout() const;
556  void setLayout(QLayout *);
557  void updateGeometry();
558 
559  void setParent(QWidget *parent);
560  void setParent(QWidget *parent, Qt::WindowFlags f);
561 
562  void scroll(int dx, int dy);
563  void scroll(int dx, int dy, const QRect&);
564 
565  // Misc. functions
566 
567  QWidget *focusWidget() const;
568  QWidget *nextInFocusChain() const;
569  QWidget *previousInFocusChain() const;
570 
571  // drag and drop
572  bool acceptDrops() const;
573  void setAcceptDrops(bool on);
574 
575 #ifndef QT_NO_ACTION
576  //actions
577  void addAction(QAction *action);
578  void addActions(QList<QAction*> actions);
579  void insertAction(QAction *before, QAction *action);
580  void insertActions(QAction *before, QList<QAction*> actions);
581  void removeAction(QAction *action);
582  QList<QAction*> actions() const;
583 #endif
584 
585  QWidget *parentWidget() const;
586 
587  void setWindowFlags(Qt::WindowFlags type);
588  inline Qt::WindowFlags windowFlags() const;
589  void overrideWindowFlags(Qt::WindowFlags type);
590 
591  inline Qt::WindowType windowType() const;
592 
593  static QWidget *find(WId);
594 #ifdef QT3_SUPPORT
595  static QT3_SUPPORT QWidgetMapper *wmapper();
596 #endif
597  inline QWidget *childAt(int x, int y) const;
598  QWidget *childAt(const QPoint &p) const;
599 
600 #if defined(Q_WS_X11)
601  const QX11Info &x11Info() const;
602  Qt::HANDLE x11PictureHandle() const;
603 #endif
604 
605 #if defined(Q_WS_MAC)
606  Qt::HANDLE macQDHandle() const;
607  Qt::HANDLE macCGHandle() const;
608 #endif
609 
610 #if defined(Q_WS_WIN)
611  HDC getDC() const;
612  void releaseDC(HDC) const;
613 #else
614  Qt::HANDLE handle() const;
615 #endif
616 
617  void setAttribute(Qt::WidgetAttribute, bool on = true);
618  inline bool testAttribute(Qt::WidgetAttribute) const;
619 
620  QPaintEngine *paintEngine() const;
621 
622  void ensurePolished() const;
623 #ifndef QT_NO_IM
624  QInputContext *inputContext();
625  void setInputContext(QInputContext *);
626 #endif
627  bool isAncestorOf(const QWidget *child) const;
628 
629 #ifdef QT_KEYPAD_NAVIGATION
630  bool hasEditFocus() const;
631  void setEditFocus(bool on);
632 #endif
633 
634  bool autoFillBackground() const;
635  void setAutoFillBackground(bool enabled);
636 
637  void setWindowSurface(QWindowSurface *surface);
638  QWindowSurface *windowSurface() const;
639 
640 #if defined(Q_WS_QPA)
641  void setPlatformWindow(QPlatformWindow *window);
642  QPlatformWindow *platformWindow() const;
643 
644  void setPlatformWindowFormat(const QPlatformWindowFormat &format);
645  QPlatformWindowFormat platformWindowFormat() const;
646 
647  friend class QDesktopScreenWidget;
648 #endif
649 
650 Q_SIGNALS:
651  void customContextMenuRequested(const QPoint &pos);
652 
653 protected:
654  // Event handlers
655  bool event(QEvent *);
656  virtual void mousePressEvent(QMouseEvent *);
657  virtual void mouseReleaseEvent(QMouseEvent *);
658  virtual void mouseDoubleClickEvent(QMouseEvent *);
659  virtual void mouseMoveEvent(QMouseEvent *);
660 #ifndef QT_NO_WHEELEVENT
661  virtual void wheelEvent(QWheelEvent *);
662 #endif
663  virtual void keyPressEvent(QKeyEvent *);
664  virtual void keyReleaseEvent(QKeyEvent *);
665  virtual void focusInEvent(QFocusEvent *);
666  virtual void focusOutEvent(QFocusEvent *);
667  virtual void enterEvent(QEvent *);
668  virtual void leaveEvent(QEvent *);
669  virtual void paintEvent(QPaintEvent *);
670  virtual void moveEvent(QMoveEvent *);
671  virtual void resizeEvent(QResizeEvent *);
672  virtual void closeEvent(QCloseEvent *);
673 #ifndef QT_NO_CONTEXTMENU
674  virtual void contextMenuEvent(QContextMenuEvent *);
675 #endif
676 #ifndef QT_NO_TABLETEVENT
677  virtual void tabletEvent(QTabletEvent *);
678 #endif
679 #ifndef QT_NO_ACTION
680  virtual void actionEvent(QActionEvent *);
681 #endif
682 
683 #ifndef QT_NO_DRAGANDDROP
684  virtual void dragEnterEvent(QDragEnterEvent *);
685  virtual void dragMoveEvent(QDragMoveEvent *);
686  virtual void dragLeaveEvent(QDragLeaveEvent *);
687  virtual void dropEvent(QDropEvent *);
688 #endif
689 
690  virtual void showEvent(QShowEvent *);
691  virtual void hideEvent(QHideEvent *);
692 
693 #if defined(Q_WS_MAC)
694  virtual bool macEvent(EventHandlerCallRef, EventRef);
695 #endif
696 #if defined(Q_WS_WIN)
697  virtual bool winEvent(MSG *message, long *result);
698 #endif
699 #if defined(Q_WS_X11)
700  virtual bool x11Event(XEvent *);
701 #endif
702 #if defined(Q_WS_QWS)
703  virtual bool qwsEvent(QWSEvent *);
704 #endif
705 
706  // Misc. protected functions
707  virtual void changeEvent(QEvent *);
708 
709  int metric(PaintDeviceMetric) const;
710 
711  virtual void inputMethodEvent(QInputMethodEvent *);
712 public:
714 
715  Qt::InputMethodHints inputMethodHints() const;
716  void setInputMethodHints(Qt::InputMethodHints hints);
717 
718 protected:
719  void resetInputContext();
720 protected Q_SLOTS:
721  void updateMicroFocus();
722 protected:
723 
724  void create(WId = 0, bool initializeWindow = true,
725  bool destroyOldWindow = true);
726  void destroy(bool destroyWindow = true,
727  bool destroySubWindows = true);
728 
729  virtual bool focusNextPrevChild(bool next);
730  inline bool focusNextChild() { return focusNextPrevChild(true); }
731  inline bool focusPreviousChild() { return focusNextPrevChild(false); }
732 
733 protected:
734  QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f);
735 private:
736 
738 
739  QLayout *takeLayout();
740 
741  friend class QBackingStoreDevice;
742  friend class QWidgetBackingStore;
743  friend class QApplication;
744  friend class QApplicationPrivate;
745  friend class QBaseApplication;
746  friend class QPainter;
747  friend class QPainterPrivate;
748  friend class QPixmap; // for QPixmap::fill()
749  friend class QFontMetrics;
750  friend class QFontInfo;
751  friend class QETWidget;
752  friend class QLayout;
753  friend class QWidgetItem;
754  friend class QWidgetItemV2;
755  friend class QGLContext;
756  friend class QGLWidget;
757  friend class QGLWindowSurface;
758  friend class QX11PaintEngine;
759  friend class QWin32PaintEngine;
760  friend class QShortcutPrivate;
761  friend class QShortcutMap;
762  friend class QWindowSurface;
763  friend class QGraphicsProxyWidget;
765  friend class QStyleSheetStyle;
766  friend struct QWidgetExceptionCleaner;
767 #ifndef QT_NO_GESTURES
768  friend class QGestureManager;
770 #endif // QT_NO_GESTURES
772 
773 #ifdef Q_WS_MAC
775  friend QPoint qt_mac_posInWindow(const QWidget *w);
776  friend OSWindowRef qt_mac_window_for(const QWidget *w);
777  friend bool qt_mac_is_metal(const QWidget *w);
778  friend OSViewRef qt_mac_nativeview_for(const QWidget *w);
779  friend void qt_event_request_window_change(QWidget *widget);
780  friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref);
781  friend class QRasterWindowSurface;
782  friend class QUnifiedToolbarSurface;
783 #endif
784 #ifdef Q_WS_QWS
785  friend class QWSBackingStore;
786  friend class QWSManager;
787  friend class QWSManagerPrivate;
788  friend class QDecoration;
789  friend class QWSWindowSurface;
790  friend class QScreen;
791  friend class QVNCScreen;
792  friend bool isWidgetOpaque(const QWidget *);
793  friend class QGLWidgetPrivate;
794 #endif
795 #ifdef Q_OS_SYMBIAN
796  friend class QSymbianControl;
797  friend class QS60WindowSurface;
798 #endif
799 #ifdef Q_WS_X11
800  friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
801  friend void qt_net_remove_user_time(QWidget *tlw);
803 #endif
804 
807 
808 private:
810  Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
811 #ifdef Q_OS_SYMBIAN
812  Q_PRIVATE_SLOT(d_func(), void void _q_cleanupWinIds())
813 #endif
814 
816 
817 public:
818 #ifdef QT3_SUPPORT
819  inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); }
820  QT3_SUPPORT QStyle *setStyle(const QString&);
821  inline QT3_SUPPORT bool isVisibleToTLW() const;
822  QT3_SUPPORT QRect visibleRect() const;
823  inline QT3_SUPPORT void iconify() { showMinimized(); }
824  inline QT3_SUPPORT void constPolish() const { ensurePolished(); }
825  inline QT3_SUPPORT void polish() { ensurePolished(); }
826  inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
827  { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
828  inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false)
829  { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
830  inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false)
831  { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
832  inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
833  { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);}
834  inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); }
835 #ifndef QT_NO_CURSOR
836  inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); }
837 #endif
838  inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); }
839  inline QT3_SUPPORT void unsetFont() { setFont(QFont()); }
840  inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); }
841  inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); }
842  Qt::BackgroundMode QT3_SUPPORT backgroundMode() const;
843  void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground);
844  const QT3_SUPPORT QColor &eraseColor() const;
845  void QT3_SUPPORT setEraseColor(const QColor &);
846  const QT3_SUPPORT QColor &foregroundColor() const;
847  const QT3_SUPPORT QPixmap *erasePixmap() const;
848  void QT3_SUPPORT setErasePixmap(const QPixmap &);
849  const QT3_SUPPORT QColor &paletteForegroundColor() const;
850  void QT3_SUPPORT setPaletteForegroundColor(const QColor &);
851  const QT3_SUPPORT QColor &paletteBackgroundColor() const;
852  void QT3_SUPPORT setPaletteBackgroundColor(const QColor &);
853  const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const;
854  void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &);
855  const QT3_SUPPORT QBrush& backgroundBrush() const;
856  const QT3_SUPPORT QColor &backgroundColor() const;
857  const QT3_SUPPORT QPixmap *backgroundPixmap() const;
858  void QT3_SUPPORT setBackgroundPixmap(const QPixmap &);
859  QT3_SUPPORT void setBackgroundColor(const QColor &);
860  QT3_SUPPORT QColorGroup colorGroup() const;
861  QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const;
862  inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); }
863  inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
864  inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
865  enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
866  inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
867  inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
868  inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
869  inline QT3_SUPPORT void repaint(bool) { repaint(); }
870  inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); }
871  inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); }
872  inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); }
873  QT3_SUPPORT void erase();
874  inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); }
875  QT3_SUPPORT void erase(const QRect &);
876  QT3_SUPPORT void erase(const QRegion &);
877  QT3_SUPPORT void drawText(const QPoint &p, const QString &s)
878  { drawText_helper(p.x(), p.y(), s); }
879  inline QT3_SUPPORT void drawText(int x, int y, const QString &s)
880  { drawText_helper(x, y, s); }
881  QT3_SUPPORT bool close(bool);
882  inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const
883  {
884  QWidget *w = childAt(x, y);
885  return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0);
886  }
887  inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const
888  {
889  QWidget *w = childAt(p);
890  return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0);
891  }
892  inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); }
893  QT3_SUPPORT void setIcon(const QPixmap &i);
894  inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); }
895  inline QT3_SUPPORT QString caption() const { return windowTitle(); }
896  QT3_SUPPORT const QPixmap *icon() const;
897  inline QT3_SUPPORT QString iconText() const { return windowIconText(); }
898  inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); }
899  inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); }
900  inline QT3_SUPPORT void setActiveWindow() { activateWindow(); }
901  inline QT3_SUPPORT bool isShown() const { return !isHidden(); }
902  inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; }
903  inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; }
904  inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; }
905 
906 
907 private:
908  void drawText_helper(int x, int y, const QString &);
909  void erase_helper(int x, int y, int w, int h);
910 #endif // QT3_SUPPORT
911 
912 protected:
913  virtual void styleChange(QStyle&); // compat
914  virtual void enabledChange(bool); // compat
915  virtual void paletteChange(const QPalette &); // compat
916  virtual void fontChange(const QFont &); // compat
917  virtual void windowActivationChange(bool); // compat
918  virtual void languageChange(); // compat
919 };
920 
921 Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
922 
923 template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
924 {
925  if (!o || !o->isWidgetType()) return 0;
926  return static_cast<QWidget*>(o);
927 }
928 template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
929 {
930  if (!o || !o->isWidgetType()) return 0;
931  return static_cast<const QWidget*>(o);
932 }
933 
934 inline QWidget *QWidget::childAt(int ax, int ay) const
935 { return childAt(QPoint(ax, ay)); }
936 
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 
985 { return QFontMetrics(data->fnt); }
986 
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 
1036 { return static_cast<QWidget *>(QObject::parent()); }
1037 
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 
1090 
1092 
1093 #endif // QWIDGET_H
QString accessibleName
the widget&#39;s name as seen by assistive technologies
Definition: qwidget.h:213
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
uint unused
Definition: qwidget.h:130
bool isModal() const
Definition: qwidget.h:951
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
#define QT_MOC_COMPAT
Definition: qglobal.h:1128
virtual bool macEvent(EventHandlerCallRef, EventRef)
This special event handler can be reimplemented in a subclass to receive native Macintosh events...
Definition: qwidget.cpp:9918
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
int minimumHeight() const
bool qt_mac_is_metal(const QWidget *w)
The QKeyEvent class describes a key event.
Definition: qevent.h:224
unsigned long WId
Definition: qwindowdefs.h:119
bool mouseTracking
whether mouse tracking is enabled for the widget
Definition: qwidget.h:185
void setInputMethodHints(Qt::InputMethodHints hints)
Definition: qwidget.cpp:9736
virtual void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qwidget.cpp:9842
double windowOpacity
The level of opacity for the window.
Definition: qwidget.h:201
int type
Definition: qmetatype.cpp:239
bool isWidgetOpaque(const QWidget *w)
double qreal
Definition: qglobal.h:1193
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
unsigned char c[8]
Definition: qnumeric_p.h:62
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
QString whatsThis
the widget&#39;s What&#39;s This help text.
Definition: qwidget.h:210
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int metric(PaintDeviceMetric) const
Internal implementation of the virtual QPaintDevice::metric() function.
void setSizeIncrement(const QSize &)
Definition: qwidget.h:975
#define QDOC_PROPERTY(text)
Definition: qglobal.h:2503
QSize size() const
EventRef event
QPointer< QWidget > widget
virtual void inputMethodEvent(QInputMethodEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive Input Method compo...
Definition: qwidget.cpp:9668
#define QT_MODULE(x)
Definition: qglobal.h:2783
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
Definition: qpalette.h:93
bool fullScreen
whether the widget is shown in full screen mode
Definition: qwidget.h:194
void resetInputContext()
This function can be called on the widget that currently has focus to reset the input method operatin...
Definition: qwidget.cpp:522
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
bool isPopup
Use windowType() == Qt::Popup instead.
QRect crect
Definition: qwidget.h:131
QString windowFilePath
the file path associated with a widget
Definition: qwidget.h:223
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
#define it(className, varName)
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
bool isVisible() const
Definition: qwidget.h:1005
virtual void mouseReleaseEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
Definition: qwidget.cpp:9286
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
virtual void dragEnterEvent(QDragEnterEvent *)
This event handler is called when a drag is in progress and the mouse enters this widget...
Definition: qwidget.cpp:9768
QFont fnt
Definition: qwidget.h:133
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
The QHoverEvent class contains parameters that describe a mouse event.
Definition: qevent.h:125
void setBaseSize(const QSize &)
Definition: qwidget.h:978
virtual void mousePressEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
Definition: qwidget.cpp:9261
virtual void leaveEvent(QEvent *)
This event handler can be reimplemented in a subclass to receive widget leave events which are passed...
Definition: qwidget.cpp:9491
Qt::FocusPolicy focusPolicy
the way the widget accepts keyboard focus
Definition: qwidget.h:187
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
uint window_state
Definition: qwidget.h:120
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
void setMaximumSize(const QSize &)
Definition: qwidget.h:972
bool windowModified
whether the document shown in the window has unsaved changes
Definition: qwidget.h:202
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587
virtual void moveEvent(QMoveEvent *)
This event handler can be reimplemented in a subclass to receive widget move events which are passed ...
Definition: qwidget.cpp:9566
bool updatesEnabled() const
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
virtual void keyReleaseEvent(QKeyEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive key release events...
Definition: qwidget.cpp:9407
void setMinimumSize(const QSize &)
Definition: qwidget.h:969
The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed.
Definition: qevent.h:632
int alloc_region_index
Definition: qwidget.h:142
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition: qwidget.h:996
#define Q_SLOTS
Definition: qobjectdefs.h:71
virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const
This method is only relevant for input widgets.
Definition: qwidget.cpp:9683
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QString class provides a Unicode character string.
Definition: qstring.h:83
void customContextMenuRequested(const QPoint &pos)
This signal is emitted when the widget&#39;s contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget.
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
The QPlatformWindow class provides an abstraction for top-level windows.
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
Definition: qevent.h:530
bool minimized
whether this widget is minimized (iconified)
Definition: qwidget.h:192
WindowType
Definition: qnamespace.h:270
void qt_set_winid_on_widget(QWidget *w, Qt::HANDLE id)
Definition: qegl_x11.cpp:325
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
bool maximized
whether this widget is maximized
Definition: qwidget.h:193
#define Q_SIGNALS
Definition: qobjectdefs.h:72
uint sizehint_forced
Definition: qwidget.h:122
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
int height() const
WidgetAttribute
Definition: qnamespace.h:376
uint in_set_window_state
Definition: qwidget.h:125
QIcon windowIcon
the widget&#39;s icon
Definition: qwidget.h:199
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
virtual void focusOutEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) f...
Definition: qwidget.cpp:9457
OSWindowRef qt_mac_window_for(const QWidget *)
Definition: qwidget_mac.mm:484
uint window_modality
Definition: qwidget.h:128
The QDecoration class is a base class for window decorations in Qt for Embedded Linux.
union _XEvent XEvent
Definition: qwindowdefs.h:116
The QWSEvent class encapsulates an event in Qt for Embedded Linux.
Definition: qwsevent_qws.h:59
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
bool focus
whether this widget (or its focus proxy) has the keyboard input focus
Definition: qwidget.h:188
void setHeightForWidth(bool b)
Definition: qsizepolicy.h:135
virtual void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qwidget.cpp:9548
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
Definition: qpalette.h:206
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
void destroy(bool destroyWindow=true, bool destroySubWindows=true)
Frees up window system resources.
bool updatesEnabled
whether updates are enabled
Definition: qwidget.h:190
The QVNCScreen class implements a screen driver for VNC servers.
bool visible
whether the widget is visible
Definition: qwidget.h:191
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
ContextMenuPolicy
Definition: qnamespace.h:1533
WindowRef OSWindowRef
uint widget_attributes
Definition: qwidget.h:118
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
int width() const
Qt::WindowFlags window_flags
Definition: qwidget.h:119
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
const char * name
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
const char * layout
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
virtual bool x11Event(XEvent *)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
Definition: qwidget.cpp:9969
LayoutDirection
Definition: qnamespace.h:1580
virtual void mouseDoubleClickEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click...
Definition: qwidget.cpp:9306
QWidgetData * data
Definition: qwidget.h:815
void setHidden(bool hidden)
Convenience function, equivalent to setVisible(!hidden).
Definition: qwidget.h:495
QFontMetrics fontMetrics() const
Returns the font metrics for the widget&#39;s current font.
Definition: qwidget.h:984
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
QSize minimumSizeHint
the recommended minimum size for the widget
Definition: qwidget.h:196
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref)
Definition: qwidget_mac.mm:448
virtual void actionEvent(QActionEvent *)
This event handler is called with the given event whenever the widget&#39;s actions are changed...
Definition: qwidget.cpp:9600
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
Definition: qevent.h:577
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QCursor cursor
the cursor shape for this widget
Definition: qwidget.h:183
QString accessibleDescription
the widget&#39;s description as seen by assistive technologies
Definition: qwidget.h:214
void updateMicroFocus()
Updates the widget&#39;s micro focus.
Definition: qwidget.cpp:11820
Qt::ContextMenuPolicy contextMenuPolicy
how the widget shows a context menu
Definition: qwidget.h:189
QString windowIconText
the widget&#39;s icon text
Definition: qwidget.h:200
QRect wrect
Definition: qwidget.h:145
uint is_closing
Definition: qwidget.h:123
void * HANDLE
Definition: qnamespace.h:1671
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
The QWidgetItem class is a layout item that represents a widget.
Definition: qlayoutitem.h:122
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
virtual void keyPressEvent(QKeyEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
Definition: qwidget.cpp:9375
The QFontInfo class provides general information about fonts.
Definition: qfontinfo.h:54
GestureType
Definition: qnamespace.h:1759
bool acceptDrops
whether drop events are enabled for this widget
Definition: qwidget.h:197
QRect rect() const
#define Q_OBJECT
Definition: qobjectdefs.h:157
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
The QWindowSurface class provides the drawing area for top-level windows.
struct OpaqueEventRef * EventRef
bool isEnabled() const
Definition: qwidget.h:948
The QTabletEvent class contains parameters that describe a Tablet event.
Definition: qevent.h:179
void hide()
Hides the widget.
Definition: qwidget.h:501
QString styleSheet
the widget&#39;s style sheet
Definition: qwidget.h:220
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
static QWidget * parentWidget(const QWidget *w)
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
void setMouseTracking(bool enable)
Definition: qwidget.h:990
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
Qt::LayoutDirection layoutDirection
the layout direction for this widget
Definition: qwidget.h:216
virtual void contextMenuEvent(QContextMenuEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive widget context men...
Definition: qwidget.cpp:9645
InputMethodQuery
Definition: qnamespace.h:1541
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QInputMethodEvent class provides parameters for input method events.
Definition: qevent.h:431
virtual void tabletEvent(QTabletEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive tablet events for ...
Definition: qwidget.cpp:9347
void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp)
virtual void dragMoveEvent(QDragMoveEvent *)
This event handler is called if a drag is in progress, and when any of the following conditions occur...
Definition: qwidget.cpp:9786
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
struct tagMSG MSG
The QGLWidget class is a widget for rendering OpenGL graphics.
Definition: qgl.h:474
The QX11Info class provides information about the X display configuration.
Definition: qx11info_x11.h:63
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
Definition: qevent.h:476
QT_MOC_COMPAT void setShown(bool shown)
Use setVisible(shown) instead.
Definition: qwidget.h:502
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
virtual void wheelEvent(QWheelEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive wheel events for t...
Definition: qwidget.cpp:9326
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
bool focusNextChild()
Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can ...
Definition: qwidget.h:730
FocusReason
Definition: qnamespace.h:1521
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
virtual void hideEvent(QHideEvent *)
This event handler can be reimplemented in a subclass to receive widget hide events.
Definition: qwidget.cpp:9864
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
bool hasMouseTracking() const
Definition: qwidget.h:993
virtual void dropEvent(QDropEvent *)
This event handler is called when the drag is dropped on this widget.
Definition: qwidget.cpp:9817
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
bool isEnabledToTLW() const
This function is deprecated.
Definition: qwidget.h:954
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
Definition: qevent.h:555
uint focus_policy
Definition: qwidget.h:121
int key
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition: qpalette.h:201
virtual void closeEvent(QCloseEvent *)
This event handler is called with the given event when Qt receives a window close request for a top-l...
Definition: qwidget.cpp:9626
virtual bool focusNextPrevChild(bool next)
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can&#39;t.
Definition: qwidget.cpp:6836
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
FocusPolicy
Definition: qnamespace.h:181
int maximumHeight() const
bool isTopLevel() const
Use isWindow() instead.
Definition: qwidget.h:942
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
The QColorGroup class contains color groups for each widget state.
OSViewRef qt_mac_nativeview_for(const QWidget *)
Definition: qwidget_mac.mm:419
virtual bool qwsEvent(QWSEvent *)
This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux...
Definition: qwidget.cpp:9993
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
QFontInfo fontInfo() const
Returns the font info for the widget&#39;s current font.
Definition: qwidget.h:987
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
static QWSWindow * keyboardGrabber
bool isLeftToRight() const
Definition: qwidget.h:429
bool modal
Definition: qmenu_mac.mm:99
bool focusPreviousChild()
Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if i...
Definition: qwidget.h:731
QLocale locale
the widget&#39;s locale
Definition: qwidget.h:222
uint in_destructor
Definition: qwidget.h:129
const QFont & font() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize sizeHint
the recommended size for the widget
Definition: qwidget.h:195
struct OpaqueEventHandlerCallRef * EventHandlerCallRef
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
bool isRightToLeft() const
Definition: qwidget.h:428
uint fstrut_dirty
Definition: qwidget.h:126
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QPalette pal
Definition: qwidget.h:132
ShortcutContext
Definition: qnamespace.h:1478
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
bool testAttribute_helper(Qt::WidgetAttribute) const
Definition: qwidget.cpp:11453
virtual void mouseMoveEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition: qwidget.cpp:9239
HIViewRef OSViewRef
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
The QMargins class defines the four margins of a rectangle.
Definition: qmargins.h:53
Q_GUI_EXPORT QPoint qt_mac_posInWindow(const QWidget *w)
Definition: qwidget_mac.mm:380
QLayout * takeLayout()
Remove the layout from the widget.
Definition: qwidget.cpp:10153
const QRect & geometry() const
virtual void dragLeaveEvent(QDragLeaveEvent *)
This event handler is called when a drag is in progress and the mouse leaves this widget...
Definition: qwidget.cpp:9802
Qt::InputMethodHints inputMethodHints
What input method specific hints the widget has.
Definition: qwidget.h:224
QString statusTip
the widget&#39;s status tip
Definition: qwidget.h:207
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
QString toolTip
the widget&#39;s tooltip
Definition: qwidget.h:204
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Qt::InputMethodHints inputMethodHints() const
int minimumWidth() const
Q_GUI_EXPORT QWidgetData * qt_qwidget_data(QWidget *widget)
Definition: qwidget.cpp:12915
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
#define QT_END_HEADER
Definition: qglobal.h:137
virtual void focusInEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
Definition: qwidget.cpp:9431
WindowModality
Definition: qnamespace.h:1683
The QCloseEvent class contains parameters that describe a close event.
Definition: qevent.h:364
RenderFlag
This enum describes how to render the widget when calling QWidget::render().
Definition: qwidget.h:227
#define enabled
The QFocusEvent class contains event parameters for widget focus events.
Definition: qevent.h:275
uint context_menu_policy
Definition: qwidget.h:127
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
virtual void enterEvent(QEvent *)
This event handler can be reimplemented in a subclass to receive widget enter events which are passed...
Definition: qwidget.cpp:9475
WId winid
Definition: qwidget.h:117
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011
uint in_show
Definition: qwidget.h:124
The QGraphicsEffect class is the base class for all graphics effects.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
Qt::LayoutDirection direction
Q_GUI_EXPORT void qt_event_request_window_change()
void qt_net_remove_user_time(QWidget *tlw)
QWidget * topLevelWidget() const
Definition: qwidget.h:328
int maximumWidth() const
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60