1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
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 [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QGRAPHICSPROXYWIDGET_H
|
---|
43 | #define QGRAPHICSPROXYWIDGET_H
|
---|
44 |
|
---|
45 | #include <QtGui/qgraphicswidget.h>
|
---|
46 |
|
---|
47 | QT_BEGIN_HEADER
|
---|
48 |
|
---|
49 | QT_BEGIN_NAMESPACE
|
---|
50 |
|
---|
51 | QT_MODULE(Gui)
|
---|
52 |
|
---|
53 | #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
|
---|
54 |
|
---|
55 | class QGraphicsProxyWidgetPrivate;
|
---|
56 |
|
---|
57 | class Q_GUI_EXPORT QGraphicsProxyWidget : public QGraphicsWidget
|
---|
58 | {
|
---|
59 | Q_OBJECT
|
---|
60 | public:
|
---|
61 | QGraphicsProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
|
---|
62 | ~QGraphicsProxyWidget();
|
---|
63 |
|
---|
64 | void setWidget(QWidget *widget);
|
---|
65 | QWidget *widget() const;
|
---|
66 |
|
---|
67 | QRectF subWidgetRect(const QWidget *widget) const;
|
---|
68 |
|
---|
69 | void setGeometry(const QRectF &rect);
|
---|
70 |
|
---|
71 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
---|
72 |
|
---|
73 | enum {
|
---|
74 | Type = 12
|
---|
75 | };
|
---|
76 | int type() const;
|
---|
77 |
|
---|
78 | QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child);
|
---|
79 |
|
---|
80 | protected:
|
---|
81 | QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
---|
82 |
|
---|
83 | bool event(QEvent *event);
|
---|
84 | bool eventFilter(QObject *object, QEvent *event);
|
---|
85 |
|
---|
86 | void showEvent(QShowEvent *event);
|
---|
87 | void hideEvent(QHideEvent *event);
|
---|
88 |
|
---|
89 | #ifndef QT_NO_CONTEXTMENU
|
---|
90 | void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
---|
91 | #endif
|
---|
92 |
|
---|
93 | void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
|
---|
94 | void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
|
---|
95 | void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
|
---|
96 | void dropEvent(QGraphicsSceneDragDropEvent *event);
|
---|
97 |
|
---|
98 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
---|
99 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
---|
100 | void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
---|
101 | void grabMouseEvent(QEvent *event);
|
---|
102 | void ungrabMouseEvent(QEvent *event);
|
---|
103 |
|
---|
104 | void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
---|
105 | void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
---|
106 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
---|
107 | void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
---|
108 | #ifndef QT_NO_WHEELEVENT
|
---|
109 | void wheelEvent(QGraphicsSceneWheelEvent *event);
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | void keyPressEvent(QKeyEvent *event);
|
---|
113 | void keyReleaseEvent(QKeyEvent *event);
|
---|
114 |
|
---|
115 | void focusInEvent(QFocusEvent *event);
|
---|
116 | void focusOutEvent(QFocusEvent *event);
|
---|
117 | bool focusNextPrevChild(bool next);
|
---|
118 | // ### Qt 4.5:
|
---|
119 | // QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
|
---|
120 | // void inputMethodEvent(QInputMethodEvent *event);
|
---|
121 |
|
---|
122 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
|
---|
123 | void resizeEvent(QGraphicsSceneResizeEvent *event);
|
---|
124 |
|
---|
125 | protected Q_SLOTS:
|
---|
126 | QGraphicsProxyWidget *newProxyWidget(const QWidget *);
|
---|
127 |
|
---|
128 | private:
|
---|
129 | Q_DISABLE_COPY(QGraphicsProxyWidget)
|
---|
130 | Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QGraphicsProxyWidget)
|
---|
131 | Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot())
|
---|
132 |
|
---|
133 | friend class QWidget;
|
---|
134 | friend class QWidgetPrivate;
|
---|
135 | friend class QGraphicsItem;
|
---|
136 | };
|
---|
137 |
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | QT_END_NAMESPACE
|
---|
141 |
|
---|
142 | QT_END_HEADER
|
---|
143 |
|
---|
144 | #endif
|
---|
145 |
|
---|