From 14d192f1d5e2edb657d4cc100e7380800ef83c4b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 23 Sep 2009 16:54:45 +1000 Subject: Update configure.exe --- configure.exe | Bin 2038784 -> 1413120 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 2c5b717..2cc5c01 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 857f3f1466cb4ba57eca2d39d5515e2655a8c617 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 23 Sep 2009 17:29:13 +1000 Subject: Allow watching of properties to be stopped from watch table. Also fix bug where watch removal requests were not sent to the server side. --- src/declarative/debugger/qmldebug.cpp | 2 + tools/qmldebugger/engine.cpp | 106 +++++++++++++++++++++++++++++----- tools/qmldebugger/engine.h | 5 +- 3 files changed, 95 insertions(+), 18 deletions(-) diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp index 7483fe2..de97cda 100644 --- a/src/declarative/debugger/qmldebug.cpp +++ b/src/declarative/debugger/qmldebug.cpp @@ -270,6 +270,7 @@ QmlDebugPropertyWatch *QmlEngineDebug::addWatch(const QmlDebugPropertyReference int queryId = d->getId(); watch->m_queryId = queryId; watch->m_objectDebugId = property.objectDebugId(); + watch->m_name = property.name(); d->watched.insert(queryId, watch); QByteArray message; @@ -297,6 +298,7 @@ QmlDebugObjectExpressionWatch *QmlEngineDebug::addWatch(const QmlDebugObjectRefe int queryId = d->getId(); watch->m_queryId = queryId; watch->m_objectDebugId = object.debugId(); + watch->m_expr = expr; d->watched.insert(queryId, watch); QByteArray message; diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/engine.cpp index 5a1a01b..f17b779 100644 --- a/tools/qmldebugger/engine.cpp +++ b/tools/qmldebugger/engine.cpp @@ -20,6 +20,7 @@ QT_BEGIN_NAMESPACE + class QmlObjectTree : public QTreeWidget { Q_OBJECT @@ -101,11 +102,12 @@ public: WatchTableModel(QObject *parent = 0); void addWatch(QmlDebugWatch *watch, const QString &title); - QmlDebugWatch *removeWatch(QmlDebugWatch *watch); + void removeWatch(QmlDebugWatch *watch); void updateWatch(QmlDebugWatch *watch, const QVariant &value); - QmlDebugWatch *watchFromIndex(const QModelIndex &index) const; + QmlDebugWatch *findWatch(int column) const; + QmlDebugWatch *findWatch(int objectDebugId, const QString &property) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -120,6 +122,7 @@ private: { QString title; bool hasFirstValue; + QString property; QPointer watch; }; @@ -140,23 +143,28 @@ WatchTableModel::WatchTableModel(QObject *parent) void WatchTableModel::addWatch(QmlDebugWatch *watch, const QString &title) { + QString property; + if (qobject_cast(watch)) + property = qobject_cast(watch)->name(); + int col = columnCount(QModelIndex()); beginInsertColumns(QModelIndex(), col, col); WatchedEntity e; e.title = title; e.hasFirstValue = false; + e.property = property; e.watch = watch; m_columns.append(e); endInsertColumns(); } -QmlDebugWatch *WatchTableModel::removeWatch(QmlDebugWatch *watch) +void WatchTableModel::removeWatch(QmlDebugWatch *watch) { int column = columnForWatch(watch); if (column == -1) - return 0; + return; WatchedEntity entity = m_columns.takeAt(column); @@ -171,8 +179,6 @@ QmlDebugWatch *WatchTableModel::removeWatch(QmlDebugWatch *watch) } reset(); - - return entity.watch; } void WatchTableModel::updateWatch(QmlDebugWatch *watch, const QVariant &value) @@ -189,10 +195,21 @@ void WatchTableModel::updateWatch(QmlDebugWatch *watch, const QVariant &value) } } -QmlDebugWatch *WatchTableModel::watchFromIndex(const QModelIndex &index) const +QmlDebugWatch *WatchTableModel::findWatch(int column) const { - if (index.isValid() && index.column() < m_columns.count()) - return m_columns.at(index.column()).watch; + if (column < m_columns.count()) + return m_columns.at(column).watch; + return 0; +} + +QmlDebugWatch *WatchTableModel::findWatch(int objectDebugId, const QString &property) const +{ + for (int i=0; iobjectDebugId() == objectDebugId + && m_columns[i].property == property) { + return m_columns[i].watch; + } + } return 0; } @@ -278,6 +295,40 @@ void WatchTableModel::addValue(int column, const QVariant &value) } +class WatchTableView : public QTableView +{ + Q_OBJECT +public: + WatchTableView(QWidget *parent); + +signals: + void stopWatching(int column); + +protected: + void mousePressEvent(QMouseEvent *me); +}; + +WatchTableView::WatchTableView(QWidget *parent) + : QTableView(parent) +{ +} + +void WatchTableView::mousePressEvent(QMouseEvent *me) +{ + QTableView::mousePressEvent(me); + if (me->button() == Qt::RightButton && me->type() == QEvent::MouseButtonPress) { + int col = columnAt(me->x()); + if (col >= 0) { + QAction action(tr("Stop watching"), 0); + QList actions; + actions << &action; + if (QMenu::exec(actions, me->globalPos())) + emit stopWatching(col); + } + } +} + + class DebuggerEngineItem : public QObject { Q_OBJECT @@ -346,10 +397,12 @@ EnginePane::EnginePane(QmlDebugConnection *client, QWidget *parent) m_propTable->setHorizontalHeaderLabels(QStringList() << "name" << "value"); m_watchTableModel = new WatchTableModel(this); - m_watchTable = new QTableView(this); + m_watchTable = new WatchTableView(this); m_watchTable->setModel(m_watchTableModel); QObject::connect(m_watchTable, SIGNAL(activated(QModelIndex)), this, SLOT(watchedItemActivated(QModelIndex))); + QObject::connect(m_watchTable, SIGNAL(stopWatching(int)), + this, SLOT(stopWatching(int))); m_tabs = new QTabWidget(this); m_tabs->addTab(m_propTable, tr("Properties")); @@ -464,16 +517,14 @@ void EnginePane::propertyDoubleClicked(QTableWidgetItem *item) bool EnginePane::togglePropertyWatch(const QmlDebugObjectReference &object, const QmlDebugPropertyReference &property) { - QPair objProperty(object.debugId(), property.name()); - - if (m_watchedProps.contains(objProperty)) { - QmlDebugWatch *watch = m_watchedProps.take(objProperty); + QmlDebugWatch *watch = m_watchTableModel->findWatch(object.debugId(), property.name()); + if (watch) { m_watchTableModel->removeWatch(watch); + m_client.removeWatch(watch); delete watch; return false; } else { QmlDebugWatch *watch = m_client.addWatch(property, this); - m_watchedProps.insert(objProperty, watch); QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), this, SLOT(valueChanged(QByteArray,QVariant))); QString desc = property.name() @@ -487,9 +538,32 @@ bool EnginePane::togglePropertyWatch(const QmlDebugObjectReference &object, cons } } +void EnginePane::stopWatching(int column) +{ + QmlDebugWatch *watch = m_watchTableModel->findWatch(column); + if (watch) { + if (m_object && m_object->object().debugId() == watch->objectDebugId() + && qobject_cast(watch)) { + QString property = qobject_cast(watch)->name(); + QTableWidgetItem *item; + for (int row=0; rowrowCount(); row++) { + item = m_propTable->item(row, 0); + if (item->text() == property) { + item->setForeground(QBrush()); + break; + } + } + } + + m_watchTableModel->removeWatch(watch); + m_client.removeWatch(watch); + delete watch; + } +} + void EnginePane::watchedItemActivated(const QModelIndex &index) { - QmlDebugWatch *watch = m_watchTableModel->watchFromIndex(index); + QmlDebugWatch *watch = m_watchTableModel->findWatch(index.column()); if (!watch) return; QTreeWidgetItem *item = m_objTree->findItemByObjectId(watch->objectDebugId()); diff --git a/tools/qmldebugger/engine.h b/tools/qmldebugger/engine.h index b2c8221..899a21d 100644 --- a/tools/qmldebugger/engine.h +++ b/tools/qmldebugger/engine.h @@ -16,6 +16,7 @@ class QmlDebugWatch; class QmlObjectTree; class EngineClientPlugin; class WatchTableModel; +class WatchTableView; class QLineEdit; class QModelIndex; class QTreeWidget; @@ -52,6 +53,7 @@ private slots: void propertyDoubleClicked(QTableWidgetItem *); void watchedItemActivated(const QModelIndex &index); + void stopWatching(int column); private: void dump(const QmlDebugContextReference &, int); @@ -68,14 +70,13 @@ private: QmlObjectTree *m_objTree; QTabWidget *m_tabs; QTableWidget *m_propTable; - QTableView *m_watchTable; + WatchTableView *m_watchTable; QmlView *m_engineView; QList m_engineItems; QmlDebugWatch *m_watchedObject; WatchTableModel *m_watchTableModel; - QHash< QPair, QPointer > m_watchedProps; }; QT_END_NAMESPACE -- cgit v0.12 From d97256d956ce649df271cb5c7f24029649a061f3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 23 Sep 2009 11:01:43 +0200 Subject: Make QmlCompositeTypeData a class instead of a struct This fixes a warning of msvc that apparently doesn't like a struct (QmlCompositeTypeData) extending a class (QmlRefCount): "warning C4099: 'QmlCompositeTypeData' : type name first seen using 'class' now seen using 'struct'" --- src/declarative/qml/qmlcomponent.h | 2 +- src/declarative/qml/qmlcompositetypedata_p.h | 3 ++- src/declarative/qml/qmlcompositetypemanager_p.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index af250e5..c6924e3 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -106,7 +106,7 @@ private: QmlComponent(QmlEngine *, QmlCompiledData *, int, int, QObject *parent); friend class QmlVME; - friend struct QmlCompositeTypeData; + friend class QmlCompositeTypeData; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcompositetypedata_p.h b/src/declarative/qml/qmlcompositetypedata_p.h index 044b4ca..3d246cc 100644 --- a/src/declarative/qml/qmlcompositetypedata_p.h +++ b/src/declarative/qml/qmlcompositetypedata_p.h @@ -58,8 +58,9 @@ QT_BEGIN_NAMESPACE -struct QmlCompositeTypeData : public QmlRefCount +class QmlCompositeTypeData : public QmlRefCount { +public QmlCompositeTypeData(); virtual ~QmlCompositeTypeData(); diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index 41cbe80..8f16998 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -66,7 +66,7 @@ class QmlComponentPrivate; class QmlComponent; class QmlDomDocument; -struct QmlCompositeTypeData; +class QmlCompositeTypeData; class QmlCompositeTypeManager : public QObject { -- cgit v0.12 From 72e15d2c666885ea96494c3a9cc591aadbeee173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 23 Sep 2009 11:40:44 +0200 Subject: Fixed compile (missing colon after public) --- src/declarative/qml/qmlcompositetypedata_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qmlcompositetypedata_p.h b/src/declarative/qml/qmlcompositetypedata_p.h index 3d246cc..48c6c2b 100644 --- a/src/declarative/qml/qmlcompositetypedata_p.h +++ b/src/declarative/qml/qmlcompositetypedata_p.h @@ -60,11 +60,11 @@ QT_BEGIN_NAMESPACE class QmlCompositeTypeData : public QmlRefCount { -public +public: QmlCompositeTypeData(); virtual ~QmlCompositeTypeData(); - enum Status { + enum Status { Invalid, Complete, Error, @@ -84,8 +84,8 @@ public QList dependants; - // Return a QmlComponent if the QmlCompositeTypeData is not in the Waiting - // state. The QmlComponent is owned by the QmlCompositeTypeData, so a + // Return a QmlComponent if the QmlCompositeTypeData is not in the Waiting + // state. The QmlComponent is owned by the QmlCompositeTypeData, so a // reference should be kept to keep the QmlComponent alive. QmlComponent *toComponent(QmlEngine *); // Return a QmlCompiledData if possible, or 0 if an error @@ -102,7 +102,7 @@ public QList types; - // Add or remove p as a waiter. When the QmlCompositeTypeData becomes + // Add or remove p as a waiter. When the QmlCompositeTypeData becomes // ready, the QmlComponentPrivate::typeDataReady() method will be invoked on // p. The waiter is automatically removed when the typeDataReady() method // is invoked, so there is no need to call remWaiter() in this case. -- cgit v0.12