2010-07-30 12:56:25 +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-07-08 14:00:33 +02:00
|
|
|
#include "qdeclarativedesignview.h"
|
2010-07-29 12:15:55 +02:00
|
|
|
#include "qdeclarativedesignview_p.h"
|
2010-07-08 14:00:33 +02:00
|
|
|
#include "qdeclarativedesigndebugserver.h"
|
|
|
|
#include "selectiontool.h"
|
|
|
|
#include "zoomtool.h"
|
|
|
|
#include "colorpickertool.h"
|
|
|
|
#include "layeritem.h"
|
|
|
|
#include "boundingrecthighlighter.h"
|
|
|
|
#include "subcomponenteditortool.h"
|
|
|
|
#include "qmltoolbar.h"
|
|
|
|
|
|
|
|
#include <QDeclarativeItem>
|
2010-07-16 09:41:56 +02:00
|
|
|
#include <QDeclarativeEngine>
|
|
|
|
#include <QDeclarativeContext>
|
|
|
|
#include <QDeclarativeExpression>
|
2010-07-08 14:00:33 +02:00
|
|
|
#include <QWidget>
|
2010-07-16 09:41:56 +02:00
|
|
|
#include <QMouseEvent>
|
2010-07-08 14:00:33 +02:00
|
|
|
#include <QGraphicsObject>
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
#include <QAbstractAnimation>
|
|
|
|
#include <private/qabstractanimation_p.h>
|
|
|
|
|
|
|
|
namespace QmlViewer {
|
|
|
|
|
|
|
|
Q_GLOBAL_STATIC(QDeclarativeDesignDebugServer, qmlDesignDebugServer)
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QDeclarativeDesignViewPrivate::QDeclarativeDesignViewPrivate(QDeclarativeDesignView *q) :
|
|
|
|
q(q),
|
2010-07-29 12:15:55 +02:00
|
|
|
designModeBehavior(false),
|
|
|
|
executionPaused(false),
|
|
|
|
slowdownFactor(1.0f),
|
|
|
|
toolbar(0)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QDeclarativeDesignViewPrivate::~QDeclarativeDesignViewPrivate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
|
2010-07-30 12:56:25 +02:00
|
|
|
QDeclarativeView(parent), data(new QDeclarativeDesignViewPrivate(this))
|
2010-07-29 12:15:55 +02:00
|
|
|
{
|
|
|
|
data->manipulatorLayer = new LayerItem(scene());
|
|
|
|
data->selectionTool = new SelectionTool(this);
|
|
|
|
data->zoomTool = new ZoomTool(this);
|
|
|
|
data->colorPickerTool = new ColorPickerTool(this);
|
|
|
|
data->boundingRectHighlighter = new BoundingRectHighlighter(this);
|
|
|
|
data->subcomponentEditorTool = new SubcomponentEditorTool(this);
|
|
|
|
data->currentTool = data->selectionTool;
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
setMouseTracking(true);
|
|
|
|
|
2010-07-12 12:02:35 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(designModeBehaviorChanged(bool)), SLOT(setDesignModeBehavior(bool)));
|
2010-07-30 12:56:25 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(reloadRequested()), SLOT(_q_reloadView()));
|
2010-07-08 14:00:33 +02:00
|
|
|
connect(qmlDesignDebugServer(),
|
|
|
|
SIGNAL(currentObjectsChanged(QList<QObject*>)),
|
2010-07-30 12:56:25 +02:00
|
|
|
SLOT(_q_onCurrentObjectsChanged(QList<QObject*>)));
|
2010-07-08 14:00:33 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(animationSpeedChangeRequested(qreal)), SLOT(changeAnimationSpeed(qreal)));
|
2010-07-30 12:56:25 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(colorPickerToolRequested()), SLOT(_q_changeToColorPickerTool()));
|
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(selectMarqueeToolRequested()), SLOT(_q_changeToMarqueeSelectTool()));
|
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(selectToolRequested()), SLOT(_q_changeToSingleSelectTool()));
|
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(zoomToolRequested()), SLOT(_q_changeToZoomTool()));
|
2010-07-16 09:41:56 +02:00
|
|
|
connect(qmlDesignDebugServer(),
|
|
|
|
SIGNAL(objectCreationRequested(QString,QObject*,QStringList,QString)),
|
2010-07-30 12:56:25 +02:00
|
|
|
SLOT(_q_createQmlObject(QString,QObject*,QStringList,QString)));
|
2010-08-03 10:17:09 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(contextPathIndexChanged(int)), SLOT(_q_changeContextPathIndex(int)));
|
2010-08-03 14:07:30 +02:00
|
|
|
connect(qmlDesignDebugServer(), SIGNAL(clearComponentCacheRequested()), SLOT(_q_clearComponentCache()));
|
2010-07-30 12:56:25 +02:00
|
|
|
connect(this, SIGNAL(statusChanged(QDeclarativeView::Status)), SLOT(_q_onStatusChanged(QDeclarativeView::Status)));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), SIGNAL(selectedColorChanged(QColor)));
|
|
|
|
connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
|
2010-07-26 12:47:55 +02:00
|
|
|
qmlDesignDebugServer(), SLOT(selectedColorChanged(QColor)));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 16:09:17 +02:00
|
|
|
connect(data->subcomponentEditorTool, SIGNAL(cleared()), SIGNAL(inspectorContextCleared()));
|
|
|
|
connect(data->subcomponentEditorTool, SIGNAL(contextPushed(QString)), SIGNAL(inspectorContextPushed(QString)));
|
|
|
|
connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), SIGNAL(inspectorContextPopped()));
|
2010-08-02 17:25:29 +02:00
|
|
|
connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), qmlDesignDebugServer(), SLOT(contextPathUpdated(QStringList)));
|
2010-07-30 16:09:17 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
data->createToolbar();
|
2010-08-03 09:45:11 +02:00
|
|
|
|
|
|
|
data->_q_changeToSingleSelectTool();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QDeclarativeDesignView::~QDeclarativeDesignView()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-07-30 16:09:17 +02:00
|
|
|
void QDeclarativeDesignView::setInspectorContext(int contextIndex)
|
|
|
|
{
|
2010-07-30 17:19:28 +02:00
|
|
|
if (data->subcomponentEditorTool->contextIndex() != contextIndex) {
|
|
|
|
QGraphicsObject *object = data->subcomponentEditorTool->setContext(contextIndex);
|
|
|
|
if (object)
|
|
|
|
qmlDesignDebugServer()->setCurrentObjects(QList<QObject*>() << object);
|
|
|
|
}
|
2010-07-30 16:09:17 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_reloadView()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
subcomponentEditorTool->clear();
|
2010-07-13 12:03:21 +02:00
|
|
|
clearHighlight();
|
2010-07-30 12:56:25 +02:00
|
|
|
emit q->reloadRequested();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::clearEditorItems()
|
2010-07-14 17:47:43 +02:00
|
|
|
{
|
|
|
|
clearHighlight();
|
|
|
|
setSelectedItems(QList<QGraphicsItem*>());
|
|
|
|
}
|
|
|
|
|
2010-07-09 16:33:09 +02:00
|
|
|
void QDeclarativeDesignView::leaveEvent(QEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-09 16:33:09 +02:00
|
|
|
QDeclarativeView::leaveEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-30 12:56:25 +02:00
|
|
|
data->clearHighlight();
|
2010-07-09 16:33:09 +02:00
|
|
|
}
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
void QDeclarativeDesignView::mousePressEvent(QMouseEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::mousePressEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-29 12:15:55 +02:00
|
|
|
data->cursorPos = event->pos();
|
|
|
|
data->currentTool->mousePressEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
|
|
|
data->clearEditorItems();
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::mouseMoveEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-29 12:15:55 +02:00
|
|
|
data->cursorPos = event->pos();
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> selItems = data->selectableItems(event->pos());
|
2010-07-08 14:00:33 +02:00
|
|
|
if (!selItems.isEmpty()) {
|
|
|
|
setToolTip(AbstractFormEditorTool::titleForItem(selItems.first()));
|
|
|
|
} else {
|
|
|
|
setToolTip(QString());
|
|
|
|
}
|
|
|
|
if (event->buttons()) {
|
2010-07-29 12:15:55 +02:00
|
|
|
data->subcomponentEditorTool->mouseMoveEvent(event);
|
|
|
|
data->currentTool->mouseMoveEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
} else {
|
2010-07-29 12:15:55 +02:00
|
|
|
data->subcomponentEditorTool->hoverMoveEvent(event);
|
|
|
|
data->currentTool->hoverMoveEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::mouseReleaseEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-29 12:15:55 +02:00
|
|
|
data->subcomponentEditorTool->mouseReleaseEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->cursorPos = event->pos();
|
|
|
|
data->currentTool->mouseReleaseEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 17:19:28 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentObjects(AbstractFormEditorTool::toObjectList(selectedItems()));
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::keyPressEvent(QKeyEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::keyPressEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-29 12:15:55 +02:00
|
|
|
data->currentTool->keyPressEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::keyReleaseEvent(QKeyEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::keyReleaseEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(event->key()) {
|
|
|
|
case Qt::Key_V:
|
2010-07-30 12:56:25 +02:00
|
|
|
data->_q_changeToSingleSelectTool();
|
2010-07-08 14:00:33 +02:00
|
|
|
break;
|
|
|
|
case Qt::Key_M:
|
2010-07-30 12:56:25 +02:00
|
|
|
data->_q_changeToMarqueeSelectTool();
|
2010-07-08 14:00:33 +02:00
|
|
|
break;
|
2010-07-09 16:33:09 +02:00
|
|
|
case Qt::Key_I:
|
2010-07-30 12:56:25 +02:00
|
|
|
data->_q_changeToColorPickerTool();
|
2010-07-09 16:33:09 +02:00
|
|
|
break;
|
|
|
|
case Qt::Key_Z:
|
2010-07-30 12:56:25 +02:00
|
|
|
data->_q_changeToZoomTool();
|
2010-07-09 16:33:09 +02:00
|
|
|
break;
|
2010-07-08 14:00:33 +02:00
|
|
|
case Qt::Key_Enter:
|
|
|
|
case Qt::Key_Return:
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->selectedItems().isEmpty())
|
|
|
|
data->subcomponentEditorTool->setCurrentItem(data->selectedItems().first());
|
2010-07-08 14:00:33 +02:00
|
|
|
break;
|
|
|
|
case Qt::Key_Space:
|
2010-07-29 12:15:55 +02:00
|
|
|
if (data->executionPaused) {
|
|
|
|
continueExecution(data->slowdownFactor);
|
2010-07-08 14:00:33 +02:00
|
|
|
} else {
|
|
|
|
pauseExecution();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->currentTool->keyReleaseEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_createQmlObject(const QString &qml, QObject *parent, const QStringList &importList, const QString &filename)
|
2010-07-16 09:41:56 +02:00
|
|
|
{
|
|
|
|
if (!parent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QString imports;
|
|
|
|
foreach(const QString &s, importList) {
|
|
|
|
imports += s + "\n";
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QDeclarativeContext *parentContext = q->engine()->contextForObject(parent);
|
|
|
|
QDeclarativeComponent component(q->engine(), q);
|
2010-07-16 09:41:56 +02:00
|
|
|
QByteArray constructedQml = QString(imports + qml).toLatin1();
|
|
|
|
|
|
|
|
component.setData(constructedQml, filename);
|
|
|
|
QObject *newObject = component.create(parentContext);
|
|
|
|
if (newObject) {
|
|
|
|
newObject->setParent(parent);
|
2010-07-20 12:35:36 +02:00
|
|
|
QDeclarativeItem *parentItem = qobject_cast<QDeclarativeItem*>(parent);
|
|
|
|
QDeclarativeItem *newItem = qobject_cast<QDeclarativeItem*>(newObject);
|
2010-07-16 09:41:56 +02:00
|
|
|
if (parentItem && newItem) {
|
|
|
|
newItem->setParentItem(parentItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-03 14:07:30 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_clearComponentCache()
|
|
|
|
{
|
|
|
|
q->engine()->clearComponentCache();
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QGraphicsItem *QDeclarativeDesignViewPrivate::currentRootItem() const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
return subcomponentEditorTool->currentRootItem();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::mouseDoubleClickEvent(QMouseEvent *event)
|
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::mouseDoubleClickEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-08-03 09:45:11 +02:00
|
|
|
|
|
|
|
if (data->currentToolMode != Constants::SelectionToolMode
|
|
|
|
&& data->currentToolMode != Constants::MarqueeSelectionToolMode)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
QGraphicsItem *itemToEnter = 0;
|
2010-07-09 16:33:09 +02:00
|
|
|
QList<QGraphicsItem*> itemList = items(event->pos());
|
2010-07-30 12:56:25 +02:00
|
|
|
data->filterForSelection(itemList);
|
2010-07-09 16:33:09 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
if (data->selectedItems().isEmpty() && !itemList.isEmpty()) {
|
2010-07-08 14:00:33 +02:00
|
|
|
itemToEnter = itemList.first();
|
2010-07-30 12:56:25 +02:00
|
|
|
} else if (!data->selectedItems().isEmpty() && !itemList.isEmpty()) {
|
2010-07-08 14:00:33 +02:00
|
|
|
itemToEnter = itemList.first();
|
|
|
|
}
|
|
|
|
|
2010-07-09 16:33:09 +02:00
|
|
|
if (itemToEnter)
|
2010-07-29 12:15:55 +02:00
|
|
|
itemToEnter = data->subcomponentEditorTool->firstChildOfContext(itemToEnter);
|
2010-07-09 16:33:09 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->subcomponentEditorTool->setCurrentItem(itemToEnter);
|
|
|
|
data->subcomponentEditorTool->mouseDoubleClickEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
if ((event->buttons() & Qt::LeftButton) && itemToEnter) {
|
|
|
|
QGraphicsObject *objectToEnter = itemToEnter->toGraphicsObject();
|
|
|
|
if (objectToEnter)
|
|
|
|
qmlDesignDebugServer()->setCurrentObjects(QList<QObject*>() << objectToEnter);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void QDeclarativeDesignView::wheelEvent(QWheelEvent *event)
|
|
|
|
{
|
2010-07-29 12:15:55 +02:00
|
|
|
if (!data->designModeBehavior) {
|
2010-07-08 14:00:33 +02:00
|
|
|
QDeclarativeView::wheelEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-29 12:15:55 +02:00
|
|
|
data->currentTool->wheelEvent(event);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::setDesignModeBehavior(bool value)
|
|
|
|
{
|
2010-07-12 12:02:35 +02:00
|
|
|
emit designModeBehaviorChanged(value);
|
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->toolbar->setDesignModeBehavior(value);
|
2010-07-12 12:08:27 +02:00
|
|
|
qmlDesignDebugServer()->setDesignModeBehavior(value);
|
2010-07-12 12:02:35 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->designModeBehavior = value;
|
|
|
|
if (data->subcomponentEditorTool) {
|
|
|
|
data->subcomponentEditorTool->clear();
|
2010-07-30 12:56:25 +02:00
|
|
|
data->clearHighlight();
|
|
|
|
data->setSelectedItems(QList<QGraphicsItem*>());
|
2010-07-12 14:32:54 +02:00
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
if (rootObject())
|
2010-07-29 12:15:55 +02:00
|
|
|
data->subcomponentEditorTool->pushContext(rootObject());
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
2010-07-14 17:47:43 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
if (!data->designModeBehavior)
|
2010-07-30 12:56:25 +02:00
|
|
|
data->clearEditorItems();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
bool QDeclarativeDesignView::designModeBehavior()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-29 12:15:55 +02:00
|
|
|
return data->designModeBehavior;
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::changeTool(Constants::DesignTool tool, Constants::ToolFlags /*flags*/)
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
switch(tool) {
|
|
|
|
case Constants::SelectionToolMode:
|
2010-07-30 12:56:25 +02:00
|
|
|
_q_changeToSingleSelectTool();
|
2010-07-08 14:00:33 +02:00
|
|
|
break;
|
|
|
|
case Constants::NoTool:
|
|
|
|
default:
|
2010-07-30 12:56:25 +02:00
|
|
|
currentTool = 0;
|
2010-07-08 14:00:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-30 17:43:21 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items)
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
currentSelection.clear();
|
2010-07-15 13:38:10 +02:00
|
|
|
foreach(QGraphicsItem *item, items) {
|
|
|
|
if (item) {
|
|
|
|
QGraphicsObject *obj = item->toGraphicsObject();
|
|
|
|
if (obj)
|
2010-07-30 12:56:25 +02:00
|
|
|
currentSelection << obj;
|
2010-07-15 13:38:10 +02:00
|
|
|
}
|
|
|
|
}
|
2010-07-30 12:56:25 +02:00
|
|
|
currentTool->updateSelectedItems();
|
2010-07-30 17:43:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignViewPrivate::setSelectedItems(QList<QGraphicsItem *> items)
|
|
|
|
{
|
|
|
|
setSelectedItemsForTools(items);
|
2010-07-30 17:19:28 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentObjects(AbstractFormEditorTool::toObjectList(items));
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem *> QDeclarativeDesignViewPrivate::selectedItems()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-15 13:38:10 +02:00
|
|
|
QList<QGraphicsItem *> selection;
|
2010-07-30 12:56:25 +02:00
|
|
|
foreach(const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) {
|
2010-07-15 13:38:10 +02:00
|
|
|
if (selectedObject.isNull()) {
|
2010-07-30 12:56:25 +02:00
|
|
|
currentSelection.removeOne(selectedObject);
|
2010-07-15 13:38:10 +02:00
|
|
|
} else {
|
|
|
|
selection << selectedObject.data();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return selection;
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignView::setSelectedItems(QList<QGraphicsItem *> items)
|
|
|
|
{
|
|
|
|
data->setSelectedItems(items);
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<QGraphicsItem *> QDeclarativeDesignView::selectedItems()
|
|
|
|
{
|
|
|
|
return data->selectedItems();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDeclarativeDesignViewPrivate::clearHighlight()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
boundingRectHighlighter->clear();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::highlight(QGraphicsItem * item, ContextFlags flags)
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-13 16:47:22 +02:00
|
|
|
highlight(QList<QGraphicsItem*>() << item, flags);
|
2010-07-13 12:03:21 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::highlight(QList<QGraphicsItem *> items, ContextFlags flags)
|
2010-07-13 12:03:21 +02:00
|
|
|
{
|
|
|
|
if (items.isEmpty())
|
2010-07-08 14:00:33 +02:00
|
|
|
return;
|
|
|
|
|
2010-07-13 12:03:21 +02:00
|
|
|
QList<QGraphicsObject*> objectList;
|
|
|
|
foreach(QGraphicsItem *item, items) {
|
2010-07-13 16:47:22 +02:00
|
|
|
QGraphicsItem *child = item;
|
|
|
|
if (flags & ContextSensitive)
|
2010-07-30 12:56:25 +02:00
|
|
|
child = subcomponentEditorTool->firstChildOfContext(item);
|
2010-07-13 16:47:22 +02:00
|
|
|
|
2010-07-13 12:03:21 +02:00
|
|
|
if (child) {
|
|
|
|
QGraphicsObject *childObject = child->toGraphicsObject();
|
|
|
|
if (childObject)
|
|
|
|
objectList << childObject;
|
|
|
|
}
|
2010-07-09 16:33:09 +02:00
|
|
|
}
|
2010-07-13 12:03:21 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
boundingRectHighlighter->highlight(objectList);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
bool QDeclarativeDesignViewPrivate::mouseInsideContextItem() const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
return subcomponentEditorTool->containsCursor(cursorPos.toPoint());
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> QDeclarativeDesignViewPrivate::selectableItems(const QPointF &scenePos) const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> itemlist = q->scene()->items(scenePos);
|
2010-07-09 16:33:09 +02:00
|
|
|
return filterForCurrentContext(itemlist);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> QDeclarativeDesignViewPrivate::selectableItems(const QPoint &pos) const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> itemlist = q->items(pos);
|
2010-07-09 16:33:09 +02:00
|
|
|
return filterForCurrentContext(itemlist);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> QDeclarativeDesignViewPrivate::selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> itemlist = q->scene()->items(sceneRect, selectionMode);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-09 16:33:09 +02:00
|
|
|
return filterForCurrentContext(itemlist);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_changeToSingleSelectTool()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
currentToolMode = Constants::SelectionToolMode;
|
|
|
|
selectionTool->setRubberbandSelectionMode(false);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
changeToSelectTool();
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
emit q->selectToolActivated();
|
2010-07-08 14:00:33 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentTool(Constants::SelectionToolMode);
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::changeToSelectTool()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (currentTool == selectionTool)
|
2010-07-08 14:00:33 +02:00
|
|
|
return;
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
currentTool->clear();
|
|
|
|
currentTool = selectionTool;
|
|
|
|
currentTool->clear();
|
|
|
|
currentTool->updateSelectedItems();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_changeToMarqueeSelectTool()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
changeToSelectTool();
|
2010-07-30 12:56:25 +02:00
|
|
|
currentToolMode = Constants::MarqueeSelectionToolMode;
|
|
|
|
selectionTool->setRubberbandSelectionMode(true);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
emit q->marqueeSelectToolActivated();
|
2010-07-08 14:00:33 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentTool(Constants::MarqueeSelectionToolMode);
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_changeToZoomTool()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
currentToolMode = Constants::ZoomMode;
|
|
|
|
currentTool->clear();
|
|
|
|
currentTool = zoomTool;
|
|
|
|
currentTool->clear();
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
emit q->zoomToolActivated();
|
2010-07-08 14:00:33 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentTool(Constants::ZoomMode);
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_changeToColorPickerTool()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
if (currentTool == colorPickerTool)
|
2010-07-08 14:00:33 +02:00
|
|
|
return;
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
currentToolMode = Constants::ColorPickerMode;
|
|
|
|
currentTool->clear();
|
|
|
|
currentTool = colorPickerTool;
|
|
|
|
currentTool->clear();
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
emit q->colorPickerActivated();
|
2010-07-08 14:00:33 +02:00
|
|
|
qmlDesignDebugServer()->setCurrentTool(Constants::ColorPickerMode);
|
|
|
|
}
|
|
|
|
|
2010-08-03 10:17:09 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_changeContextPathIndex(int index)
|
|
|
|
{
|
|
|
|
subcomponentEditorTool->setContext(index);
|
|
|
|
}
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
void QDeclarativeDesignView::changeAnimationSpeed(qreal slowdownFactor)
|
|
|
|
{
|
2010-07-29 12:15:55 +02:00
|
|
|
data->slowdownFactor = slowdownFactor;
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
if (data->slowdownFactor != 0) {
|
|
|
|
continueExecution(data->slowdownFactor);
|
2010-07-08 14:00:33 +02:00
|
|
|
} else {
|
|
|
|
pauseExecution();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::continueExecution(qreal slowdownFactor)
|
|
|
|
{
|
|
|
|
Q_ASSERT(slowdownFactor > 0);
|
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
data->slowdownFactor = slowdownFactor;
|
2010-07-12 14:32:54 +02:00
|
|
|
static const qreal animSpeedSnapDelta = 0.01f;
|
2010-07-29 12:15:55 +02:00
|
|
|
bool useStandardSpeed = (qAbs(1.0f - data->slowdownFactor) < animSpeedSnapDelta);
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
QUnifiedTimer *timer = QUnifiedTimer::instance();
|
2010-07-29 12:15:55 +02:00
|
|
|
timer->setSlowdownFactor(data->slowdownFactor);
|
2010-07-12 14:32:54 +02:00
|
|
|
timer->setSlowModeEnabled(!useStandardSpeed);
|
2010-07-29 12:15:55 +02:00
|
|
|
data->executionPaused = false;
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-29 12:15:55 +02:00
|
|
|
emit executionStarted(data->slowdownFactor);
|
|
|
|
qmlDesignDebugServer()->setAnimationSpeed(data->slowdownFactor);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDeclarativeDesignView::pauseExecution()
|
|
|
|
{
|
|
|
|
QUnifiedTimer *timer = QUnifiedTimer::instance();
|
2010-07-09 16:33:09 +02:00
|
|
|
timer->setSlowdownFactor(0);
|
2010-07-08 14:00:33 +02:00
|
|
|
timer->setSlowModeEnabled(true);
|
2010-07-29 12:15:55 +02:00
|
|
|
data->executionPaused = true;
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
emit executionPaused();
|
2010-07-09 16:33:09 +02:00
|
|
|
qmlDesignDebugServer()->setAnimationSpeed(0);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_applyChangesFromClient()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> QDeclarativeDesignViewPrivate::filterForSelection(QList<QGraphicsItem*> &itemlist) const
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
foreach(QGraphicsItem *item, itemlist) {
|
2010-07-30 12:56:25 +02:00
|
|
|
if (isEditorItem(item) || !subcomponentEditorTool->isChildOfContext(item))
|
2010-07-08 14:00:33 +02:00
|
|
|
itemlist.removeOne(item);
|
2010-07-09 16:33:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return itemlist;
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QList<QGraphicsItem*> QDeclarativeDesignViewPrivate::filterForCurrentContext(QList<QGraphicsItem*> &itemlist) const
|
2010-07-09 16:33:09 +02:00
|
|
|
{
|
|
|
|
foreach(QGraphicsItem *item, itemlist) {
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
if (isEditorItem(item) || !subcomponentEditorTool->isDirectChildOfContext(item)) {
|
2010-07-09 16:33:09 +02:00
|
|
|
|
|
|
|
// if we're a child, but not directly, replace with the parent that is directly in context.
|
2010-07-30 12:56:25 +02:00
|
|
|
if (QGraphicsItem *contextParent = subcomponentEditorTool->firstChildOfContext(item)) {
|
2010-07-14 14:21:10 +02:00
|
|
|
if (contextParent != item) {
|
|
|
|
if (itemlist.contains(contextParent)) {
|
|
|
|
itemlist.removeOne(item);
|
|
|
|
} else {
|
|
|
|
itemlist.replace(itemlist.indexOf(item), contextParent);
|
|
|
|
}
|
2010-07-09 16:33:09 +02:00
|
|
|
}
|
|
|
|
} else {
|
2010-07-14 14:21:10 +02:00
|
|
|
itemlist.removeOne(item);
|
2010-07-09 16:33:09 +02:00
|
|
|
}
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return itemlist;
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
bool QDeclarativeDesignViewPrivate::isEditorItem(QGraphicsItem *item) const
|
2010-07-09 16:33:09 +02:00
|
|
|
{
|
|
|
|
return (item->type() == Constants::EditorItemType
|
|
|
|
|| item->type() == Constants::ResizeHandleItemType
|
|
|
|
|| item->data(Constants::EditorItemDataKey).toBool());
|
|
|
|
}
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_onStatusChanged(QDeclarativeView::Status status)
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
if (status == QDeclarativeView::Ready) {
|
2010-07-30 12:56:25 +02:00
|
|
|
if (q->rootObject()) {
|
2010-07-30 17:43:21 +02:00
|
|
|
if (subcomponentEditorTool->contextIndex() != -1)
|
|
|
|
subcomponentEditorTool->clear();
|
2010-07-30 12:56:25 +02:00
|
|
|
subcomponentEditorTool->pushContext(q->rootObject());
|
|
|
|
emit q->executionStarted(1.0f);
|
2010-07-30 17:25:14 +02:00
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
2010-07-20 12:35:36 +02:00
|
|
|
qmlDesignDebugServer()->reloaded();
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects)
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
QList<QGraphicsItem*> items;
|
|
|
|
foreach(QObject *obj, objects) {
|
|
|
|
QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(obj);
|
|
|
|
if (declarativeItem)
|
|
|
|
items << declarativeItem;
|
|
|
|
}
|
|
|
|
|
2010-07-30 17:43:21 +02:00
|
|
|
setSelectedItemsForTools(items);
|
2010-07-13 12:03:21 +02:00
|
|
|
clearHighlight();
|
2010-07-30 12:56:25 +02:00
|
|
|
highlight(items, QDeclarativeDesignViewPrivate::IgnoreContext);
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-26 15:31:59 +02:00
|
|
|
QString QDeclarativeDesignView::idStringForObject(QObject *obj)
|
|
|
|
{
|
|
|
|
return qmlDesignDebugServer()->idStringForObject(obj);
|
|
|
|
}
|
|
|
|
|
2010-07-27 13:13:12 +02:00
|
|
|
// adjusts bounding boxes on edges of screen to be visible
|
|
|
|
QRectF QDeclarativeDesignView::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace)
|
|
|
|
{
|
|
|
|
int marginFromEdge = 1;
|
|
|
|
QRectF boundingRect(boundingRectInSceneSpace);
|
|
|
|
if (qAbs(boundingRect.left()) - 1 < 2) {
|
|
|
|
boundingRect.setLeft(marginFromEdge);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (boundingRect.right() >= rect().right() ) {
|
|
|
|
boundingRect.setRight(rect().right() - marginFromEdge);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (qAbs(boundingRect.top()) - 1 < 2) {
|
|
|
|
boundingRect.setTop(marginFromEdge);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (boundingRect.bottom() >= rect().bottom() ) {
|
|
|
|
boundingRect.setBottom(rect().bottom() - marginFromEdge);
|
|
|
|
}
|
|
|
|
|
|
|
|
return boundingRect;
|
|
|
|
}
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
QToolBar *QDeclarativeDesignView::toolbar() const
|
|
|
|
{
|
2010-07-29 12:15:55 +02:00
|
|
|
return data->toolbar;
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
void QDeclarativeDesignViewPrivate::createToolbar()
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
2010-07-30 12:56:25 +02:00
|
|
|
toolbar = new QmlToolbar(q);
|
|
|
|
QObject::connect(q, SIGNAL(selectedColorChanged(QColor)), toolbar, SLOT(setColorBoxColor(QColor)));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(q, SIGNAL(designModeBehaviorChanged(bool)), toolbar, SLOT(setDesignModeBehavior(bool)));
|
2010-07-12 12:02:35 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(toolbar, SIGNAL(designModeBehaviorChanged(bool)), q, SLOT(setDesignModeBehavior(bool)));
|
|
|
|
QObject::connect(toolbar, SIGNAL(executionStarted()), q, SLOT(continueExecution()));
|
|
|
|
QObject::connect(toolbar, SIGNAL(executionPaused()), q, SLOT(pauseExecution()));
|
|
|
|
QObject::connect(toolbar, SIGNAL(colorPickerSelected()), q, SLOT(_q_changeToColorPickerTool()));
|
|
|
|
QObject::connect(toolbar, SIGNAL(zoomToolSelected()), q, SLOT(_q_changeToZoomTool()));
|
|
|
|
QObject::connect(toolbar, SIGNAL(selectToolSelected()), q, SLOT(_q_changeToSingleSelectTool()));
|
|
|
|
QObject::connect(toolbar, SIGNAL(marqueeSelectToolSelected()), q, SLOT(_q_changeToMarqueeSelectTool()));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(toolbar, SIGNAL(applyChangesFromQmlFileSelected()), q, SLOT(_q_applyChangesFromClient()));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(q, SIGNAL(executionStarted(qreal)), toolbar, SLOT(startExecution()));
|
|
|
|
QObject::connect(q, SIGNAL(executionPaused()), toolbar, SLOT(pauseExecution()));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(q, SIGNAL(selectToolActivated()), toolbar, SLOT(activateSelectTool()));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
// disabled features
|
2010-07-29 12:15:55 +02:00
|
|
|
//connect(d->m_toolbar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient()));
|
2010-07-30 12:56:25 +02:00
|
|
|
//connect(q, SIGNAL(resizeToolActivated()), d->m_toolbar, SLOT(activateSelectTool()));
|
|
|
|
//connect(q, SIGNAL(moveToolActivated()), d->m_toolbar, SLOT(activateSelectTool()));
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-07-30 12:56:25 +02:00
|
|
|
QObject::connect(q, SIGNAL(colorPickerActivated()), toolbar, SLOT(activateColorPicker()));
|
|
|
|
QObject::connect(q, SIGNAL(zoomToolActivated()), toolbar, SLOT(activateZoom()));
|
|
|
|
QObject::connect(q, SIGNAL(marqueeSelectToolActivated()), toolbar, SLOT(activateMarqueeSelectTool()));
|
2010-07-08 14:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace QmlViewer
|
2010-07-30 12:56:25 +02:00
|
|
|
|
|
|
|
#include <moc_qdeclarativedesignview.cpp>
|