diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-09-28 01:30:24 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-09-28 01:30:24 (GMT) |
commit | 7d0071418f93c5cc5ce04d96a321843db5a0c55b (patch) | |
tree | f5593fd289e2acbbcd4ecabc5b816a380ac4ef52 /tools | |
parent | 553d7bdcdc67927a856b20e7717fb497e4cf7ac9 (diff) | |
parent | ef2e4bfcdd95506329ba1d8c6635999f07a474ff (diff) | |
download | Qt-7d0071418f93c5cc5ce04d96a321843db5a0c55b.zip Qt-7d0071418f93c5cc5ce04d96a321843db5a0c55b.tar.gz Qt-7d0071418f93c5cc5ce04d96a321843db5a0c55b.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmldebugger/engine.cpp | 46 | ||||
-rw-r--r-- | tools/qmldebugger/watchtablemodel.cpp | 10 | ||||
-rw-r--r-- | tools/qmldebugger/watchtablemodel.h | 6 |
3 files changed, 40 insertions, 22 deletions
diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/engine.cpp index f76110c..8a06213 100644 --- a/tools/qmldebugger/engine.cpp +++ b/tools/qmldebugger/engine.cpp @@ -259,9 +259,11 @@ void EnginePane::showProperties() } QmlDebugWatch *watch = m_client.addWatch(obj, this); - m_watchedObject = watch; - QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), - this, SLOT(valueChanged(QByteArray,QVariant))); + if (watch->state() != QmlDebugWatch::Dead) { + m_watchedObject = watch; + QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), + this, SLOT(valueChanged(QByteArray,QVariant))); + } delete m_object; m_object = 0; } @@ -270,10 +272,12 @@ void EnginePane::addExpressionWatch(int debugId, const QString &expr) { QmlDebugWatch *watch = m_client.addWatch(QmlDebugObjectReference(debugId), expr, this); - QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), - this, SLOT(valueChanged(QByteArray,QVariant))); - m_watchTableModel->addWatch(watch, expr); - m_watchTable->resizeColumnsToContents(); + if (watch->state() != QmlDebugWatch::Dead) { + QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), + this, SLOT(valueChanged(QByteArray,QVariant))); + m_watchTableModel->addWatch(watch, expr); + m_watchTable->resizeColumnsToContents(); + } } void EnginePane::valueChanged(const QByteArray &propertyName, const QVariant &value) @@ -297,22 +301,24 @@ void EnginePane::propertyActivated(const QmlDebugPropertyReference &property) QmlDebugObjectReference object = view->object(); QmlDebugWatch *watch = m_watchTableModel->findWatch(object.debugId(), property.name()); if (watch) { - m_watchTableModel->removeWatch(watch); m_client.removeWatch(watch); delete watch; + watch = 0; } else { QmlDebugWatch *watch = m_client.addWatch(property, this); - QObject::connect(watch, SIGNAL(stateChanged(State)), - this, SLOT(propertyWatchStateChanged())); - QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), - this, SLOT(valueChanged(QByteArray,QVariant))); - QString desc = property.name() - + QLatin1String(" on\n") - + object.className() - + QLatin1String(": ") - + (object.name().isEmpty() ? QLatin1String("<unnamed>") : object.name()); - m_watchTableModel->addWatch(watch, desc); - m_watchTable->resizeColumnsToContents(); + if (watch->state() != QmlDebugWatch::Dead) { + QObject::connect(watch, SIGNAL(stateChanged(State)), + this, SLOT(propertyWatchStateChanged())); + QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), + this, SLOT(valueChanged(QByteArray,QVariant))); + QString desc = property.name() + + QLatin1String(" on\n") + + object.className() + + QLatin1String(": ") + + (object.name().isEmpty() ? QLatin1String("<unnamed>") : object.name()); + m_watchTableModel->addWatch(watch, desc); + m_watchTable->resizeColumnsToContents(); + } } } @@ -327,9 +333,9 @@ void EnginePane::stopWatching(int column) { QmlDebugWatch *watch = m_watchTableModel->findWatch(column); if (watch) { - m_watchTableModel->removeWatch(watch); m_client.removeWatch(watch); delete watch; + watch = 0; } } diff --git a/tools/qmldebugger/watchtablemodel.cpp b/tools/qmldebugger/watchtablemodel.cpp index f9defc4..2fed199 100644 --- a/tools/qmldebugger/watchtablemodel.cpp +++ b/tools/qmldebugger/watchtablemodel.cpp @@ -18,6 +18,9 @@ void WatchTableModel::addWatch(QmlDebugWatch *watch, const QString &title) if (qobject_cast<QmlDebugPropertyWatch *>(watch)) property = qobject_cast<QmlDebugPropertyWatch *>(watch)->name(); + // Watch will be automatically removed when its state is Inactive + QObject::connect(watch, SIGNAL(stateChanged(State)), SLOT(watchStateChanged())); + int col = columnCount(QModelIndex()); beginInsertColumns(QModelIndex(), col, col); @@ -142,6 +145,13 @@ QVariant WatchTableModel::data(const QModelIndex &idx, int role) const } } +void WatchTableModel::watchStateChanged() +{ + QmlDebugWatch *watch = qobject_cast<QmlDebugWatch*>(sender()); + if (watch && watch->state() == QmlDebugWatch::Inactive) + removeWatch(watch); +} + int WatchTableModel::columnForWatch(QmlDebugWatch *watch) const { for (int i=0; i<m_columns.count(); i++) { diff --git a/tools/qmldebugger/watchtablemodel.h b/tools/qmldebugger/watchtablemodel.h index 47c654c..ee99920 100644 --- a/tools/qmldebugger/watchtablemodel.h +++ b/tools/qmldebugger/watchtablemodel.h @@ -17,8 +17,6 @@ public: WatchTableModel(QObject *parent = 0); void addWatch(QmlDebugWatch *watch, const QString &title); - void removeWatch(QmlDebugWatch *watch); - void updateWatch(QmlDebugWatch *watch, const QVariant &value); QmlDebugWatch *findWatch(int column) const; @@ -29,9 +27,13 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; +private slots: + void watchStateChanged(); + private: int columnForWatch(QmlDebugWatch *watch) const; void addValue(int column, const QVariant &value); + void removeWatch(QmlDebugWatch *watch); struct WatchedEntity { |