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 QGRAPHICSPROXYWIDGET_P_H
5#define QGRAPHICSPROXYWIDGET_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 for the convenience
12// of other Qt classes. 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 "qgraphicsproxywidget.h"
20#include "private/qgraphicswidget_p.h"
21
22QT_REQUIRE_CONFIG(graphicsview);
23
24QT_BEGIN_NAMESPACE
25
26class Q_AUTOTEST_EXPORT QGraphicsProxyWidgetPrivate : public QGraphicsWidgetPrivate
27{
28 Q_DECLARE_PUBLIC(QGraphicsProxyWidget)
29public:
30 QGraphicsProxyWidgetPrivate();
31 ~QGraphicsProxyWidgetPrivate();
32
33 void init();
34 void sendWidgetMouseEvent(QGraphicsSceneMouseEvent *event);
35 void sendWidgetMouseEvent(QGraphicsSceneHoverEvent *event);
36 void sendWidgetKeyEvent(QKeyEvent *event);
37 void setWidget_helper(QWidget *widget, bool autoShow);
38
39 QWidget *findFocusChild(QWidget *child, bool next) const;
40 void removeSubFocusHelper(QWidget *widget, Qt::FocusReason reason);
41
42 void _q_removeWidgetSlot();
43
44 void embedSubWindow(QWidget *);
45 void unembedSubWindow(QWidget *);
46
47 bool isProxyWidget() const override;
48
49 QPointer<QWidget> widget;
50 QPointer<QWidget> lastWidgetUnderMouse;
51 QPointer<QWidget> embeddedMouseGrabber;
52 QWidget *dragDropWidget;
53 Qt::DropAction lastDropAction;
54
55 void updateWidgetGeometryFromProxy();
56 void updateProxyGeometryFromWidget();
57
58 void updateProxyInputMethodAcceptanceFromWidget();
59
60 QPointF mapToReceiver(const QPointF &pos, const QWidget *receiver) const;
61
62 enum ChangeMode {
63 NoMode,
64 ProxyToWidgetMode,
65 WidgetToProxyMode
66 };
67 quint32 posChangeMode : 2;
68 quint32 sizeChangeMode : 2;
69 quint32 visibleChangeMode : 2;
70 quint32 enabledChangeMode : 2;
71 quint32 styleChangeMode : 2;
72 quint32 paletteChangeMode : 2;
73 quint32 tooltipChangeMode : 2;
74 quint32 focusFromWidgetToProxy : 1;
75 quint32 proxyIsGivingFocus : 1;
76};
77
78QT_END_NAMESPACE
79
80#endif
81

source code of qtbase/src/widgets/graphicsview/qgraphicsproxywidget_p.h