Help for qml inspector (with F1), namespace fixes

This commit is contained in:
Lasse Holmstedt
2010-03-22 11:39:14 +01:00
parent ddf421482c
commit 0b010954ad
15 changed files with 196 additions and 47 deletions

View File

@@ -48,7 +48,8 @@
#include <QtGui/qevent.h> #include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE namespace Qml {
namespace Internal {
class QLineGraph : public QWidget class QLineGraph : public QWidget
{ {
@@ -562,6 +563,7 @@ void CanvasFrameRate::enabledToggled(bool checked)
static_cast<QDeclarativeDebugClient *>(m_plugin)->setEnabled(checked); static_cast<QDeclarativeDebugClient *>(m_plugin)->setEnabled(checked);
} }
QT_END_NAMESPACE }
}
#include "canvasframerate.moc" #include "canvasframerate.moc"

View File

@@ -34,15 +34,19 @@
#include <QtCore/qpointer.h> #include <QtCore/qpointer.h>
#include <QtGui/qwidget.h> #include <QtGui/qwidget.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QTabWidget; class QTabWidget;
class QSlider; class QSlider;
class QGroupBox; class QGroupBox;
class QLabel; class QLabel;
class QSpinBox; class QSpinBox;
class QPushButton; class QPushButton;
QT_END_NAMESPACE
namespace Qml {
namespace Internal {
class CanvasFrameRatePlugin; class CanvasFrameRatePlugin;
@@ -57,6 +61,9 @@ public:
void setSizeHint(const QSize &); void setSizeHint(const QSize &);
virtual QSize sizeHint() const; virtual QSize sizeHint() const;
signals:
void contextHelpIdChanged(const QString &helpId);
private slots: private slots:
void clearGraph(); void clearGraph();
void newTab(); void newTab();
@@ -74,7 +81,8 @@ private:
QSize m_sizeHint; QSize m_sizeHint;
}; };
QT_END_NAMESPACE } // Internal
} // Qml
#endif // CANVASFRAMERATE_H #endif // CANVASFRAMERATE_H

View File

@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "expressionquerywidget.h" #include "expressionquerywidget.h"
#include "qmlinspectorconstants.h" #include "qmlinspectorconstants.h"
#include "inspectorcontext.h"
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <utils/filterlineedit.h> #include <utils/filterlineedit.h>
@@ -54,6 +55,10 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
namespace Qml {
namespace Internal {
ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug *client, QWidget *parent) ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug *client, QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_mode(mode), m_mode(mode),
@@ -87,6 +92,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug
m_clearButton->setToolTip(tr("Clear Output")); m_clearButton->setToolTip(tr("Clear Output"));
m_clearButton->setIcon(QIcon(Core::Constants::ICON_CLEAN_PANE)); m_clearButton->setIcon(QIcon(Core::Constants::ICON_CLEAN_PANE));
connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearTextEditor())); connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearTextEditor()));
connect(m_lineEdit, SIGNAL(textChanged(QString)), SLOT(changeContextHelpId(QString)));
connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression())); connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression()));
QHBoxLayout *hbox = new QHBoxLayout(bar); QHBoxLayout *hbox = new QHBoxLayout(bar);
@@ -106,6 +112,11 @@ ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug
clear(); clear();
} }
void ExpressionQueryWidget::changeContextHelpId(const QString &)
{
emit contextHelpIdChanged(InspectorContext::contextHelpIdForItem(m_lineEdit->text()));
}
void ExpressionQueryWidget::clearTextEditor() void ExpressionQueryWidget::clearTextEditor()
{ {
m_textEdit->clear(); m_textEdit->clear();
@@ -339,3 +350,6 @@ bool ExpressionQueryWidget::eventFilter(QObject *obj, QEvent *event)
} }
return QWidget::eventFilter(obj, event); return QWidget::eventFilter(obj, event);
} }
} // Internal
} // Qml

View File

