Skip to content
GitLab
Menu
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
3a88a829
Commit
3a88a829
authored
Jul 22, 2010
by
Olivier Goffart
Browse files
QML JS Debugger: Ability to edit properties from the debugger
parent
f5249f06
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/qml/qmlengine.cpp
View file @
3a88a829
...
...
@@ -517,7 +517,19 @@ void QmlEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd
void
QmlEngine
::
assignValueInDebugger
(
const
QString
&
expression
,
const
QString
&
value
)
{
XSDEBUG
(
"ASSIGNING: "
<<
expression
+
'='
+
value
);
QRegExp
inObject
(
"@([0-9a-fA-F]+)->(.+)"
);
if
(
inObject
.
exactMatch
(
expression
))
{
bool
ok
=
false
;
quint64
objectId
=
inObject
.
cap
(
1
).
toULongLong
(
&
ok
,
16
);
QString
property
=
inObject
.
cap
(
2
);
if
(
ok
&&
objectId
>
0
&&
!
property
.
isEmpty
())
{
QByteArray
reply
;
QDataStream
rs
(
&
reply
,
QIODevice
::
WriteOnly
);
rs
<<
QByteArray
(
"SET_PROPERTY"
);
rs
<<
expression
.
toUtf8
()
<<
objectId
<<
property
<<
value
;
sendMessage
(
reply
);
}
}
}
void
QmlEngine
::
updateWatchData
(
const
WatchData
&
data
)
...
...
src/tools/qml/qmlobserver/jsdebuggeragent.cpp
View file @
3a88a829
...
...
@@ -121,6 +121,7 @@ static QList<JSAgentWatchData> expandObject(const QScriptValue &object)
{
QList
<
JSAgentWatchData
>
result
;
QScriptValueIterator
it
(
object
);
QByteArray
expPrefix
=
'@'
+
QByteArray
::
number
(
object
.
objectId
(),
16
)
+
"->"
;
while
(
it
.
hasNext
())
{
it
.
next
();
if
(
it
.
flags
()
&
QScriptValue
::
SkipInEnumeration
)
...
...
@@ -130,7 +131,9 @@ static QList<JSAgentWatchData> expandObject(const QScriptValue &object)
// and it is not usefull in the debugger.
continue
;
}
result
<<
JSAgentWatchData
::
fromScriptValue
(
it
.
name
(),
it
.
value
());
JSAgentWatchData
data
=
JSAgentWatchData
::
fromScriptValue
(
it
.
name
(),
it
.
value
());
data
.
exp
.
prepend
(
expPrefix
);
result
<<
data
;
}
return
result
;
}
...
...
@@ -368,6 +371,31 @@ void JSDebuggerAgent::messageReceived(const QByteArray& message)
QDataStream
rs
(
&
reply
,
QIODevice
::
WriteOnly
);
rs
<<
QByteArray
(
"LOCALS"
)
<<
frameId
<<
locals
;
sendMessage
(
reply
);
}
else
if
(
command
==
"SET_PROPERTY"
)
{
State
oldState
=
state
;
state
=
Stopped
;
QByteArray
id
;
qint64
objectId
;
QString
property
;
QString
value
;
ds
>>
id
>>
objectId
>>
property
>>
value
;
if
(
knownObjectIds
.
contains
(
objectId
))
{
QScriptValue
object
;
object
=
engine
()
->
objectById
(
objectId
);
if
(
object
.
isObject
())
{
QScriptValue
result
=
engine
()
->
evaluate
(
value
);
object
.
setProperty
(
property
,
result
);
}
// Clear any exceptions occurred during locals evaluation.
engine
()
->
clearExceptions
();
}
state
=
oldState
;
//TODO: feedback
}
else
{
qDebug
()
<<
Q_FUNC_INFO
<<
"Unknown command"
<<
command
;
}
...
...
@@ -414,6 +442,7 @@ void JSDebuggerAgent::stopped()
recordKnownObjects
(
watches
);
recordKnownObjects
(
locals
);
knownObjectIds
<<
activationObject
.
objectId
();
// Clear any exceptions occurred during locals evaluation.
engine
()
->
clearExceptions
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment