90a90e07a61b9ef1061f97c3bf038ea2c16b38c1
[profile/ivi/qtbase.git] / src / widgets / graphicsview / qgraphicsproxywidget.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QGRAPHICSPROXYWIDGET_H
43 #define QGRAPHICSPROXYWIDGET_H
44
45 #include <QtWidgets/qgraphicswidget.h>
46
47 QT_BEGIN_HEADER
48
49 QT_BEGIN_NAMESPACE
50
51
52 #if !defined(QT_NO_GRAPHICSVIEW)
53
54 class QGraphicsProxyWidgetPrivate;
55
56 class Q_WIDGETS_EXPORT QGraphicsProxyWidget : public QGraphicsWidget
57 {
58     Q_OBJECT
59 public:
60     QGraphicsProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
61     ~QGraphicsProxyWidget();
62
63     void setWidget(QWidget *widget);
64     QWidget *widget() const;
65
66     QRectF subWidgetRect(const QWidget *widget) const;
67
68     void setGeometry(const QRectF &rect);
69
70     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
71
72     enum {
73         Type = 12
74     };
75     int type() const;
76
77     QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child);
78
79 protected:
80     QVariant itemChange(GraphicsItemChange change, const QVariant &value);
81
82     bool event(QEvent *event);
83     bool eventFilter(QObject *object, QEvent *event);
84
85     void showEvent(QShowEvent *event);
86     void hideEvent(QHideEvent *event);
87
88 #ifndef QT_NO_CONTEXTMENU
89     void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
90 #endif
91
92 #ifndef QT_NO_DRAGANDDROP
93     void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
94     void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
95     void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
96     void dropEvent(QGraphicsSceneDragDropEvent *event);
97 #endif
98
99     void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
100     void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
101     void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
102     void grabMouseEvent(QEvent *event);
103     void ungrabMouseEvent(QEvent *event);
104
105     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
106     void mousePressEvent(QGraphicsSceneMouseEvent *event);
107     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
108     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
109 #ifndef QT_NO_WHEELEVENT
110     void wheelEvent(QGraphicsSceneWheelEvent *event);
111 #endif
112
113     void keyPressEvent(QKeyEvent *event);
114     void keyReleaseEvent(QKeyEvent *event);
115
116     void focusInEvent(QFocusEvent *event);
117     void focusOutEvent(QFocusEvent *event);
118     bool focusNextPrevChild(bool next);
119     // ### Qt 4.5:
120     // QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
121     // void inputMethodEvent(QInputMethodEvent *event);
122
123     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
124     void resizeEvent(QGraphicsSceneResizeEvent *event);
125
126 protected Q_SLOTS:
127     QGraphicsProxyWidget *newProxyWidget(const QWidget *);
128
129 private:
130     Q_DISABLE_COPY(QGraphicsProxyWidget)
131     Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsProxyWidget)
132     Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot())
133
134     friend class QWidget;
135     friend class QWidgetPrivate;
136     friend class QGraphicsItem;
137 };
138
139 #endif
140
141 QT_END_NAMESPACE
142
143 QT_END_HEADER
144
145 #endif
146