@@ -33,7 +33,6 @@
#include <QtGui/qwidget.h> #include <QtGui/qwidget.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGroupBox; class QGroupBox;
@@ -55,6 +54,9 @@ namespace QmlJSEditor {
class Highlighter; class Highlighter;
} }
namespace Qml {
namespace Internal {
class ExpressionQueryWidget : public QWidget class ExpressionQueryWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@@ -70,6 +72,9 @@ public:
void setEngineDebug(QDeclarativeEngineDebug *client); void setEngineDebug(QDeclarativeEngineDebug *client);
void clear(); void clear();
signals:
void contextHelpIdChanged(const QString &contextHelpId);
protected: protected:
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
@@ -81,6 +86,7 @@ private slots:
void executeExpression(); void executeExpression();
void showResult(); void showResult();
void invokeCompletion(); void invokeCompletion();
void changeContextHelpId(const QString &text);
private: private:
void setFontSettings(); void setFontSettings();
@@ -108,5 +114,8 @@ private:
QDeclarativeDebugObjectReference m_objectAtLastFocus; QDeclarativeDebugObjectReference m_objectAtLastFocus;
}; };
} // Internal
} // Qml
#endif #endif

View File

@@ -27,12 +27,15 @@
** **
**************************************************************************/ **************************************************************************/
#include "objectpropertiesview.h" #include "objectpropertiesview.h"
#include "inspectorcontext.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QTreeWidget> #include <QtGui/QTreeWidget>
#include <QtGui/QLayout> #include <QtGui/QLayout>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
namespace Qml {
namespace Internal {
class PropertiesViewItem : public QObject, public QTreeWidgetItem class PropertiesViewItem : public QObject, public QTreeWidgetItem
@@ -81,6 +84,7 @@ ObjectPropertiesView::ObjectPropertiesView(QDeclarativeEngineDebug *client, QWid
<< tr("Name") << tr("Value") << tr("Type")); << tr("Name") << tr("Value") << tr("Type"));
QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)), QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
this, SLOT(itemActivated(QTreeWidgetItem *))); this, SLOT(itemActivated(QTreeWidgetItem *)));
connect(m_tree, SIGNAL(itemSelectionChanged()), SLOT(changeItemSelection()));
m_tree->setColumnCount(3); m_tree->setColumnCount(3);
m_tree->header()->setDefaultSectionSize(150); m_tree->header()->setDefaultSectionSize(150);
@@ -88,6 +92,16 @@ ObjectPropertiesView::ObjectPropertiesView(QDeclarativeEngineDebug *client, QWid
layout->addWidget(m_tree); layout->addWidget(m_tree);
} }
void ObjectPropertiesView::changeItemSelection()
{
if (m_tree->selectedItems().isEmpty())
return;
QString item = m_object.className();
QString prop = m_tree->selectedItems().first()->text(0);
emit contextHelpIdChanged(InspectorContext::contextHelpIdForProperty(item, prop));
}
void ObjectPropertiesView::setEngineDebug(QDeclarativeEngineDebug *client) void ObjectPropertiesView::setEngineDebug(QDeclarativeEngineDebug *client)
{ {
m_client = client; m_client = client;
@@ -254,4 +268,7 @@ void ObjectPropertiesView::itemActivated(QTreeWidgetItem *i)
emit activated(m_object, item->property); emit activated(m_object, item->property);
} }
}
}
#include "objectpropertiesview.moc" #include "objectpropertiesview.moc"

View File

@@ -41,6 +41,9 @@ class QDeclarativeDebugConnection;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Qml {
namespace Internal {
class PropertiesViewItem; class PropertiesViewItem;
class ObjectPropertiesView : public QWidget class ObjectPropertiesView : public QWidget
@@ -54,12 +57,14 @@ public:
signals: signals:
void activated(const QDeclarativeDebugObjectReference &, const QDeclarativeDebugPropertyReference &); void activated(const QDeclarativeDebugObjectReference &, const QDeclarativeDebugPropertyReference &);
void contextHelpIdChanged(const QString &contextHelpId);
public slots: public slots:
void reload(const QDeclarativeDebugObjectReference &); void reload(const QDeclarativeDebugObjectReference &);
void watchCreated(QDeclarativeDebugWatch *); void watchCreated(QDeclarativeDebugWatch *);
private slots: private slots:
void changeItemSelection();
void queryFinished(); void queryFinished();
void watchStateChanged(); void watchStateChanged();
void valueChanged(const QByteArray &name, const QVariant &value); void valueChanged(const QByteArray &name, const QVariant &value);
@@ -78,7 +83,8 @@ private:
QDeclarativeDebugObjectReference m_object; QDeclarativeDebugObjectReference m_object;
}; };
} // Internal
} // Qml
#endif #endif

View File

