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
25#include <QtCore/qpointer.h>
26
27QT_BEGIN_NAMESPACE
28
29
30class QCloseEvent;
31class QMoveEvent;
32class QWidgetWindowPrivate;
33
34class QWidgetWindow : public QWindow
35{
36 Q_OBJECT
37 Q_DECLARE_PRIVATE(QWidgetWindow)
38public:
39 QWidgetWindow(QWidget *widget);
40 ~QWidgetWindow();
41
42 QWidget *widget() const { return m_widget; }
43#if QT_CONFIG(accessibility)
44 QAccessibleInterface *accessibleRoot() const override;
45#endif
46
47 QObject *focusObject() const override;
48 void setNativeWindowVisibility(bool visible);
49 static void focusNextPrevChild(QWidget *widget, bool next);
50
51protected:
52 bool event(QEvent *) override;
53
54 void closeEvent(QCloseEvent *) override;
55
56 void handleEnterLeaveEvent(QEvent *);
57 void handleFocusInEvent(QFocusEvent *);
58 void handleKeyEvent(QKeyEvent *);
59 void handleMouseEvent(QMouseEvent *);
60 void handleNonClientAreaMouseEvent(QMouseEvent *);
61 void handleTouchEvent(QTouchEvent *);
62 void handleMoveEvent(QMoveEvent *);
63 void handleResizeEvent(QResizeEvent *);
64#if QT_CONFIG(wheelevent)
65 void handleWheelEvent(QWheelEvent *);
66#endif
67#if QT_CONFIG(draganddrop)
68 void handleDragEnterEvent(QDragEnterEvent *, QWidget *widget = nullptr);
69 void handleDragMoveEvent(QDragMoveEvent *);
70 void handleDragLeaveEvent(QDragLeaveEvent *);
71 void handleDropEvent(QDropEvent *);
72#endif
73 void handleExposeEvent(QExposeEvent *);
74 void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
75 bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
76#if QT_CONFIG(tabletevent)
77 void handleTabletEvent(QTabletEvent *);
78#endif
79#ifndef QT_NO_GESTURES
80 void handleGestureEvent(QNativeGestureEvent *);
81#endif
82#ifndef QT_NO_CONTEXTMENU
83 void handleContextMenuEvent(QContextMenuEvent *);
84#endif
85
86private slots:
87 void updateObjectName();
88
89private:
90 void handleScreenChange();
91 void handleDevicePixelRatioChange();
92 void repaintWindow();
93 bool updateSize();
94 void updateMargins();
95 void updateNormalGeometry();
96
97 enum FocusWidgets {
98 FirstFocusWidget,
99 LastFocusWidget
100 };
101 QWidget *getFocusWidget(FocusWidgets fw);
102
103 QPointer<QWidget> m_widget;
104 QPointer<QWidget> m_implicit_mouse_grabber;
105#if QT_CONFIG(draganddrop)
106 QPointer<QWidget> m_dragTarget;
107#endif
108};
109
110QT_END_NAMESPACE
111
112#endif // QWIDGETWINDOW_P_H
113

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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