2010-07-29 12:15:55 +02:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
**
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
**
|
|
|
|
** Commercial Usage
|
|
|
|
**
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
#ifndef QDECLARATIVEVIEWOBSERVER_H
|
|
|
|
#define QDECLARATIVEVIEWOBSERVER_H
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
#include "qmljsdebugger_global.h"
|
2010-09-16 16:43:22 +02:00
|
|
|
#include "qmlobserverconstants.h"
|
2010-07-29 12:15:55 +02:00
|
|
|
#include <qdeclarativeview.h>
|
|
|
|
#include <QWeakPointer>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QDeclarativeItem);
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QMouseEvent);
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QToolBar);
|
|
|
|
|
2010-09-16 15:59:52 +02:00
|
|
|
namespace QmlObserver {
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
class CrumblePath;
|
2010-09-14 13:39:32 +02:00
|
|
|
class QDeclarativeViewObserverPrivate;
|
2010-07-29 12:15:55 +02:00
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QObject
|
2010-07-29 12:15:55 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0);
|
|
|
|
~QDeclarativeViewObserver();
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
void setSelectedItems(QList<QGraphicsItem *> items);
|
|
|
|
QList<QGraphicsItem *> selectedItems();
|
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
QDeclarativeView *declarativeView();
|
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
QToolBar *toolbar() const;
|
|
|
|
static QString idStringForObject(QObject *obj);
|
|
|
|
QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace);
|
2010-08-18 13:54:12 +02:00
|
|
|
void setDebugMode(bool isDebugMode);
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void setDesignModeBehavior(bool value);
|
2010-07-30 12:56:25 +02:00
|
|
|
bool designModeBehavior();
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
void changeAnimationSpeed(qreal slowdownFactor);
|
|
|
|
void continueExecution(qreal slowdownFactor = 1.0f);
|
|
|
|
void pauseExecution();
|
|
|
|
|
2010-09-16 16:20:12 +02:00
|
|
|
void setObserverContext(int contextIndex);
|
2010-07-30 16:09:17 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
Q_SIGNALS:
|
|
|
|
void designModeBehaviorChanged(bool inDesignMode);
|
|
|
|
void reloadRequested();
|
|
|
|
void marqueeSelectToolActivated();
|
|
|
|
void selectToolActivated();
|
|
|
|
void zoomToolActivated();
|
|
|
|
void colorPickerActivated();
|
|
|
|
void selectedColorChanged(const QColor &color);
|
|
|
|
|
|
|
|
void executionStarted(qreal slowdownFactor);
|
|
|
|
void executionPaused();
|
|
|
|
|
2010-07-30 16:09:17 +02:00
|
|
|
void inspectorContextCleared();
|
|
|
|
void inspectorContextPushed(const QString &contextTitle);
|
|
|
|
void inspectorContextPopped();
|
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
protected:
|
2010-09-14 13:39:32 +02:00
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
|
|
|
|
bool leaveEvent(QEvent *);
|
|
|
|
bool mousePressEvent(QMouseEvent *event);
|
|
|
|
bool mouseMoveEvent(QMouseEvent *event);
|
|
|
|
bool mouseReleaseEvent(QMouseEvent *event);
|
|
|
|
bool keyPressEvent(QKeyEvent *event);
|
|
|
|
bool keyReleaseEvent(QKeyEvent *keyEvent);
|
|
|
|
bool mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
bool wheelEvent(QWheelEvent *event);
|
2010-07-29 12:15:55 +02:00
|
|
|
|
2010-07-30 17:43:21 +02:00
|
|
|
void setSelectedItemsForTools(QList<QGraphicsItem *> items);
|
2010-08-06 14:03:13 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
private:
|
2010-09-14 13:39:32 +02:00
|
|
|
Q_DISABLE_COPY(QDeclarativeViewObserver)
|
2010-07-30 12:56:25 +02:00
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_reloadView())
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_onStatusChanged(QDeclarativeView::Status))
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_onCurrentObjectsChanged(QList<QObject*>))
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_applyChangesFromClient())
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_createQmlObject(const QString &, QObject *, const QStringList &, const QString &))
|
2010-08-26 17:38:31 +02:00
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_reparentQmlObject(QObject *, QObject *))
|
2010-07-30 12:56:25 +02:00
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_changeToSingleSelectTool())
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_changeToMarqueeSelectTool())
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_changeToZoomTool())
|
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_changeToColorPickerTool())
|
2010-08-03 10:17:09 +02:00
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_changeContextPathIndex(int index))
|
2010-08-03 14:07:30 +02:00
|
|
|
Q_PRIVATE_SLOT(d_func(), void _q_clearComponentCache());
|
2010-07-30 12:56:25 +02:00
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
inline QDeclarativeViewObserverPrivate *d_func() { return data.data(); }
|
|
|
|
QScopedPointer<QDeclarativeViewObserverPrivate> data;
|
|
|
|
friend class QDeclarativeViewObserverPrivate;
|
2010-08-26 17:11:17 +02:00
|
|
|
friend class AbstractFormEditorTool;
|
2010-07-29 12:15:55 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-09-16 15:59:52 +02:00
|
|
|
} //namespace QmlObserver
|
2010-07-29 12:15:55 +02:00
|
|
|
|
2010-09-14 13:39:32 +02:00
|
|
|
#endif // QDECLARATIVEVIEWOBSERVER_H
|