qgraphicssceneevent.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QGRAPHICSSCENEEVENT_H
00043 #define QGRAPHICSSCENEEVENT_H
00044 
00045 #include <QtCore/qcoreevent.h>
00046 #include <QtCore/qpoint.h>
00047 #include <QtCore/qscopedpointer.h>
00048 #include <QtCore/qrect.h>
00049 #include <QtGui/qpolygon.h>
00050 #include <QtCore/qset.h>
00051 #include <QtCore/qhash.h>
00052 
00053 QT_BEGIN_HEADER
00054 
00055 QT_BEGIN_NAMESPACE
00056 
00057 QT_MODULE(Gui)
00058 
00059 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
00060 
00061 class QMimeData;
00062 class QPointF;
00063 class QSizeF;
00064 class QWidget;
00065 
00066 class QGraphicsSceneEventPrivate;
00067 class Q_GUI_EXPORT QGraphicsSceneEvent : public QEvent
00068 {
00069 public:
00070     QGraphicsSceneEvent(Type type);
00071     ~QGraphicsSceneEvent();
00072 
00073     QWidget *widget() const;
00074     void setWidget(QWidget *widget);
00075 
00076 protected:
00077     QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None);
00078     QScopedPointer<QGraphicsSceneEventPrivate> d_ptr;
00079     Q_DECLARE_PRIVATE(QGraphicsSceneEvent)
00080 private:
00081     Q_DISABLE_COPY(QGraphicsSceneEvent)
00082 };
00083 
00084 class QGraphicsSceneMouseEventPrivate;
00085 class Q_GUI_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
00086 {
00087 public:
00088     QGraphicsSceneMouseEvent(Type type = None);
00089     ~QGraphicsSceneMouseEvent();
00090 
00091     QPointF pos() const;
00092     void setPos(const QPointF &pos);
00093 
00094     QPointF scenePos() const;
00095     void setScenePos(const QPointF &pos);
00096 
00097     QPoint screenPos() const;
00098     void setScreenPos(const QPoint &pos);
00099 
00100     QPointF buttonDownPos(Qt::MouseButton button) const;
00101     void setButtonDownPos(Qt::MouseButton button, const QPointF &pos);
00102 
00103     QPointF buttonDownScenePos(Qt::MouseButton button) const;
00104     void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos);
00105 
00106     QPoint buttonDownScreenPos(Qt::MouseButton button) const;
00107     void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos);
00108 
00109     QPointF lastPos() const;
00110     void setLastPos(const QPointF &pos);
00111 
00112     QPointF lastScenePos() const;
00113     void setLastScenePos(const QPointF &pos);
00114 
00115     QPoint lastScreenPos() const;
00116     void setLastScreenPos(const QPoint &pos);
00117 
00118     Qt::MouseButtons buttons() const;
00119     void setButtons(Qt::MouseButtons buttons);
00120 
00121     Qt::MouseButton button() const;
00122     void setButton(Qt::MouseButton button);
00123 
00124     Qt::KeyboardModifiers modifiers() const;
00125     void setModifiers(Qt::KeyboardModifiers modifiers);
00126 
00127 private:
00128     Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent)
00129     Q_DISABLE_COPY(QGraphicsSceneMouseEvent)
00130 };
00131 
00132 class QGraphicsSceneWheelEventPrivate;
00133 class Q_GUI_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
00134 {
00135 public:
00136     QGraphicsSceneWheelEvent(Type type = None);
00137     ~QGraphicsSceneWheelEvent();
00138 
00139     QPointF pos() const;
00140     void setPos(const QPointF &pos);
00141 
00142     QPointF scenePos() const;
00143     void setScenePos(const QPointF &pos);
00144 
00145     QPoint screenPos() const;
00146     void setScreenPos(const QPoint &pos);
00147 
00148     Qt::MouseButtons buttons() const;
00149     void setButtons(Qt::MouseButtons buttons);
00150 
00151     Qt::KeyboardModifiers modifiers() const;
00152     void setModifiers(Qt::KeyboardModifiers modifiers);
00153 
00154     int delta() const;
00155     void setDelta(int delta);
00156 
00157     Qt::Orientation orientation() const;
00158     void setOrientation(Qt::Orientation orientation);
00159 
00160 private:
00161     Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent)
00162     Q_DISABLE_COPY(QGraphicsSceneWheelEvent)
00163 };
00164 
00165 class QGraphicsSceneContextMenuEventPrivate;
00166 class Q_GUI_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent
00167 {
00168 public:
00169     enum Reason { Mouse, Keyboard, Other };
00170 
00171     QGraphicsSceneContextMenuEvent(Type type = None);
00172     ~QGraphicsSceneContextMenuEvent();
00173 
00174     QPointF pos() const;
00175     void setPos(const QPointF &pos);
00176 
00177     QPointF scenePos() const;
00178     void setScenePos(const QPointF &pos);
00179 
00180     QPoint screenPos() const;
00181     void setScreenPos(const QPoint &pos);
00182 
00183     Qt::KeyboardModifiers modifiers() const;
00184     void setModifiers(Qt::KeyboardModifiers modifiers);
00185 
00186     Reason reason() const;
00187     void setReason(Reason reason);
00188 
00189 private:
00190     Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent)
00191     Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent)
00192 };
00193 
00194 class QGraphicsSceneHoverEventPrivate;
00195 class Q_GUI_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
00196 {
00197 public:
00198     QGraphicsSceneHoverEvent(Type type = None);
00199     ~QGraphicsSceneHoverEvent();
00200 
00201     QPointF pos() const;
00202     void setPos(const QPointF &pos);
00203 
00204     QPointF scenePos() const;
00205     void setScenePos(const QPointF &pos);
00206 
00207     QPoint screenPos() const;
00208     void setScreenPos(const QPoint &pos);
00209 
00210     QPointF lastPos() const;
00211     void setLastPos(const QPointF &pos);
00212 
00213     QPointF lastScenePos() const;
00214     void setLastScenePos(const QPointF &pos);
00215 
00216     QPoint lastScreenPos() const;
00217     void setLastScreenPos(const QPoint &pos);
00218 
00219     Qt::KeyboardModifiers modifiers() const;
00220     void setModifiers(Qt::KeyboardModifiers modifiers);
00221 
00222 private:
00223     Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent)
00224     Q_DISABLE_COPY(QGraphicsSceneHoverEvent)
00225 };
00226 
00227 class QGraphicsSceneHelpEventPrivate;
00228 class Q_GUI_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
00229 {
00230 public:
00231     QGraphicsSceneHelpEvent(Type type = None);
00232     ~QGraphicsSceneHelpEvent();
00233 
00234     QPointF scenePos() const;
00235     void setScenePos(const QPointF &pos);
00236 
00237     QPoint screenPos() const;
00238     void setScreenPos(const QPoint &pos);
00239 
00240 private:
00241     Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent)
00242     Q_DISABLE_COPY(QGraphicsSceneHelpEvent)
00243 };
00244 
00245 class QGraphicsSceneDragDropEventPrivate;
00246 class Q_GUI_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
00247 {
00248 public:
00249     QGraphicsSceneDragDropEvent(Type type = None);
00250     ~QGraphicsSceneDragDropEvent();
00251 
00252     QPointF pos() const;
00253     void setPos(const QPointF &pos);
00254 
00255     QPointF scenePos() const;
00256     void setScenePos(const QPointF &pos);
00257 
00258     QPoint screenPos() const;
00259     void setScreenPos(const QPoint &pos);
00260 
00261     Qt::MouseButtons buttons() const;
00262     void setButtons(Qt::MouseButtons buttons);
00263 
00264     Qt::KeyboardModifiers modifiers() const;
00265     void setModifiers(Qt::KeyboardModifiers modifiers);
00266 
00267     Qt::DropActions possibleActions() const;
00268     void setPossibleActions(Qt::DropActions actions);
00269 
00270     Qt::DropAction proposedAction() const;
00271     void setProposedAction(Qt::DropAction action);
00272     void acceptProposedAction();
00273 
00274     Qt::DropAction dropAction() const;
00275     void setDropAction(Qt::DropAction action);
00276 
00277     QWidget *source() const;
00278     void setSource(QWidget *source);
00279 
00280     const QMimeData *mimeData() const;
00281     void setMimeData(const QMimeData *data);
00282 
00283 private:
00284     Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent)
00285     Q_DISABLE_COPY(QGraphicsSceneDragDropEvent)
00286 };
00287 
00288 class QGraphicsSceneResizeEventPrivate;
00289 class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent
00290 {
00291     Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent)
00292     Q_DISABLE_COPY(QGraphicsSceneResizeEvent)
00293 public:
00294     QGraphicsSceneResizeEvent();
00295     ~QGraphicsSceneResizeEvent();
00296 
00297     QSizeF oldSize() const;
00298     void setOldSize(const QSizeF &size);
00299 
00300     QSizeF newSize() const;
00301     void setNewSize(const QSizeF &size);
00302 };
00303 
00304 class QGraphicsSceneMoveEventPrivate;
00305 class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent
00306 {
00307     Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent)
00308     Q_DISABLE_COPY(QGraphicsSceneMoveEvent)
00309 public:
00310     QGraphicsSceneMoveEvent();
00311     ~QGraphicsSceneMoveEvent();
00312 
00313     QPointF oldPos() const;
00314     void setOldPos(const QPointF &pos);
00315 
00316     QPointF newPos() const;
00317     void setNewPos(const QPointF &pos);
00318 };
00319 
00320 #endif // QT_NO_GRAPHICSVIEW
00321 
00322 QT_END_NAMESPACE
00323 
00324 QT_END_HEADER
00325 
00326 #endif