@@ -37,8 +37,10 @@
#include <private/qdeclarativedebug_p.h> #include <private/qdeclarativedebug_p.h>
#include "objecttree.h" #include "objecttree.h"
#include "inspectorcontext.h"
//Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference) namespace Qml {
namespace Internal {
ObjectTree::ObjectTree(QDeclarativeEngineDebug *client, QWidget *parent) ObjectTree::ObjectTree(QDeclarativeEngineDebug *client, QWidget *parent)
: QTreeWidget(parent), : QTreeWidget(parent),
@@ -54,6 +56,7 @@ ObjectTree::ObjectTree(QDeclarativeEngineDebug *client, QWidget *parent)
SLOT(currentItemChanged(QTreeWidgetItem *))); SLOT(currentItemChanged(QTreeWidgetItem *)));
connect(this, SIGNAL(itemActivated(QTreeWidgetItem *, int)), connect(this, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
SLOT(activated(QTreeWidgetItem *))); SLOT(activated(QTreeWidgetItem *)));
connect(this, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged()));
} }
void ObjectTree::setEngineDebug(QDeclarativeEngineDebug *client) void ObjectTree::setEngineDebug(QDeclarativeEngineDebug *client)
@@ -61,6 +64,16 @@ void ObjectTree::setEngineDebug(QDeclarativeEngineDebug *client)
m_client = client; m_client = client;
} }
void ObjectTree::selectionChanged()
{
if (selectedItems().isEmpty())
return;
QTreeWidgetItem *item = selectedItems().first();
if (item)
emit contextHelpIdChanged(InspectorContext::contextHelpIdForItem(item->text(0)));
}
void ObjectTree::reload(int objectDebugId) void ObjectTree::reload(int objectDebugId)
{ {
if (!m_client) if (!m_client)
@@ -87,6 +100,8 @@ void ObjectTree::setCurrentObject(int debugId)
scrollToItem(item); scrollToItem(item);
item->setExpanded(true); item->setExpanded(true);
} }
} }
void ObjectTree::objectFetched() void ObjectTree::objectFetched()
@@ -218,3 +233,6 @@ void ObjectTree::mousePressEvent(QMouseEvent *me)
} }
} }
} }
}
}

View File

@@ -41,6 +41,11 @@ class QDeclarativeDebugObjectQuery;
class QDeclarativeDebugContextReference; class QDeclarativeDebugContextReference;
class QDeclarativeDebugConnection; class QDeclarativeDebugConnection;
QT_END_NAMESPACE
namespace Qml {
namespace Internal {
class ObjectTree : public QTreeWidget class ObjectTree : public QTreeWidget
{ {
@@ -54,6 +59,7 @@ signals:
void currentObjectChanged(const QDeclarativeDebugObjectReference &); void currentObjectChanged(const QDeclarativeDebugObjectReference &);
void activated(const QDeclarativeDebugObjectReference &); void activated(const QDeclarativeDebugObjectReference &);
void expressionWatchRequested(const QDeclarativeDebugObjectReference &, const QString &); void expressionWatchRequested(const QDeclarativeDebugObjectReference &, const QString &);
void contextHelpIdChanged(const QString &contextHelpId);
public slots: public slots:
void reload(int objectDebugId); // set the root object void reload(int objectDebugId); // set the root object
@@ -66,6 +72,7 @@ private slots:
void objectFetched(); void objectFetched();
void currentItemChanged(QTreeWidgetItem *); void currentItemChanged(QTreeWidgetItem *);
void activated(QTreeWidgetItem *); void activated(QTreeWidgetItem *);
void selectionChanged();
private: private:
QTreeWidgetItem *findItemByObjectId(int debugId) const; QTreeWidgetItem *findItemByObjectId(int debugId) const;
@@ -78,7 +85,7 @@ private:
QDeclarativeDebugObjectQuery *m_query; QDeclarativeDebugObjectQuery *m_query;
}; };
QT_END_NAMESPACE } // Internal
} // Qml
#endif #endif

View File

@@ -36,7 +36,8 @@
#include <private/qdeclarativedebug_p.h> #include <private/qdeclarativedebug_p.h>
#include <private/qdeclarativemetatype_p.h> #include <private/qdeclarativemetatype_p.h>
QT_BEGIN_NAMESPACE namespace Qml {
namespace Internal {
const int C_NAME = 0; const int C_NAME = 0;
const int C_VALUE = 1; const int C_VALUE = 1;
@@ -166,6 +167,8 @@ QVariant WatchTableModel::data(const QModelIndex &idx, int role) const
bool WatchTableModel::setData ( const QModelIndex & index, const QVariant & value, int role) bool WatchTableModel::setData ( const QModelIndex & index, const QVariant & value, int role)
{ {
Q_UNUSED(index);
Q_UNUSED(value);
if (role == Qt::EditRole) { if (role == Qt::EditRole) {
return true; return true;
} }
@@ -335,4 +338,6 @@ void WatchTableView::mousePressEvent(QMouseEvent *me)
} }
} }
QT_END_NAMESPACE
} // Internal
} // Qml

View File

@@ -45,6 +45,11 @@ class QDeclarativeDebugConnection;
class QDeclarativeDebugPropertyReference; class QDeclarativeDebugPropertyReference;
class QDeclarativeDebugObjectReference; class QDeclarativeDebugObjectReference;
QT_END_NAMESPACE
namespace Qml {
namespace Internal {
class WatchTableModel : public QAbstractTableModel class WatchTableModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
@@ -117,6 +122,7 @@ public:
signals: signals:
void objectActivated(int objectDebugId); void objectActivated(int objectDebugId);
void contextHelpIdChanged(const QString &contextHelpId);
protected: protected:
void mousePressEvent(QMouseEvent *me); void mousePressEvent(QMouseEvent *me);
@@ -130,6 +136,7 @@ private:
}; };
QT_END_NAMESPACE } // Internal
} // Qml
#endif // WATCHTABLEMODEL_H #endif // WATCHTABLEMODEL_H

View File

@@ -30,8 +30,15 @@
#include "inspectorcontext.h" #include "inspectorcontext.h"
#include "qmlinspectorconstants.h" #include "qmlinspectorconstants.h"
#include "components/objectpropertiesview.h"
#include "components/objecttree.h"
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <QWidget> #include <QWidget>
#include <QDebug>
namespace Qml { namespace Qml {
namespace Internal { namespace Internal {
@@ -57,9 +64,26 @@ QWidget *InspectorContext::widget()
return m_widget; return m_widget;
} }
void InspectorContext::setContextHelpId(const QString &helpId)
{
m_contextHelpId = helpId;
}
QString InspectorContext::contextHelpId() const QString InspectorContext::contextHelpId() const
{ {
return QString(); return m_contextHelpId;
}
QString InspectorContext::contextHelpIdForProperty(const QString &itemName, const QString &propName)
{
// TODO this functionality is not supported yet as we don't have help id's for
// properties.
return QString("QML.").append(itemName).append(".").append(propName);
}
QString InspectorContext::contextHelpIdForItem(const QString &itemName)
{
return QString("QML.").append(itemName);
} }
} }

View File

@@ -40,6 +40,8 @@ QT_END_NAMESPACE
namespace Qml { namespace Qml {
namespace Internal { namespace Internal {
class ObjectPropertiesView;
class ObjectTree;
class DesignModeWidget; class DesignModeWidget;
/** /**
@@ -47,6 +49,8 @@ class DesignModeWidget;
*/ */
class InspectorContext : public Core::IContext class InspectorContext : public Core::IContext
{ {
Q_OBJECT
public: public:
InspectorContext(QWidget *widget); InspectorContext(QWidget *widget);
~InspectorContext(); ~InspectorContext();
@@ -56,12 +60,20 @@ public:
QString contextHelpId() const; QString contextHelpId() const;
static QString contextHelpIdForProperty(const QString &itemName, const QString &propName);
static QString contextHelpIdForItem(const QString &itemName);
public slots:
void setContextHelpId(const QString &helpId);
private: private:
QList<int> m_context; QList<int> m_context;
QWidget *m_widget; QWidget *m_widget;
QString m_contextHelpId;
}; };
} } // Internal
} } // Qml
#endif // DESIGNMODECONTEXT_H #endif // DESIGNMODECONTEXT_H

View File

