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
088bdb29
Commit
088bdb29
authored
May 19, 2010
by
Christian Kamm
Browse files
QmlJS: Provide good completion for PropertyChanges with a target again.
Task-number: QTCREATORBUG-1413 Reviewed-by: Erik Verbruggen
parent
735f9083
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsscopebuilder.cpp
View file @
088bdb29
...
...
@@ -106,14 +106,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
// check if the object has a Qt.PropertyChanges ancestor
prototype
=
scopeObject
->
prototype
(
_context
);
while
(
prototype
)
{
if
(
const
QmlObjectValue
*
qmlMetaObject
=
dynamic_cast
<
const
QmlObjectValue
*>
(
prototype
))
{
if
(
qmlMetaObject
->
className
()
==
QLatin1String
(
"PropertyChanges"
)
&&
qmlMetaObject
->
packageName
()
==
QLatin1String
(
"Qt"
))
break
;
}
prototype
=
prototype
->
prototype
(
_context
);
}
prototype
=
isPropertyChangesObject
(
_context
,
prototype
);
// find the target script binding
if
(
prototype
)
{
UiObjectInitializer
*
initializer
=
0
;
...
...
@@ -169,3 +162,19 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id)
return
result
;
}
const
ObjectValue
*
ScopeBuilder
::
isPropertyChangesObject
(
Context
*
context
,
const
ObjectValue
*
object
)
{
const
ObjectValue
*
prototype
=
object
;
while
(
prototype
)
{
if
(
const
QmlObjectValue
*
qmlMetaObject
=
dynamic_cast
<
const
QmlObjectValue
*>
(
prototype
))
{
if
(
qmlMetaObject
->
className
()
==
QLatin1String
(
"PropertyChanges"
)
&&
qmlMetaObject
->
packageName
()
==
QLatin1String
(
"Qt"
))
return
prototype
;
}
prototype
=
prototype
->
prototype
(
context
);
}
return
0
;
}
src/libs/qmljs/qmljsscopebuilder.h
View file @
088bdb29
...
...
@@ -14,6 +14,7 @@ namespace AST {
namespace
Interpreter
{
class
Context
;
class
Value
;
class
ObjectValue
;
}
class
QMLJS_EXPORT
ScopeBuilder
...
...
@@ -26,6 +27,8 @@ public:
void
push
(
const
QList
<
AST
::
Node
*>
&
nodes
);
void
pop
();
static
const
Interpreter
::
ObjectValue
*
isPropertyChangesObject
(
Interpreter
::
Context
*
context
,
const
Interpreter
::
ObjectValue
*
object
);
private:
void
setQmlScopeObject
(
AST
::
Node
*
node
);
const
Interpreter
::
Value
*
scopeObjectLookup
(
AST
::
UiQualifiedId
*
id
);
...
...
src/plugins/qmljseditor/qmljscodecompletion.cpp
View file @
088bdb29
...
...
@@ -38,6 +38,7 @@
#include
<qmljs/qmljsscanner.h>
#include
<qmljs/qmljsevaluate.h>
#include
<qmljs/qmljscompletioncontextfinder.h>
#include
<qmljs/qmljsscopebuilder.h>
#include
<texteditor/basetexteditor.h>
...
...
@@ -687,6 +688,11 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
addCompletions
(
enumerateProperties
(
qmlScopeType
),
symbolIcon
);
addCompletions
(
enumerateProperties
(
context
.
scopeChain
().
qmlTypes
),
symbolIcon
);
if
(
ScopeBuilder
::
isPropertyChangesObject
(
&
context
,
qmlScopeType
)
&&
context
.
scopeChain
().
qmlScopeObjects
.
size
()
==
2
)
{
addCompletions
(
enumerateProperties
(
context
.
scopeChain
().
qmlScopeObjects
.
first
()),
symbolIcon
);
}
}
if
(
contextFinder
.
isInRhsOfBinding
()
&&
qmlScopeType
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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