forked from qt-creator/qt-creator
qmlobserver: Remove the changed() hack to get new object.
There is now a hook in QDeclarative itself for that. Needs commit af2b28f9ca07057 of Qt
This commit is contained in:
@@ -72,7 +72,6 @@ public:
|
||||
public Q_SLOTS:
|
||||
void selectedColorChanged(const QColor &color);
|
||||
void contextPathUpdated(const QStringList &contextPath);
|
||||
void sceneItemCountChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void currentObjectsChanged(const QList<QObject*> &objects);
|
||||
|
@@ -111,8 +111,6 @@ private:
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_changeToColorPickerTool())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_changeContextPathIndex(int index))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_clearComponentCache());
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_sceneChanged(const QList<QRectF> &areas));
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_checkSceneItemCount());
|
||||
|
||||
inline QDeclarativeDesignViewPrivate *d_func() { return data.data(); }
|
||||
QScopedPointer<QDeclarativeDesignViewPrivate> data;
|
||||
|
@@ -211,16 +211,6 @@ void QDeclarativeDesignDebugServer::contextPathUpdated(const QStringList &contex
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void QDeclarativeDesignDebugServer::sceneItemCountChanged()
|
||||
{
|
||||
QByteArray message;
|
||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||
|
||||
ds << QByteArray("SCENE_ITEM_COUNT_CHANGED");
|
||||
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
QString QDeclarativeDesignDebugServer::idStringForObject(QObject *obj) const
|
||||
{
|
||||
int id = idForObject(obj);
|
||||
|
@@ -66,8 +66,6 @@ QDeclarativeDesignViewPrivate::QDeclarativeDesignViewPrivate(QDeclarativeDesignV
|
||||
jsDebuggerAgent(0),
|
||||
toolbar(0)
|
||||
{
|
||||
sceneChangedTimer.setInterval(SceneChangeUpdateInterval);
|
||||
sceneChangedTimer.setSingleShot(true);
|
||||
}
|
||||
|
||||
QDeclarativeDesignViewPrivate::~QDeclarativeDesignViewPrivate()
|
||||
@@ -85,7 +83,6 @@ QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
|
||||
data->subcomponentEditorTool = new SubcomponentEditorTool(this);
|
||||
data->currentTool = data->selectionTool;
|
||||
|
||||
connect(scene(), SIGNAL(changed(QList<QRectF>)), SLOT(_q_sceneChanged(QList<QRectF>)));
|
||||
setMouseTracking(true);
|
||||
|
||||
connect(qmlDesignDebugServer(), SIGNAL(designModeBehaviorChanged(bool)), SLOT(setDesignModeBehavior(bool)));
|
||||
@@ -114,8 +111,6 @@ QDeclarativeDesignView::QDeclarativeDesignView(QWidget *parent) :
|
||||
connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), SIGNAL(inspectorContextPopped()));
|
||||
connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), qmlDesignDebugServer(), SLOT(contextPathUpdated(QStringList)));
|
||||
|
||||
connect(&(data->sceneChangedTimer), SIGNAL(timeout()), SLOT(_q_checkSceneItemCount()));
|
||||
|
||||
data->createToolbar();
|
||||
|
||||
data->_q_changeToSingleSelectTool();
|
||||
@@ -535,55 +530,6 @@ void QDeclarativeDesignViewPrivate::_q_changeContextPathIndex(int index)
|
||||
subcomponentEditorTool->setContext(index);
|
||||
}
|
||||
|
||||
void QDeclarativeDesignViewPrivate::_q_sceneChanged(const QList<QRectF> & /*areas*/)
|
||||
{
|
||||
if (designModeBehavior)
|
||||
return;
|
||||
|
||||
if (!sceneChangedTimer.isActive())
|
||||
sceneChangedTimer.start();
|
||||
}
|
||||
|
||||
void QDeclarativeDesignViewPrivate::_q_checkSceneItemCount()
|
||||
{
|
||||
bool hasNewItems = hasNewGraphicsObjects(q->rootObject());
|
||||
|
||||
if (hasNewItems) {
|
||||
qmlDesignDebugServer()->sceneItemCountChanged();
|
||||
}
|
||||
}
|
||||
|
||||
static bool hasNewGraphicsObjectsRecur(QGraphicsObject *object,
|
||||
QSet<QGraphicsObject *> &newItems,
|
||||
const QSet<QGraphicsObject *> &previousItems)
|
||||
{
|
||||
bool hasNew = false;
|
||||
|
||||
newItems << object;
|
||||
|
||||
foreach(QGraphicsItem *item, object->childItems()) {
|
||||
QGraphicsObject *gfxObject = item->toGraphicsObject();
|
||||
if (gfxObject) {
|
||||
newItems << gfxObject;
|
||||
|
||||
hasNew = hasNewGraphicsObjectsRecur(gfxObject, newItems, previousItems) || hasNew;
|
||||
if (!previousItems.contains(gfxObject))
|
||||
hasNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasNew;
|
||||
}
|
||||
|
||||
bool QDeclarativeDesignViewPrivate::hasNewGraphicsObjects(QGraphicsObject *object)
|
||||
{
|
||||
QSet<QGraphicsObject *> newItems;
|
||||
bool ret = hasNewGraphicsObjectsRecur(object, newItems, sceneGraphicsObjects);
|
||||
sceneGraphicsObjects = newItems;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void QDeclarativeDesignView::changeAnimationSpeed(qreal slowdownFactor)
|
||||
{
|
||||
data->slowdownFactor = slowdownFactor;
|
||||
@@ -674,7 +620,6 @@ void QDeclarativeDesignViewPrivate::_q_onStatusChanged(QDeclarativeView::Status
|
||||
{
|
||||
if (status == QDeclarativeView::Ready) {
|
||||
if (q->rootObject()) {
|
||||
hasNewGraphicsObjects(q->rootObject());
|
||||
if (subcomponentEditorTool->contextIndex() != -1)
|
||||
subcomponentEditorTool->clear();
|
||||
subcomponentEditorTool->pushContext(q->rootObject());
|
||||
|
@@ -87,8 +87,6 @@ public:
|
||||
JSDebuggerAgent *jsDebuggerAgent;
|
||||
|
||||
QmlToolbar *toolbar;
|
||||
QTimer sceneChangedTimer;
|
||||
QSet<QGraphicsObject *> sceneGraphicsObjects;
|
||||
|
||||
void clearEditorItems();
|
||||
void createToolbar();
|
||||
@@ -100,8 +98,6 @@ public:
|
||||
QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const;
|
||||
QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const;
|
||||
|
||||
bool hasNewGraphicsObjects(QGraphicsObject *object);
|
||||
|
||||
void setSelectedItemsForTools(QList<QGraphicsItem *> items);
|
||||
void setSelectedItems(QList<QGraphicsItem *> items);
|
||||
QList<QGraphicsItem *> selectedItems();
|
||||
@@ -132,9 +128,6 @@ public:
|
||||
void _q_changeToColorPickerTool();
|
||||
void _q_changeContextPathIndex(int index);
|
||||
void _q_clearComponentCache();
|
||||
void _q_sceneChanged(const QList<QRectF> &areas);
|
||||
void _q_changeDebugObjectCount(int objectCount);
|
||||
void _q_checkSceneItemCount();
|
||||
|
||||
static QDeclarativeDesignViewPrivate *get(QDeclarativeDesignView *v) { return v->d_func(); }
|
||||
};
|
||||
|
@@ -85,9 +85,6 @@ void ClientProxy::connectToServer()
|
||||
SIGNAL(selectedColorChanged(QColor)));
|
||||
connect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
|
||||
SIGNAL(contextPathUpdated(QStringList)));
|
||||
/* connect(m_designClient, SIGNAL(treeRefreshRequested()),
|
||||
SLOT(refreshObjectTree()));*/
|
||||
|
||||
reloadEngines();
|
||||
}
|
||||
|
||||
@@ -454,4 +451,3 @@ void ClientProxy::newObjects()
|
||||
if (!m_requestObjectsTimer.isActive())
|
||||
m_requestObjectsTimer.start();
|
||||
}
|
||||
|
||||
|
@@ -108,8 +108,6 @@ void QmlJSDesignDebugClient::messageReceived(const QByteArray &message)
|
||||
QStringList contextPath;
|
||||
ds >> contextPath;
|
||||
emit contextPathUpdated(contextPath);
|
||||
} else if (type == "SCENE_ITEM_COUNT_CHANGED") {
|
||||
//emit treeRefreshRequested();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,6 @@ signals:
|
||||
void designModeBehaviorChanged(bool inDesignMode);
|
||||
void reloaded(); // the server has reloaded the document
|
||||
void contextPathUpdated(const QStringList &path);
|
||||
void treeRefreshRequested(); // scene has some new items
|
||||
|
||||
protected:
|
||||
virtual void messageReceived(const QByteArray &);
|
||||
|
Reference in New Issue
Block a user