QtGui/qgraphicsproxywidget.h Source File

qgraphicsproxywidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QGRAPHICSPROXYWIDGET_H
43 #define QGRAPHICSPROXYWIDGET_H
44 
45 #include <QtGui/qgraphicswidget.h>
46 
48 
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);
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
91 #endif
92 
93 #ifndef QT_NO_DRAGANDDROP
98 #endif
99 
103  void grabMouseEvent(QEvent *event);
104  void ungrabMouseEvent(QEvent *event);
105 
110 #ifndef QT_NO_WHEELEVENT
112 #endif
113 
114  void keyPressEvent(QKeyEvent *event);
115  void keyReleaseEvent(QKeyEvent *event);
116 
117  void focusInEvent(QFocusEvent *event);
118  void focusOutEvent(QFocusEvent *event);
119  bool focusNextPrevChild(bool next);
120  // ### Qt 4.5:
121  // QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
122  // void inputMethodEvent(QInputMethodEvent *event);
123 
124  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
126 
127 protected Q_SLOTS:
128  QGraphicsProxyWidget *newProxyWidget(const QWidget *);
129 
130 private:
131  Q_DISABLE_COPY(QGraphicsProxyWidget)
132  Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsProxyWidget)
133  Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot())
134 
135  friend class QWidget;
136  friend class QWidgetPrivate;
137  friend class QGraphicsItem;
138 };
139 
140 #endif
141 
143 
145 
146 #endif
147 
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
virtual bool eventFilter(QObject *, QEvent *)
#define QT_END_NAMESPACE
Definition: qglobal.h:128
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
int type() const
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
#define Q_SLOTS
Definition: qobjectdefs.h:71
virtual void keyPressEvent(QKeyEvent *event)
void focusOutEvent(QFocusEvent *event)
void focusInEvent(QFocusEvent *event)
SizeHint
Definition: qnamespace.h:1708
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
virtual void keyReleaseEvent(QKeyEvent *event)
virtual void resizeEvent(QGraphicsSceneResizeEvent *event)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
virtual void showEvent(QShowEvent *event)
Definition: qsize.h:202
virtual void ungrabMouseEvent(QEvent *event)
#define Q_OBJECT
Definition: qobjectdefs.h:157
void setGeometry(const QRectF &rect)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
virtual void hideEvent(QHideEvent *event)
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
GLsizei const GLfloat * value
Definition: GLee.h:1742
Definition: qrect.h:511
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
bool event(QEvent *event)
virtual void dropEvent(QGraphicsSceneDragDropEvent *event)
virtual bool focusNextPrevChild(bool next)
#define QT_END_HEADER
Definition: qglobal.h:142
virtual void grabMouseEvent(QEvent *event)
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const