diff options
author | Lasse Holmstedt <lasse.holmstedt@nokia.com> | 2010-03-22 11:39:14 +0100 |
---|---|---|
committer | Lasse Holmstedt <lasse.holmstedt@nokia.com> | 2010-03-22 11:43:54 +0100 |
commit | 0b010954ad485ca3df986bf39a933df437d30fad (patch) | |
tree | 865b39f7ca9fa8451f6d54c212f3b4f0c02b4d95 /src/plugins/qmlinspector/components | |
parent | ddf421482c2e749d1f730e4633bb4d61b0a6411e (diff) | |
download | qt-creator-0b010954ad485ca3df986bf39a933df437d30fad.tar.gz |
Help for qml inspector (with F1), namespace fixes
Diffstat (limited to 'src/plugins/qmlinspector/components')
10 files changed, 106 insertions, 13 deletions
diff --git a/src/plugins/qmlinspector/components/canvasframerate.cpp b/src/plugins/qmlinspector/components/canvasframerate.cpp index 0cd3cab01b..d3f6179d8f 100644 --- a/src/plugins/qmlinspector/components/canvasframerate.cpp +++ b/src/plugins/qmlinspector/components/canvasframerate.cpp @@ -48,7 +48,8 @@ #include <QtGui/qevent.h> -QT_BEGIN_NAMESPACE +namespace Qml { +namespace Internal { class QLineGraph : public QWidget { @@ -562,6 +563,7 @@ void CanvasFrameRate::enabledToggled(bool checked) static_cast<QDeclarativeDebugClient *>(m_plugin)->setEnabled(checked); } -QT_END_NAMESPACE +} +} #include "canvasframerate.moc" diff --git a/src/plugins/qmlinspector/components/canvasframerate.h b/src/plugins/qmlinspector/components/canvasframerate.h index b067374e89..d65ebc71e6 100644 --- a/src/plugins/qmlinspector/components/canvasframerate.h +++ b/src/plugins/qmlinspector/components/canvasframerate.h @@ -34,15 +34,19 @@ #include <QtCore/qpointer.h> #include <QtGui/qwidget.h> - QT_BEGIN_NAMESPACE - class QTabWidget; class QSlider; class QGroupBox; class QLabel; class QSpinBox; class QPushButton; +QT_END_NAMESPACE + + +namespace Qml { +namespace Internal { + class CanvasFrameRatePlugin; @@ -57,6 +61,9 @@ public: void setSizeHint(const QSize &); virtual QSize sizeHint() const; +signals: + void contextHelpIdChanged(const QString &helpId); + private slots: void clearGraph(); void newTab(); @@ -74,7 +81,8 @@ private: QSize m_sizeHint; }; -QT_END_NAMESPACE +} // Internal +} // Qml #endif // CANVASFRAMERATE_H diff --git a/src/plugins/qmlinspector/components/expressionquerywidget.cpp b/src/plugins/qmlinspector/components/expressionquerywidget.cpp index 32cb1b25de..c57e914952 100644 --- a/src/plugins/qmlinspector/components/expressionquerywidget.cpp +++ b/src/plugins/qmlinspector/components/expressionquerywidget.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "expressionquerywidget.h" #include "qmlinspectorconstants.h" +#include "inspectorcontext.h" #include <utils/styledbar.h> #include <utils/filterlineedit.h> @@ -54,6 +55,10 @@ #include <QtCore/QDebug> +namespace Qml { +namespace Internal { + + ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug *client, QWidget *parent) : QWidget(parent), m_mode(mode), @@ -87,6 +92,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug m_clearButton->setToolTip(tr("Clear Output")); m_clearButton->setIcon(QIcon(Core::Constants::ICON_CLEAN_PANE)); connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearTextEditor())); + connect(m_lineEdit, SIGNAL(textChanged(QString)), SLOT(changeContextHelpId(QString))); connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression())); QHBoxLayout *hbox = new QHBoxLayout(bar); @@ -106,6 +112,11 @@ ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QDeclarativeEngineDebug clear(); } +void ExpressionQueryWidget::changeContextHelpId(const QString &) +{ + emit contextHelpIdChanged(InspectorContext::contextHelpIdForItem(m_lineEdit->text())); +} + void ExpressionQueryWidget::clearTextEditor() { m_textEdit->clear(); @@ -339,3 +350,6 @@ bool ExpressionQueryWidget::eventFilter(QObject *obj, QEvent *event) } return QWidget::eventFilter(obj, event); } + +} // Internal +} // Qml diff --git a/src/plugins/qmlinspector/components/expressionquerywidget.h b/src/plugins/qmlinspector/components/expressionquerywidget.h index cb1aaa44cb..50ec058b8e 100644 --- a/src/plugins/qmlinspector/components/expressionquerywidget.h +++ b/src/plugins/qmlinspector/components/expressionquerywidget.h @@ -33,7 +33,6 @@ #include <QtGui/qwidget.h> - QT_BEGIN_NAMESPACE class QGroupBox; @@ -55,6 +54,9 @@ namespace QmlJSEditor { class Highlighter; } +namespace Qml { +namespace Internal { + class ExpressionQueryWidget : public QWidget { Q_OBJECT @@ -70,6 +72,9 @@ public: void setEngineDebug(QDeclarativeEngineDebug *client); void clear(); +signals: + void contextHelpIdChanged(const QString &contextHelpId); + protected: bool eventFilter(QObject *obj, QEvent *event); @@ -81,6 +86,7 @@ private slots: void executeExpression(); void showResult(); void invokeCompletion(); + void changeContextHelpId(const QString &text); private: void setFontSettings(); @@ -108,5 +114,8 @@ private: QDeclarativeDebugObjectReference m_objectAtLastFocus; }; +} // Internal +} // Qml + #endif diff --git a/src/plugins/qmlinspector/components/objectpropertiesview.cpp b/src/plugins/qmlinspector/components/objectpropertiesview.cpp index 890e0c19fd..ace3432a82 100644 --- a/src/plugins/qmlinspector/components/objectpropertiesview.cpp +++ b/src/plugins/qmlinspector/components/objectpropertiesview.cpp @@ -27,12 +27,15 @@ ** **************************************************************************/ #include "objectpropertiesview.h" +#include "inspectorcontext.h" #include <QtCore/QDebug> #include <QtGui/QTreeWidget> #include <QtGui/QLayout> #include <QtGui/QHeaderView> +namespace Qml { +namespace Internal { class PropertiesViewItem : public QObject, public QTreeWidgetItem @@ -81,6 +84,7 @@ ObjectPropertiesView::ObjectPropertiesView(QDeclarativeEngineDebug *client, QWid << tr("Name") << tr("Value") << tr("Type")); QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(itemActivated(QTreeWidgetItem *))); + connect(m_tree, SIGNAL(itemSelectionChanged()), SLOT(changeItemSelection())); m_tree->setColumnCount(3); m_tree->header()->setDefaultSectionSize(150); @@ -88,6 +92,16 @@ ObjectPropertiesView::ObjectPropertiesView(QDeclarativeEngineDebug *client, QWid 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) { m_client = client; @@ -254,4 +268,7 @@ void ObjectPropertiesView::itemActivated(QTreeWidgetItem *i) emit activated(m_object, item->property); } +} +} + #include "objectpropertiesview.moc" diff --git a/src/plugins/qmlinspector/components/objectpropertiesview.h b/src/plugins/qmlinspector/components/objectpropertiesview.h index 9bf382ae53..8cd3a7decd 100644 --- a/src/plugins/qmlinspector/components/objectpropertiesview.h +++ b/src/plugins/qmlinspector/components/objectpropertiesview.h @@ -41,6 +41,9 @@ class QDeclarativeDebugConnection; QT_END_NAMESPACE +namespace Qml { +namespace Internal { + class PropertiesViewItem; class ObjectPropertiesView : public QWidget @@ -54,12 +57,14 @@ public: signals: void activated(const QDeclarativeDebugObjectReference &, const QDeclarativeDebugPropertyReference &); + void contextHelpIdChanged(const QString &contextHelpId); public slots: void reload(const QDeclarativeDebugObjectReference &); void watchCreated(QDeclarativeDebugWatch *); private slots: + void changeItemSelection(); void queryFinished(); void watchStateChanged(); void valueChanged(const QByteArray &name, const QVariant &value); @@ -78,7 +83,8 @@ private: QDeclarativeDebugObjectReference m_object; }; - +} // Internal +} // Qml #endif diff --git a/src/plugins/qmlinspector/components/objecttree.cpp b/src/plugins/qmlinspector/components/objecttree.cpp index c65da984b1..e4c187bbf6 100644 --- a/src/plugins/qmlinspector/components/objecttree.cpp +++ b/src/plugins/qmlinspector/components/objecttree.cpp @@ -37,8 +37,10 @@ #include <private/qdeclarativedebug_p.h> #include "objecttree.h" +#include "inspectorcontext.h" -//Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference) +namespace Qml { +namespace Internal { ObjectTree::ObjectTree(QDeclarativeEngineDebug *client, QWidget *parent) : QTreeWidget(parent), @@ -54,6 +56,7 @@ ObjectTree::ObjectTree(QDeclarativeEngineDebug *client, QWidget *parent) SLOT(currentItemChanged(QTreeWidgetItem *))); connect(this, SIGNAL(itemActivated(QTreeWidgetItem *, int)), SLOT(activated(QTreeWidgetItem *))); + connect(this, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged())); } void ObjectTree::setEngineDebug(QDeclarativeEngineDebug *client) @@ -61,6 +64,16 @@ void ObjectTree::setEngineDebug(QDeclarativeEngineDebug *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) { if (!m_client) @@ -87,6 +100,8 @@ void ObjectTree::setCurrentObject(int debugId) scrollToItem(item); item->setExpanded(true); } + + } void ObjectTree::objectFetched() @@ -218,3 +233,6 @@ void ObjectTree::mousePressEvent(QMouseEvent *me) } } } + +} +} diff --git a/src/plugins/qmlinspector/components/objecttree.h b/src/plugins/qmlinspector/components/objecttree.h index fed55390c6..8e800209f5 100644 --- a/src/plugins/qmlinspector/components/objecttree.h +++ b/src/plugins/qmlinspector/components/objecttree.h @@ -41,6 +41,11 @@ class QDeclarativeDebugObjectQuery; class QDeclarativeDebugContextReference; class QDeclarativeDebugConnection; +QT_END_NAMESPACE + +namespace Qml { +namespace Internal { + class ObjectTree : public QTreeWidget { @@ -54,6 +59,7 @@ signals: void currentObjectChanged(const QDeclarativeDebugObjectReference &); void activated(const QDeclarativeDebugObjectReference &); void expressionWatchRequested(const QDeclarativeDebugObjectReference &, const QString &); + void contextHelpIdChanged(const QString &contextHelpId); public slots: void reload(int objectDebugId); // set the root object @@ -66,6 +72,7 @@ private slots: void objectFetched(); void currentItemChanged(QTreeWidgetItem *); void activated(QTreeWidgetItem *); + void selectionChanged(); private: QTreeWidgetItem *findItemByObjectId(int debugId) const; @@ -78,7 +85,7 @@ private: QDeclarativeDebugObjectQuery *m_query; }; -QT_END_NAMESPACE - +} // Internal +} // Qml #endif diff --git a/src/plugins/qmlinspector/components/watchtable.cpp b/src/plugins/qmlinspector/components/watchtable.cpp index eb710d7552..4712f90199 100644 --- a/src/plugins/qmlinspector/components/watchtable.cpp +++ b/src/plugins/qmlinspector/components/watchtable.cpp @@ -36,7 +36,8 @@ #include <private/qdeclarativedebug_p.h> #include <private/qdeclarativemetatype_p.h> -QT_BEGIN_NAMESPACE +namespace Qml { +namespace Internal { const int C_NAME = 0; 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) { + Q_UNUSED(index); + Q_UNUSED(value); if (role == Qt::EditRole) { return true; } @@ -335,4 +338,6 @@ void WatchTableView::mousePressEvent(QMouseEvent *me) } } -QT_END_NAMESPACE + +} // Internal +} // Qml diff --git a/src/plugins/qmlinspector/components/watchtable.h b/src/plugins/qmlinspector/components/watchtable.h index f62bc11a9d..e38f89c3e9 100644 --- a/src/plugins/qmlinspector/components/watchtable.h +++ b/src/plugins/qmlinspector/components/watchtable.h @@ -45,6 +45,11 @@ class QDeclarativeDebugConnection; class QDeclarativeDebugPropertyReference; class QDeclarativeDebugObjectReference; +QT_END_NAMESPACE + +namespace Qml { +namespace Internal { + class WatchTableModel : public QAbstractTableModel { Q_OBJECT @@ -117,6 +122,7 @@ public: signals: void objectActivated(int objectDebugId); + void contextHelpIdChanged(const QString &contextHelpId); protected: void mousePressEvent(QMouseEvent *me); @@ -130,6 +136,7 @@ private: }; -QT_END_NAMESPACE +} // Internal +} // Qml #endif // WATCHTABLEMODEL_H |