Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
d95dd54f
Commit
d95dd54f
authored
16 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Some work on the QML overview.
parent
b958bbee
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/duieditor/duieditor.cpp
+105
-3
105 additions, 3 deletions
src/plugins/duieditor/duieditor.cpp
with
105 additions
and
3 deletions
src/plugins/duieditor/duieditor.cpp
+
105
−
3
View file @
d95dd54f
...
...
@@ -68,21 +68,120 @@ namespace Internal {
class
FindDeclarations
:
protected
Visitor
{
QList
<
Declaration
>
declarations
;
QList
<
Declaration
>
_declarations
;
int
_depth
;
public:
QList
<
Declaration
>
operator
()(
AST
::
Node
*
node
)
{
declarations
.
clear
();
_depth
=
-
1
;
_declarations
.
clear
();
accept
(
node
);
return
declarations
;
return
_
declarations
;
}
protected
:
using
Visitor
::
visit
;
using
Visitor
::
endVisit
;
QString
asString
(
AST
::
UiQualifiedId
*
id
)
{
QString
text
;
for
(;
id
;
id
=
id
->
next
)
{
if
(
id
->
name
)
text
+=
id
->
name
->
asString
();
else
text
+=
QLatin1Char
(
'?'
);
if
(
id
->
next
)
text
+=
QLatin1Char
(
'.'
);
}
return
text
;
}
void
accept
(
AST
::
Node
*
node
)
{
AST
::
Node
::
acceptChild
(
node
,
this
);
}
void
init
(
Declaration
*
decl
,
AST
::
UiObjectMember
*
member
)
{
const
SourceLocation
first
=
member
->
firstSourceLocation
();
const
SourceLocation
last
=
member
->
lastSourceLocation
();
decl
->
startLine
=
first
.
startLine
;
decl
->
startColumn
=
first
.
startColumn
;
decl
->
endLine
=
last
.
startLine
;
decl
->
endColumn
=
last
.
startColumn
+
last
.
length
;
}
virtual
bool
visit
(
AST
::
UiObjectDefinition
*
node
)
{
++
_depth
;
Declaration
decl
;
init
(
&
decl
,
node
);
decl
.
text
.
fill
(
QLatin1Char
(
' '
),
_depth
);
if
(
node
->
name
)
decl
.
text
.
append
(
node
->
name
->
asString
());
else
decl
.
text
.
append
(
QLatin1Char
(
'?'
));
_declarations
.
append
(
decl
);
return
true
;
// search for more bindings
}
virtual
void
endVisit
(
AST
::
UiObjectDefinition
*
)
{
--
_depth
;
}
virtual
bool
visit
(
AST
::
UiObjectBinding
*
node
)
{
++
_depth
;
Declaration
decl
;
init
(
&
decl
,
node
);
decl
.
text
.
fill
(
QLatin1Char
(
' '
),
_depth
);
decl
.
text
.
append
(
asString
(
node
->
qualifiedId
));
decl
.
text
.
append
(
QLatin1String
(
": "
));
if
(
node
->
name
)
decl
.
text
.
append
(
node
->
name
->
asString
());
else
decl
.
text
.
append
(
QLatin1Char
(
'?'
));
_declarations
.
append
(
decl
);
return
true
;
// search for more bindings
}
virtual
void
endVisit
(
AST
::
UiObjectBinding
*
)
{
--
_depth
;
}
virtual
bool
visit
(
AST
::
UiScriptBinding
*
node
)
{
++
_depth
;
Declaration
decl
;
init
(
&
decl
,
node
);
decl
.
text
.
fill
(
QLatin1Char
(
' '
),
_depth
);
decl
.
text
.
append
(
asString
(
node
->
qualifiedId
));
_declarations
.
append
(
decl
);
return
false
;
// more more bindings in this subtree.
}
virtual
void
endVisit
(
AST
::
UiScriptBinding
*
)
{
--
_depth
;
}
};
class
HighlightBindings
:
protected
Visitor
...
...
@@ -244,6 +343,9 @@ void ScriptEditor::updateDocumentNow()
setExtraSelections
(
CodeSemanticsSelection
,
highlightIds
(
parser
.
ast
()));
}
FindDeclarations
findDeclarations
;
m_declarations
=
findDeclarations
(
parser
.
ast
());
m_words
.
clear
();
foreach
(
const
JavaScriptNameIdImpl
&
id
,
driver
.
literals
())
m_words
.
append
(
id
.
asString
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment