1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWIDGETWINDOW_P_H
5#define QWIDGETWINDOW_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include <QtGui/qwindow.h>
20
21#include <QtCore/private/qobject_p.h>
22#include <QtGui/private/qevent_p.h>
23#include <QtWidgets/qwidget.h>
24
25QT_BEGIN_NAMESPACE
26
27
28class QCloseEvent;
29class QMoveEvent;
30class QWidgetWindowPrivate;
31
32class QWidgetWindow : public QWindow
33{
34 Q_OBJECT
35 Q_DECLARE_PRIVATE(QWidgetWindow)
36public:
37 QWidgetWindow(QWidget *widget);
38 ~QWidgetWindow();
39
40 QWidget *widget() const { return m_widget; }
41#if QT_CONFIG(accessibility)
42 QAccessibleInterface *accessibleRoot() const override;
43#endif
44
45 QObject *focusObject() const override;
46 void setNativeWindowVisibility(bool visible);
47protected:
48 bool event(QEvent *) override;
49
50 void closeEvent(QCloseEvent *) override;
51
52 void handleEnterLeaveEvent(QEvent *);
53 void handleFocusInEvent(QFocusEvent *);
54 void handleKeyEvent(QKeyEvent *);
55 void handleMouseEvent(QMouseEvent *);
56 void handleNonClientAreaMouseEvent(QMouseEvent *);
57 void handleTouchEvent(QTouchEvent *);
58 void handleMoveEvent(QMoveEvent *);
59 void handleResizeEvent(QResizeEvent *);
60#if QT_CONFIG(wheelevent)
61 void handleWheelEvent(QWheelEvent *);
62#endif
63#if QT_CONFIG(draganddrop)
64 void handleDragEnterEvent(QDragEnterEvent *, QWidget *widget = nullptr);
65 void handleDragMoveEvent(QDragMoveEvent *);
66 void handleDragLeaveEvent(QDragLeaveEvent *);
67 void handleDropEvent(QDropEvent *);
68#endif
69 void handleExposeEvent(QExposeEvent *);
70 void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
71 bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
72#if QT_CONFIG(tabletevent)
73 void handleTabletEvent(QTabletEvent *);
74#endif
75#ifndef QT_NO_GESTURES
76 void handleGestureEvent(QNativeGestureEvent *);
77#endif
78#ifndef QT_NO_CONTEXTMENU
79 void handleContextMenuEvent(QContextMenuEvent *);
80#endif
81
82private slots:
83 void updateObjectName();
84
85private:
86 void handleScreenChange();
87 void handleDevicePixelRatioChange();
88 void repaintWindow();
89 bool updateSize();
90 void updateMargins();
91 void updateNormalGeometry();
92
93 enum FocusWidgets {
94 FirstFocusWidget,
95 LastFocusWidget
96 };
97 QWidget *getFocusWidget(FocusWidgets fw);
98
99 QPointer<QWidget> m_widget;
100 QPointer<QWidget> m_implicit_mouse_grabber;
101#if QT_CONFIG(draganddrop)
102 QPointer<QWidget> m_dragTarget;
103#endif
104};
105
106QT_END_NAMESPACE
107
108#endif // QWIDGETWINDOW_P_H
109

source code of qtbase/src/widgets/kernel/qwidgetwindow_p.h