From d0f965f1bde20babbb0574007f9cf8439b955a9b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 22 Oct 2009 11:51:59 +1000 Subject: Allow canvas sizehint to be configurable and fix signal-slot connections in engine.cpp --- tools/qmldebugger/canvasframerate.cpp | 18 ++++++++++++------ tools/qmldebugger/canvasframerate.h | 4 ++++ tools/qmldebugger/engine.cpp | 4 ++-- tools/qmldebugger/objecttree.cpp | 1 + tools/qmldebugger/qmldebugger.cpp | 1 + 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp index 0d23050..7c5d089 100644 --- a/tools/qmldebugger/canvasframerate.cpp +++ b/tools/qmldebugger/canvasframerate.cpp @@ -32,7 +32,6 @@ public slots: protected: virtual void paintEvent(QPaintEvent *); - virtual QSize sizeHint() const; private slots: void scrollbarChanged(int); @@ -57,6 +56,8 @@ private: QLineGraph::QLineGraph(QWidget *parent) : QWidget(parent), sb(Qt::Horizontal, this), position(-1), samplesPerWidth(99), resolutionForHeight(50), ignoreScroll(false) { + setMinimumHeight(180); + sb.setMaximum(0); sb.setMinimum(0); sb.setSingleStep(1); @@ -68,11 +69,6 @@ QLineGraph::QLineGraph(QWidget *parent) QObject::connect(&sb, SIGNAL(valueChanged(int)), this, SLOT(scrollbarChanged(int))); } -QSize QLineGraph::sizeHint() const -{ - return QSize(800, 600); -} - void QLineGraph::scrollbarChanged(int v) { if(ignoreScroll) @@ -291,6 +287,16 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent) newTab(); } +void CanvasFrameRate::setSizeHint(const QSize &size) +{ + m_sizeHint = size; +} + +QSize CanvasFrameRate::sizeHint() const +{ + return m_sizeHint; +} + void CanvasFrameRate::newTab() { if (m_tabs->count()) { diff --git a/tools/qmldebugger/canvasframerate.h b/tools/qmldebugger/canvasframerate.h index cef267d..aa275aa 100644 --- a/tools/qmldebugger/canvasframerate.h +++ b/tools/qmldebugger/canvasframerate.h @@ -14,6 +14,9 @@ class CanvasFrameRate : public QWidget public: CanvasFrameRate(QmlDebugConnection *, QWidget *parent = 0); + void setSizeHint(const QSize &); + virtual QSize sizeHint() const; + private slots: void newTab(); void stateChanged(int); @@ -22,6 +25,7 @@ private: QTabWidget *m_tabs; QSpinBox *m_spin; QObject *m_plugin; + QSize m_sizeHint; }; QT_END_NAMESPACE diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/engine.cpp index fac10f3..3cf5165 100644 --- a/tools/qmldebugger/engine.cpp +++ b/tools/qmldebugger/engine.cpp @@ -71,7 +71,7 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent) WatchTableHeaderView *header = new WatchTableHeaderView(m_watchTableModel); m_watchTableView->setHorizontalHeader(header); - connect(m_objTree, SIGNAL(objectSelected(QmlDebugObjectReference)), + connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)), m_propertiesView, SLOT(reload(QmlDebugObjectReference))); connect(m_objTree, SIGNAL(expressionWatchRequested(QmlDebugObjectReference,QString)), m_watchTableModel, SLOT(expressionWatchRequested(QmlDebugObjectReference,QString))); @@ -83,7 +83,7 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent) m_propertiesView, SLOT(watchCreated(QmlDebugWatch*))); connect(m_watchTableView, SIGNAL(objectActivated(int)), - m_objTree, SLOT(selectObject(int))); + m_objTree, SLOT(setCurrentObject(int))); m_tabs = new QTabWidget(this); m_tabs->addTab(m_propertiesView, tr("Properties")); diff --git a/tools/qmldebugger/objecttree.cpp b/tools/qmldebugger/objecttree.cpp index 0b92ceb..1254ae7 100644 --- a/tools/qmldebugger/objecttree.cpp +++ b/tools/qmldebugger/objecttree.cpp @@ -18,6 +18,7 @@ ObjectTree::ObjectTree(QmlEngineDebug *client, QWidget *parent) m_query(0) { setHeaderHidden(true); + setMinimumWidth(250); connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(currentItemChanged(QTreeWidgetItem *))); diff --git a/tools/qmldebugger/qmldebugger.cpp b/tools/qmldebugger/qmldebugger.cpp index e0a76b6..2828026 100644 --- a/tools/qmldebugger/qmldebugger.cpp +++ b/tools/qmldebugger/qmldebugger.cpp @@ -46,6 +46,7 @@ QmlDebugger::QmlDebugger(QWidget *parent) layout->addWidget(m_tabs); CanvasFrameRate *cfr = new CanvasFrameRate(&client, this); + cfr->setSizeHint(QSize(800, 600)); m_tabs->addTab(cfr, tr("Frame Rate")); m_enginePane = new EnginePane(&client, this); -- cgit v0.12 From c5315a322a65971d636bd73e2444cdd8565e00f4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 26 Oct 2009 13:33:29 +1000 Subject: Fix accessing QmlList data as a model. --- src/declarative/fx/qfxvisualitemmodel.cpp | 15 ++++++++++----- src/declarative/util/qmllistaccessor.cpp | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index a078da6..e1ac246 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -102,7 +102,7 @@ QHash QFxVisualItemModelAttached::attache class QFxVisualItemModelPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QFxVisualItemModel); + Q_DECLARE_PUBLIC(QFxVisualItemModel) public: QFxVisualItemModelPrivate() : QObjectPrivate(), children(this) {} @@ -143,7 +143,7 @@ public: \code Item { VisualItemModel { - id: ItemModel + id: itemModel Rectangle { height: 30; width: 80; color: "red" } Rectangle { height: 30; width: 80; color: "green" } Rectangle { height: 30; width: 80; color: "blue" } @@ -151,7 +151,7 @@ public: ListView { anchors.fill: parent - model: ItemModel + model: itemModel } } \endcode @@ -416,8 +416,13 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { model->ensureRoles(); - if (model->m_roleNames.contains(QString::fromUtf8(name))) + if (model->m_roleNames.contains(QString::fromUtf8(name))) { return QmlOpenMetaObject::createProperty(name, type); + } else if (model->m_listAccessor->type() == QmlListAccessor::QmlList) { + QObject *object = model->m_listAccessor->at(data->m_index).value(); + if (object && object->property(name).isValid()) + return QmlOpenMetaObject::createProperty(name, type); + } } else { model->ensureRoles(); QString sname = QString::fromUtf8(name); @@ -448,7 +453,7 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro return model->m_listAccessor->at(data->m_index); } else { // return any property of a single object instance. - QObject *object = model->m_listAccessor->at(0).value(); + QObject *object = model->m_listAccessor->at(data->m_index).value(); return object->property(prop.name()); } } else if (model->m_listModelInterface) { diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index 578646b..21007d6 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -136,7 +136,7 @@ QVariant QmlListAccessor::at(int idx) const QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); void *ptr[1]; li->at(idx, ptr); - return QmlMetaType::fromObject((QObject*)ptr[0], li->type()); //XXX only handles QObject-derived types + return QVariant::fromValue((QObject*)ptr[0]); } case QList: return QmlMetaType::listAt(d, idx); -- cgit v0.12 From 8c1bffc7fa73e5249046bae949069bf8df23b78d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 26 Oct 2009 13:55:18 +1000 Subject: Docs. --- doc/src/declarative/extending.qdoc | 15 +++++++++++++-- doc/src/declarative/qtdeclarative.qdoc | 1 + examples/declarative/extending/attached/birthdayparty.h | 8 +++++--- examples/declarative/extending/binding/birthdayparty.h | 8 +++++--- examples/declarative/extending/signal/birthdayparty.h | 8 +++++--- .../declarative/extending/valuesource/birthdayparty.h | 8 +++++--- src/declarative/fx/qfxgridview.cpp | 5 ++--- src/declarative/fx/qfxlistview.cpp | 5 ++--- 8 files changed, 38 insertions(+), 20 deletions(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index db35961..b872632 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -300,11 +300,22 @@ attachment object are those that become available for use as the attached property block. Any QML type can become an attaching type by declaring the -\c qmlAttachedProperties() public function: +\c qmlAttachedProperties() public function and declaring that the class has +QML_HAS_ATTACHED_PROPERTIES: \quotation \code -static AttachedPropertiesType *qmlAttachedProperties(QObject *object) +class MyType : public QObject { + Q_OBJECT +public: + + ... + + static AttachedPropertiesType *qmlAttachedProperties(QObject *object); +}; + +QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(MyType) \endcode Return an attachment object, of type \a AttachedPropertiesType, for the attachee \a object instance. It is customary, though not strictly required, for diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 7be98db..ba2d70e 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -84,6 +84,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+ \o \l {QML Documents} \o \l {Property Binding} \o \l {ECMAScript Blocks} +\o \l {QML Scope} \o \l {Network Transparency} \o \l {qmlmodels}{Data Models} \o \l {anchor-layout}{Anchor-based Layout} diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h index 8249af5..2ea065c 100644 --- a/examples/declarative/extending/attached/birthdayparty.h +++ b/examples/declarative/extending/attached/birthdayparty.h @@ -9,7 +9,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -19,7 +19,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -40,6 +40,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h index 6905746..2757561 100644 --- a/examples/declarative/extending/binding/birthdayparty.h +++ b/examples/declarative/extending/binding/birthdayparty.h @@ -10,7 +10,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged) public: BirthdayPartyAttached(QObject *object); @@ -23,7 +23,7 @@ signals: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -56,6 +56,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h index 14d7c29..5dea2e8 100644 --- a/examples/declarative/extending/signal/birthdayparty.h +++ b/examples/declarative/extending/signal/birthdayparty.h @@ -9,7 +9,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -19,7 +19,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -47,6 +47,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h index fd25f28..75a2477 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.h +++ b/examples/declarative/extending/valuesource/birthdayparty.h @@ -10,7 +10,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -20,7 +20,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -52,6 +52,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 36c06a4..0b2a935 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -736,14 +736,13 @@ QFxGridView::~QFxGridView() \endcode */ -//XXX change to \qmlattachedsignal when it exists. /*! - \qmlattachedproperty void GridView::onAdd + \qmlattachedsignal GridView::onAdd() This attached handler is called immediately after an item is added to the view. */ /*! - \qmlattachedproperty void GridView::onRemove + \qmlattachedsignal GridView::onRemove() This attached handler is called immediately before an item is removed from the view. */ diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 23bf573..1a4a60c 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -926,14 +926,13 @@ QFxListView::~QFxListView() \endcode */ -//XXX change to \qmlattachedsignal when it exists. /*! - \qmlattachedproperty void ListView::onAdd + \qmlattachedsignal ListView::onAdd() This attached handler is called immediately after an item is added to the view. */ /*! - \qmlattachedproperty void ListView::onRemove + \qmlattachedsignal ListView::onRemove() This attached handler is called immediately before an item is removed from the view. */ -- cgit v0.12 From 90a883796acb961a572c90d53c0505110a466a8a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 26 Oct 2009 14:11:32 +1000 Subject: Fix to show expression query widget and allow QmlEngineDebug values for widgets to be changed after construction. --- tools/qmldebugger/engine.cpp | 17 ++++++++++++++--- tools/qmldebugger/engine.h | 5 +++-- tools/qmldebugger/expressionquerywidget.cpp | 27 ++++++++++++++++----------- tools/qmldebugger/expressionquerywidget.h | 7 +++++-- tools/qmldebugger/objectpropertiesview.cpp | 9 ++++++++- tools/qmldebugger/objectpropertiesview.h | 5 ++++- tools/qmldebugger/objecttree.cpp | 8 ++++++++ tools/qmldebugger/objecttree.h | 5 ++++- tools/qmldebugger/watchtable.cpp | 13 ++++++++++++- tools/qmldebugger/watchtable.h | 5 ++++- 10 files changed, 78 insertions(+), 23 deletions(-) diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/engine.cpp index 3cf5165..a1fd009 100644 --- a/tools/qmldebugger/engine.cpp +++ b/tools/qmldebugger/engine.cpp @@ -12,6 +12,7 @@ #include "engine.h" #include "objectpropertiesview.h" +#include "expressionquerywidget.h" #include "objecttree.h" #include "watchtable.h" @@ -37,7 +38,7 @@ private: }; EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent) -: QWidget(parent), m_client(new QmlEngineDebug(conn, this)), m_engines(0), m_context(0), m_watchTableModel(0) +: QWidget(parent), m_client(new QmlEngineDebug(conn, this)), m_engines(0), m_context(0), m_watchTableModel(0), m_exprQueryWidget(0) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -84,9 +85,19 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent) connect(m_watchTableView, SIGNAL(objectActivated(int)), m_objTree, SLOT(setCurrentObject(int))); - + + m_exprQueryWidget = new ExpressionQueryWidget(m_client); + connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)), + m_exprQueryWidget, SLOT(setCurrentObject(QmlDebugObjectReference))); + + QSplitter *propertiesTab = new QSplitter(Qt::Vertical); + propertiesTab->addWidget(m_propertiesView); + propertiesTab->addWidget(m_exprQueryWidget); + propertiesTab->setStretchFactor(0, 2); + propertiesTab->setStretchFactor(1, 1); + m_tabs = new QTabWidget(this); - m_tabs->addTab(m_propertiesView, tr("Properties")); + m_tabs->addTab(propertiesTab, tr("Properties")); m_tabs->addTab(m_watchTableView, tr("Watched")); splitter->addWidget(m_objTree); diff --git a/tools/qmldebugger/engine.h b/tools/qmldebugger/engine.h index 8e8c0f2..a3ebe46 100644 --- a/tools/qmldebugger/engine.h +++ b/tools/qmldebugger/engine.h @@ -17,6 +17,7 @@ class QmlDebugWatch; class ObjectTree; class WatchTableModel; class WatchTableView; +class ExpressionQueryWidget; class QTabWidget; @@ -45,12 +46,12 @@ private: ObjectTree *m_objTree; QTabWidget *m_tabs; WatchTableView *m_watchTableView; + WatchTableModel *m_watchTableModel; + ExpressionQueryWidget *m_exprQueryWidget; QmlView *m_engineView; QList m_engineItems; - WatchTableModel *m_watchTableModel; - ObjectPropertiesView *m_propertiesView; }; diff --git a/tools/qmldebugger/expressionquerywidget.cpp b/tools/qmldebugger/expressionquerywidget.cpp index b29b465..53ede3a 100644 --- a/tools/qmldebugger/expressionquerywidget.cpp +++ b/tools/qmldebugger/expressionquerywidget.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -14,25 +16,21 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa m_style(Compact), m_client(client), m_query(0), - m_groupBox(0), m_textEdit(new QTextEdit), m_lineEdit(0), m_button(0) { m_prompt = QLatin1String(">> "); - m_groupBox = new QGroupBox; - QVBoxLayout *vbox = new QVBoxLayout(m_groupBox); - vbox->addWidget(m_textEdit); - QVBoxLayout *layout = new QVBoxLayout(this); - layout->addWidget(m_groupBox); + layout->setMargin(0); + layout->addWidget(m_textEdit); updateTitle(); if (m_style == Compact) { QHBoxLayout *hbox = new QHBoxLayout; - m_button = new QPushButton(tr("Execute")); + m_button = new QPushButton(tr("Query")); m_button->setEnabled(false); connect(m_button, SIGNAL(clicked()), SLOT(executeExpression())); m_lineEdit = new QLineEdit; @@ -41,7 +39,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa hbox->addWidget(new QLabel(tr("Expression:"))); hbox->addWidget(m_lineEdit); hbox->addWidget(m_button); - vbox->addLayout(hbox); + layout->addLayout(hbox); m_textEdit->setReadOnly(true); m_lineEdit->installEventFilter(this); @@ -50,17 +48,21 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa } } +void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client) +{ + m_client = client; +} + void ExpressionQueryWidget::updateTitle() { if (m_currObject.debugId() < 0) { - m_groupBox->setTitle(tr("Expression queries")); + m_title = tr("Expression queries"); } else { QString desc = QLatin1String("<") + m_currObject.className() + QLatin1String(": ") + (m_currObject.name().isEmpty() ? QLatin1String("") : m_currObject.name()) + QLatin1String(">"); - m_groupBox->setTitle(tr("Expression queries (using context for %1)" - , "Selected object").arg(desc)); + m_title = tr("Expression queries (using context for %1)" , "Selected object").arg(desc); } } @@ -103,6 +105,9 @@ void ExpressionQueryWidget::showCurrentContext() void ExpressionQueryWidget::executeExpression() { + if (!m_client) + return; + if (m_style == Compact) m_expr = m_lineEdit->text().trimmed(); else diff --git a/tools/qmldebugger/expressionquerywidget.h b/tools/qmldebugger/expressionquerywidget.h index 8db8f9f..3d9b580 100644 --- a/tools/qmldebugger/expressionquerywidget.h +++ b/tools/qmldebugger/expressionquerywidget.h @@ -21,7 +21,9 @@ public: Shell }; - ExpressionQueryWidget(QmlEngineDebug *client, QWidget *parent = 0); + ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0); + + void setEngineDebug(QmlEngineDebug *client); protected: bool eventFilter(QObject *obj, QEvent *event); @@ -44,7 +46,6 @@ private: QmlEngineDebug *m_client; QmlDebugExpressionQuery *m_query; - QGroupBox *m_groupBox; QTextEdit *m_textEdit; QLineEdit *m_lineEdit; QPushButton *m_button; @@ -52,6 +53,8 @@ private: QString m_expr; QString m_lastExpr; + QString m_title; + QmlDebugObjectReference m_currObject; QmlDebugObjectReference m_objectAtLastFocus; }; diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/objectpropertiesview.cpp index 61afe3f..274552a 100644 --- a/tools/qmldebugger/objectpropertiesview.cpp +++ b/tools/qmldebugger/objectpropertiesview.cpp @@ -53,8 +53,15 @@ ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *pare layout->addWidget(m_tree); } +void ObjectPropertiesView::setEngineDebug(QmlEngineDebug *client) +{ + m_client = client; +} + void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj) { + if (!m_client) + return; if (m_query) delete m_query; @@ -68,7 +75,7 @@ void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj) void ObjectPropertiesView::queryFinished() { - if (!m_query) + if (!m_client || !m_query) return; QmlDebugObjectReference obj = m_query->object(); diff --git a/tools/qmldebugger/objectpropertiesview.h b/tools/qmldebugger/objectpropertiesview.h index 0f72ff4..d555940 100644 --- a/tools/qmldebugger/objectpropertiesview.h +++ b/tools/qmldebugger/objectpropertiesview.h @@ -9,13 +9,16 @@ QT_BEGIN_NAMESPACE class QTreeWidget; class QTreeWidgetItem; +class QmlDebugConnection; class ObjectPropertiesView : public QWidget { Q_OBJECT public: - ObjectPropertiesView(QmlEngineDebug *client, QWidget *parent = 0); + ObjectPropertiesView(QmlEngineDebug *client = 0, QWidget *parent = 0); + void setEngineDebug(QmlEngineDebug *client); + signals: void activated(const QmlDebugObjectReference &, const QmlDebugPropertyReference &); diff --git a/tools/qmldebugger/objecttree.cpp b/tools/qmldebugger/objecttree.cpp index 1254ae7..981a80b 100644 --- a/tools/qmldebugger/objecttree.cpp +++ b/tools/qmldebugger/objecttree.cpp @@ -24,8 +24,16 @@ ObjectTree::ObjectTree(QmlEngineDebug *client, QWidget *parent) this, SLOT(currentItemChanged(QTreeWidgetItem *))); } +void ObjectTree::setEngineDebug(QmlEngineDebug *client) +{ + m_client = client; +} + void ObjectTree::reload(int objectDebugId) { + if (!m_client) + return; + if (m_query) { delete m_query; m_query = 0; diff --git a/tools/qmldebugger/objecttree.h b/tools/qmldebugger/objecttree.h index 3c0a5c6..95820f3 100644 --- a/tools/qmldebugger/objecttree.h +++ b/tools/qmldebugger/objecttree.h @@ -11,14 +11,17 @@ class QmlEngineDebug; class QmlDebugObjectReference; class QmlDebugObjectQuery; class QmlDebugContextReference; +class QmlDebugConnection; class ObjectTree : public QTreeWidget { Q_OBJECT public: - ObjectTree(QmlEngineDebug *client, QWidget *parent = 0); + ObjectTree(QmlEngineDebug *client = 0, QWidget *parent = 0); + void setEngineDebug(QmlEngineDebug *client); + signals: void currentObjectChanged(const QmlDebugObjectReference &); void expressionWatchRequested(const QmlDebugObjectReference &, const QString &); diff --git a/tools/qmldebugger/watchtable.cpp b/tools/qmldebugger/watchtable.cpp index 512bfb2..774727b 100644 --- a/tools/qmldebugger/watchtable.cpp +++ b/tools/qmldebugger/watchtable.cpp @@ -23,6 +23,11 @@ WatchTableModel::~WatchTableModel() delete m_columns[i].watch; } +void WatchTableModel::setEngineDebug(QmlEngineDebug *client) +{ + m_client = client; +} + void WatchTableModel::addWatch(QmlDebugWatch *watch, const QString &title) { QString property; @@ -193,7 +198,7 @@ void WatchTableModel::addValue(int column, const QVariant &value) void WatchTableModel::togglePropertyWatch(const QmlDebugObjectReference &object, const QmlDebugPropertyReference &property) { - if (!property.hasNotifySignal()) + if (!m_client || !property.hasNotifySignal()) return; QmlDebugWatch *watch = findWatch(object.debugId(), property.name()); @@ -228,6 +233,9 @@ void WatchTableModel::watchedValueChanged(const QByteArray &propertyName, const void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &obj, const QString &expr) { + if (!m_client) + return; + QmlDebugWatch *watch = m_client->addWatch(obj, expr, this); if (watch->state() == QmlDebugWatch::Dead) { @@ -241,6 +249,9 @@ void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &ob void WatchTableModel::stopWatching(int column) { + if (!m_client) + return; + QmlDebugWatch *watch = findWatch(column); if (watch) { m_client->removeWatch(watch); diff --git a/tools/qmldebugger/watchtable.h b/tools/qmldebugger/watchtable.h index abada2b..772142c 100644 --- a/tools/qmldebugger/watchtable.h +++ b/tools/qmldebugger/watchtable.h @@ -13,6 +13,7 @@ QT_BEGIN_NAMESPACE class QmlDebugWatch; class QmlEngineDebug; +class QmlDebugConnection; class QmlDebugPropertyReference; class QmlDebugObjectReference; @@ -20,9 +21,11 @@ class WatchTableModel : public QAbstractTableModel { Q_OBJECT public: - WatchTableModel(QmlEngineDebug *client, QObject *parent = 0); + WatchTableModel(QmlEngineDebug *client = 0, QObject *parent = 0); ~WatchTableModel(); + void setEngineDebug(QmlEngineDebug *client); + QmlDebugWatch *findWatch(int column) const; int columnForWatch(QmlDebugWatch *watch) const; -- cgit v0.12