1 /****************************************************************************
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QQUICKCANVAS_H
43 #define QQUICKCANVAS_H
45 #include <QtCore/qmetatype.h>
46 #include <QtGui/qopengl.h>
47 #include <QtGui/qwindow.h>
53 QT_MODULE(Declarative)
57 class QQuickCanvasPrivate;
58 class QOpenGLFramebufferObject;
59 class QDeclarativeIncubationController;
61 class Q_DECLARATIVE_EXPORT QQuickCanvas : public QWindow
64 Q_DECLARE_PRIVATE(QQuickCanvas)
66 QQuickCanvas(QWindow *parent = 0);
68 virtual ~QQuickCanvas();
70 QQuickItem *rootItem() const;
71 QQuickItem *activeFocusItem() const;
73 QQuickItem *mouseGrabberItem() const;
75 bool sendEvent(QQuickItem *, QEvent *);
77 QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
79 QSGEngine *sceneGraphEngine() const;
81 void setVSyncAnimations(bool enabled);
82 bool vsyncAnimations() const;
84 QImage grabFrameBuffer();
86 void setRenderTarget(QOpenGLFramebufferObject *fbo);
87 QOpenGLFramebufferObject *renderTarget() const;
89 QDeclarativeIncubationController *incubationController() const;
93 void sceneGraphInitialized();
96 QQuickCanvas(QQuickCanvasPrivate &dd, QWindow *parent = 0);
98 virtual void exposeEvent(QExposeEvent *);
99 virtual void resizeEvent(QResizeEvent *);
101 virtual void showEvent(QShowEvent *);
102 virtual void hideEvent(QHideEvent *);
104 virtual void focusInEvent(QFocusEvent *);
105 virtual void focusOutEvent(QFocusEvent *);
107 virtual bool event(QEvent *);
108 virtual void keyPressEvent(QKeyEvent *);
109 virtual void keyReleaseEvent(QKeyEvent *);
110 virtual void inputMethodEvent(QInputMethodEvent *);
111 virtual void mousePressEvent(QMouseEvent *);
112 virtual void mouseReleaseEvent(QMouseEvent *);
113 virtual void mouseDoubleClickEvent(QMouseEvent *);
114 virtual void mouseMoveEvent(QMouseEvent *);
115 #ifndef QT_NO_WHEELEVENT
116 virtual void wheelEvent(QWheelEvent *);
120 void sceneGraphChanged();
122 void animationStarted();
123 void animationStopped();
126 friend class QQuickItem;
127 friend class QQuickCanvasRenderLoop;
128 Q_DISABLE_COPY(QQuickCanvas)
133 Q_DECLARE_METATYPE(QQuickCanvas *)
137 #endif // QQUICKCANVAS_H