Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
0b010954
Commit
0b010954
authored
Mar 22, 2010
by
Lasse Holmstedt
Browse files
Help for qml inspector (with F1), namespace fixes
parent
ddf42148
Changes
15
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmlinspector/components/canvasframerate.cpp
View file @
0b010954
...
...
@@ -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"
src/plugins/qmlinspector/components/canvasframerate.h
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/expressionquerywidget.cpp
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/expressionquerywidget.h
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/objectpropertiesview.cpp
View file @
0b010954
...
...
@@ -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"
src/plugins/qmlinspector/components/objectpropertiesview.h
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/objecttree.cpp
View file @
0b010954
...
...
@@ -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)
}
}
}
}
}
src/plugins/qmlinspector/components/objecttree.h
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/watchtable.cpp
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/components/watchtable.h
View file @
0b010954
...
...
@@ -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
src/plugins/qmlinspector/inspectorcontext.cpp
View file @
0b010954
...
...
@@ -30,8 +30,15 @@
#include
"inspectorcontext.h"
#include
"qmlinspectorconstants.h"
#include
"components/objectpropertiesview.h"
#include
"components/objecttree.h"
#include
<coreplugin/icore.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<QWidget>
#include
<QDebug>
namespace
Qml
{
namespace
Internal
{
...
...
@@ -57,9 +64,26 @@ QWidget *InspectorContext::widget()
return
m_widget
;
}
void
InspectorContext
::
setContextHelpId
(
const
QString
&
helpId
)
{
m_contextHelpId
=
helpId
;
}
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
);
}
}
...
...
src/plugins/qmlinspector/inspectorcontext.h
View file @
0b010954
...
...
@@ -40,6 +40,8 @@ QT_END_NAMESPACE
namespace
Qml
{
namespace
Internal
{
class
ObjectPropertiesView
;
class
ObjectTree
;
class
DesignModeWidget
;
/**
...
...
@@ -47,6 +49,8 @@ class DesignModeWidget;
*/
class
InspectorContext
:
public
Core
::
IContext
{
Q_OBJECT
public:
InspectorContext
(
QWidget
*
widget
);
~
InspectorContext
();
...
...
@@ -56,12 +60,20 @@ public:
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:
QList
<
int
>
m_context
;
QWidget
*
m_widget
;
QString
m_contextHelpId
;
};
}
}
}
// Internal
}
// Qml
#endif // DESIGNMODECONTEXT_H
src/plugins/qmlinspector/qmlinspector.cpp
View file @
0b010954
...
...
@@ -88,6 +88,7 @@ using namespace Qml;
namespace
Qml
{
namespace
Internal
{
class
EngineSpinBox
:
public
QSpinBox
{
Q_OBJECT
...
...
@@ -111,8 +112,6 @@ private:
QList
<
EngineInfo
>
m_engines
;
};
}
EngineSpinBox
::
EngineSpinBox
(
QWidget
*
parent
)
:
QSpinBox
(
parent
)
{
...
...
@@ -157,6 +156,8 @@ int EngineSpinBox::valueFromText(const QString &text) const
return
-
1
;
}
}
// Internal
QmlInspector
::
QmlInspector
(
QObject
*
parent
)
:
QObject
(
parent
),
...
...
@@ -169,15 +170,13 @@ QmlInspector::QmlInspector(QObject *parent)
m_propertyWatcherDock
(
0
),
m_inspectorOutputDock
(
0
)
{
m_watchTableModel
=
new
WatchTableModel
(
0
,
this
);
m_objectTreeWidget
=
new
ObjectTree
;
m_propertiesWidget
=
new
ObjectPropertiesView
;
m_watchTableView
=
new
WatchTableView
(
m_watchTableModel
);
m_frameRateWidget
=
new
CanvasFrameRate
;
m_expressionWidget
=
new
ExpressionQueryWidget
(
ExpressionQueryWidget
::
SeparateEntryMode
);
m_context
=
new
Internal
::
InspectorContext
(
m_expressionWidget
);
m_expressionWidget
->
createCommands
(
m_context
);
m_watchTableModel
=
new
Internal
::
WatchTableModel
(
0
,
this
);
m_objectTreeWidget
=
new
Internal
::
ObjectTree
;
m_propertiesWidget
=
new
Internal
::
ObjectPropertiesView
;
m_watchTableView
=
new
Internal
::
WatchTableView
(
m_watchTableModel
);
m_frameRateWidget
=
new
Internal
::
CanvasFrameRate
;
m_expressionWidget
=
new
Internal
::
ExpressionQueryWidget
(
Internal
::
ExpressionQueryWidget
::
SeparateEntryMode
);
}
bool
QmlInspector
::
connectToViewer
()
...
...
@@ -300,7 +299,7 @@ void QmlInspector::connectionError()
void
QmlInspector
::
createDockWidgets
()
{
m_engineSpinBox
=
new
EngineSpinBox
;
m_engineSpinBox
=
new
Internal
::
EngineSpinBox
;
m_engineSpinBox
->
setEnabled
(
false
);
connect
(
m_engineSpinBox
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
queryEngineContext
(
int
)));
...
...
@@ -324,7 +323,7 @@ void QmlInspector::createDockWidgets()
treeWindowLayout
->
addWidget
(
m_objectTreeWidget
);
m_watchTableView
->
setModel
(
m_watchTableModel
);
WatchTableHeaderView
*
header
=
new
WatchTableHeaderView
(
m_watchTableModel
);
Internal
::
WatchTableHeaderView
*
header
=
new
Internal
::
WatchTableHeaderView
(
m_watchTableModel
);
m_watchTableView
->
setHorizontalHeader
(
header
);
connect
(
m_objectTreeWidget
,
SIGNAL
(
activated
(
QDeclarativeDebugObjectReference
)),
...
...
@@ -387,6 +386,23 @@ void QmlInspector::createDockWidgets()
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
()
...
...
@@ -507,4 +523,6 @@ void QmlInspector::treeObjectActivated(const QDeclarativeDebugObjectReference &o
}
}
}
// Qml
#include
"qmlinspector.moc"
src/plugins/qmlinspector/qmlinspector.h
View file @
0b010954
...
...
@@ -48,24 +48,26 @@ class QDeclarativeDebugConnection;
class
QDeclarativeDebugEnginesQuery
;
class
QDeclarativeDebugRootContextQuery
;
class
QDeclarativeDebugObjectReference
;
class
ObjectTree
;
class
WatchTableModel
;
class
WatchTableView
;
class
CanvasFrameRate
;
QT_END_NAMESPACE
class
ObjectPropertiesView
;
class
ExpressionQueryWidget
;
namespace
Core
{
class
IContext
;
}
namespace
Qml
{
class
EngineSpinBox
;
namespace
Internal
{
class
EngineSpinBox
;
class
InspectorContext
;
class
ObjectTree
;
class
ObjectPropertiesView
;
class
WatchTableModel
;
class
WatchTableView
;
class
CanvasFrameRate
;
class
ExpressionQueryWidget
;
class
EngineSpinBox
;
}
class
QMLINSPECTOR_EXPORT
QmlInspector
:
public
QObject
...
...
@@ -104,14 +106,14 @@ private:
QDeclarativeDebugEnginesQuery
*
m_engineQuery
;
QDeclarativeDebugRootContextQuery
*
m_contextQuery
;
ObjectTree
*
m_objectTreeWidget
;
ObjectPropertiesView
*
m_propertiesWidget
;
WatchTableModel
*
m_watchTableModel
;
WatchTableView
*
m_watchTableView
;
CanvasFrameRate
*
m_frameRateWidget
;
ExpressionQueryWidget
*
m_expressionWidget
;
Internal
::
ObjectTree
*
m_objectTreeWidget
;
Internal
::
ObjectPropertiesView
*
m_propertiesWidget
;
Internal
::
WatchTableModel
*
m_watchTableModel
;
Internal
::
WatchTableView
*
m_watchTableView
;
Internal
::
CanvasFrameRate
*
m_frameRateWidget
;
Internal
::
ExpressionQueryWidget
*
m_expressionWidget
;
EngineSpinBox
*
m_engineSpinBox
;
Internal
::
EngineSpinBox
*
m_engineSpinBox
;
QDockWidget
*
m_objectTreeDock
;
QDockWidget
*
m_frameRateDock
;
...
...
@@ -120,6 +122,7 @@ private:
QList
<
QDockWidget
*>
m_dockWidgets
;
Internal
::
InspectorContext
*
m_context
;
Internal
::
InspectorContext
*
m_propWatcherContext
;
};
...
...
src/plugins/qmlinspector/qmlinspectorplugin.cpp
View file @
0b010954