@@ -88,6 +88,7 @@ using namespace Qml;
namespace Qml { namespace Qml {
namespace Internal {
class EngineSpinBox : public QSpinBox class EngineSpinBox : public QSpinBox
{ {
Q_OBJECT Q_OBJECT
@@ -111,8 +112,6 @@ private:
QList<EngineInfo> m_engines; QList<EngineInfo> m_engines;
}; };
}
EngineSpinBox::EngineSpinBox(QWidget *parent) EngineSpinBox::EngineSpinBox(QWidget *parent)
: QSpinBox(parent) : QSpinBox(parent)
{ {
@@ -157,6 +156,8 @@ int EngineSpinBox::valueFromText(const QString &text) const
return -1; return -1;
} }
} // Internal
QmlInspector::QmlInspector(QObject *parent) QmlInspector::QmlInspector(QObject *parent)
: QObject(parent), : QObject(parent),
@@ -169,15 +170,13 @@ QmlInspector::QmlInspector(QObject *parent)
m_propertyWatcherDock(0), m_propertyWatcherDock(0),
m_inspectorOutputDock(0) m_inspectorOutputDock(0)
{ {
m_watchTableModel = new WatchTableModel(0, this); m_watchTableModel = new Internal::WatchTableModel(0, this);
m_objectTreeWidget = new ObjectTree; m_objectTreeWidget = new Internal::ObjectTree;
m_propertiesWidget = new ObjectPropertiesView; m_propertiesWidget = new Internal::ObjectPropertiesView;
m_watchTableView = new WatchTableView(m_watchTableModel); m_watchTableView = new Internal::WatchTableView(m_watchTableModel);
m_frameRateWidget = new CanvasFrameRate; m_frameRateWidget = new Internal::CanvasFrameRate;
m_expressionWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode); m_expressionWidget = new Internal::ExpressionQueryWidget(Internal::ExpressionQueryWidget::SeparateEntryMode);
m_context = new Internal::InspectorContext(m_expressionWidget);
m_expressionWidget->createCommands(m_context);
} }
bool QmlInspector::connectToViewer() bool QmlInspector::connectToViewer()
@@ -300,7 +299,7 @@ void QmlInspector::connectionError()
void QmlInspector::createDockWidgets() void QmlInspector::createDockWidgets()
{ {
m_engineSpinBox = new EngineSpinBox; m_engineSpinBox = new Internal::EngineSpinBox;
m_engineSpinBox->setEnabled(false); m_engineSpinBox->setEnabled(false);
connect(m_engineSpinBox, SIGNAL(valueChanged(int)), connect(m_engineSpinBox, SIGNAL(valueChanged(int)),
SLOT(queryEngineContext(int))); SLOT(queryEngineContext(int)));
@@ -324,7 +323,7 @@ void QmlInspector::createDockWidgets()
treeWindowLayout->addWidget(m_objectTreeWidget); treeWindowLayout->addWidget(m_objectTreeWidget);
m_watchTableView->setModel(m_watchTableModel); m_watchTableView->setModel(m_watchTableModel);
WatchTableHeaderView *header = new WatchTableHeaderView(m_watchTableModel); Internal::WatchTableHeaderView *header = new Internal::WatchTableHeaderView(m_watchTableModel);
m_watchTableView->setHorizontalHeader(header); m_watchTableView->setHorizontalHeader(header);
connect(m_objectTreeWidget, SIGNAL(activated(QDeclarativeDebugObjectReference)), connect(m_objectTreeWidget, SIGNAL(activated(QDeclarativeDebugObjectReference)),
@@ -387,6 +386,23 @@ void QmlInspector::createDockWidgets()
m_dockWidgets << m_objectTreeDock << m_frameRateDock << m_propertyWatcherDock << m_inspectorOutputDock; m_dockWidgets << m_objectTreeDock << m_frameRateDock << m_propertyWatcherDock << m_inspectorOutputDock;
m_context = new Internal::InspectorContext(m_objectTreeDock);
m_propWatcherContext = new Internal::InspectorContext(m_propertyWatcherDock);
Core::ICore *core = Core::ICore::instance();
core->addContextObject(m_propWatcherContext);
core->addContextObject(m_context);
m_expressionWidget->createCommands(m_context);
connect(m_objectTreeWidget, SIGNAL(contextHelpIdChanged(QString)), m_context,
SLOT(setContextHelpId(QString)));
connect(m_watchTableView, SIGNAL(contextHelpIdChanged(QString)), m_propWatcherContext,
SLOT(setContextHelpId(QString)));
connect(m_propertiesWidget, SIGNAL(contextHelpIdChanged(QString)), m_propWatcherContext,
SLOT(setContextHelpId(QString)));
connect(m_expressionWidget, SIGNAL(contextHelpIdChanged(QString)), m_propWatcherContext,
SLOT(setContextHelpId(QString)));
} }
void QmlInspector::setSimpleDockWidgetArrangement() void QmlInspector::setSimpleDockWidgetArrangement()
@@ -507,4 +523,6 @@ void QmlInspector::treeObjectActivated(const QDeclarativeDebugObjectReference &o
} }
} }
} // Qml
#include "qmlinspector.moc" #include "qmlinspector.moc"

View File

@@ -48,24 +48,26 @@ class QDeclarativeDebugConnection;
class QDeclarativeDebugEnginesQuery; class QDeclarativeDebugEnginesQuery;
class QDeclarativeDebugRootContextQuery; class QDeclarativeDebugRootContextQuery;
class QDeclarativeDebugObjectReference; class QDeclarativeDebugObjectReference;
class ObjectTree;
class WatchTableModel;
class WatchTableView;
class CanvasFrameRate;
QT_END_NAMESPACE QT_END_NAMESPACE
class ObjectPropertiesView;
class ExpressionQueryWidget;
namespace Core { namespace Core {
class IContext; class IContext;
} }
namespace Qml { namespace Qml {
class EngineSpinBox;
namespace Internal { namespace Internal {
class EngineSpinBox;
class InspectorContext; class InspectorContext;
class ObjectTree;
class ObjectPropertiesView;
class WatchTableModel;
class WatchTableView;
class CanvasFrameRate;
class ExpressionQueryWidget;
class EngineSpinBox;
} }
class QMLINSPECTOR_EXPORT QmlInspector : public QObject class QMLINSPECTOR_EXPORT QmlInspector : public QObject
@@ -104,14 +106,14 @@ private:
QDeclarativeDebugEnginesQuery *m_engineQuery; QDeclarativeDebugEnginesQuery *m_engineQuery;
QDeclarativeDebugRootContextQuery *m_contextQuery; QDeclarativeDebugRootContextQuery *m_contextQuery;
ObjectTree *m_objectTreeWidget; Internal::ObjectTree *m_objectTreeWidget;
ObjectPropertiesView *m_propertiesWidget; Internal::ObjectPropertiesView *m_propertiesWidget;
WatchTableModel *m_watchTableModel; Internal::WatchTableModel *m_watchTableModel;
WatchTableView *m_watchTableView; Internal::WatchTableView *m_watchTableView;
CanvasFrameRate *m_frameRateWidget; Internal::CanvasFrameRate *m_frameRateWidget;
ExpressionQueryWidget *m_expressionWidget; Internal::ExpressionQueryWidget *m_expressionWidget;
EngineSpinBox *m_engineSpinBox; Internal::EngineSpinBox *m_engineSpinBox;
QDockWidget *m_objectTreeDock; QDockWidget *m_objectTreeDock;
QDockWidget *m_frameRateDock; QDockWidget *m_frameRateDock;
@@ -120,6 +122,7 @@ private:
QList<QDockWidget*> m_dockWidgets; QList<QDockWidget*> m_dockWidgets;
Internal::InspectorContext *m_context; Internal::InspectorContext *m_context;
Internal::InspectorContext *m_propWatcherContext;
}; };

View File

@@ -97,19 +97,18 @@ bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *error
{ {
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(errorString); Q_UNUSED(errorString);
Core::ICore *core = Core::ICore::instance();
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
SLOT(prepareDebugger(Core::IMode*))); SLOT(prepareDebugger(Core::IMode*)));
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
Debugger::DebuggerUISwitcher *uiSwitcher = pluginManager->getObject<Debugger::DebuggerUISwitcher>(); Debugger::DebuggerUISwitcher *uiSwitcher = pluginManager->getObject<Debugger::DebuggerUISwitcher>();
uiSwitcher->addLanguage(Qml::Constants::LANG_QML,
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(Constants::C_INSPECTOR));
m_inspector = new QmlInspector; m_inspector = new QmlInspector;
addObject(m_inspector);
Core::ICore::instance()->addContextObject(m_inspector->context());
uiSwitcher->addLanguage(Qml::Constants::LANG_QML, m_inspector->context()->context());
m_inspector->createDockWidgets(); m_inspector->createDockWidgets();
addObject(m_inspector);
connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector())); connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector()));