Qt 4.8
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 
56 
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);
105 
110 #ifndef QT_NO_WHEELEVENT
112 #endif
113 
116 
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:
133  Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot())
134 
135  friend class QWidget;
138 };
139 
140 #endif
141 
143 
145 
146 #endif
147 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
int type() const
Reimplemented Function
virtual void ungrabMouseEvent(QEvent *event)
This event handler, for event, can be reimplemented in a subclass to receive notifications for QEvent...
The QKeyEvent class describes a key event.
Definition: qevent.h:224
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Reimplemented Function
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QPointer< QWidget > widget
#define QT_MODULE(x)
Definition: qglobal.h:2783
QScopedPointer< QGraphicsItemPrivate > d_ptr
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
GraphicsItemChange
This enum describes the state changes that are notified by QGraphicsItem::itemChange().
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event event, can be reimplemented to receive mouse doubleclick events for thi...
#define Q_SLOTS
Definition: qobjectdefs.h:71
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event event, can be reimplemented to receive mouse press events for this item...
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented to receive drag enter events for this item...
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
This event handler, for event event, can be reimplemented to receive wheel events for this item...
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void focusOutEvent(QFocusEvent *event)
Reimplemented Function
virtual void keyPressEvent(QKeyEvent *event)
This event handler, for event event, can be reimplemented to receive key press events for this item...
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
virtual bool focusNextPrevChild(bool next)
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget; returns false otherwise.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event event, can be reimplemented to receive mouse move events for this item...
QVariant data(int key) const
Returns this item&#39;s custom data for the key key as a QVariant.
void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
void focusInEvent(QFocusEvent *event)
Reimplemented Function
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
virtual void resizeEvent(QGraphicsSceneResizeEvent *event)
This event handler, for GraphicsSceneResize events, is delivered after the widget has been resized (i...
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
QGraphicsWidget uses the base implementation of this function to catch and deliver events related to ...
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented to receive drag leave events for this item...
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This event handler can be reimplemented in a subclass to process context menu events.
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
#define Q_OBJECT
Definition: qobjectdefs.h:157
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene...
#define Q_DECLARE_PRIVATE_D(Dptr, Class)
Definition: qglobal.h:2472
SizeHint
Definition: qnamespace.h:1708
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented to receive drag move events for this item...
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Reimplemented Function
virtual void grabMouseEvent(QEvent *event)
This event handler, for event, can be reimplemented in a subclass to receive notifications for QEvent...
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
This event handler, for event event, can be reimplemented to receive hover enter events for this item...
bool event(QEvent *event)
Handles the event.
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
Reimplemented Function
virtual void dropEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented to receive drop events for this item...
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler, for event event, can be reimplemented to receive key release events for this item...
virtual void hideEvent(QHideEvent *event)
This event handler, for Hide events, is delivered after the widget has been hidden, for example, setVisible(false) has been called for the widget or one of its ancestors when the widget was previously shown.
#define class
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define QT_END_HEADER
Definition: qglobal.h:137
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
Definition: qstyleoption.h:867
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
This event handler, for event event, can be reimplemented to receive mouse release events for this it...
The QFocusEvent class contains event parameters for widget focus events.
Definition: qevent.h:275
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
virtual void showEvent(QShowEvent *event)
This event handler, for Show events, is delivered before the widget has been shown, for example, setVisible(true) has been called for the widget or one of its ancestors when the widget was previously hidden.
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework...