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
34545eea
Commit
34545eea
authored
15 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Add the QML user types to the completion box.
parent
e20d5a82
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/qmljseditor/qmlcodecompletion.cpp
+40
-4
40 additions, 4 deletions
src/plugins/qmljseditor/qmlcodecompletion.cpp
with
40 additions
and
4 deletions
src/plugins/qmljseditor/qmlcodecompletion.cpp
+
40
−
4
View file @
34545eea
...
@@ -135,9 +135,33 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
...
@@ -135,9 +135,33 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
if
(
qmlDocument
.
isNull
())
if
(
qmlDocument
.
isNull
())
return
-
1
;
return
-
1
;
if
(
!
qmlDocument
->
qmlProgram
())
const
QmlJS
::
Snapshot
&
snapshot
=
m_modelManager
->
snapshot
();
qmlDocument
=
m_modelManager
->
snapshot
().
value
(
qmlDocument
->
fileName
());
if
(
!
qmlDocument
->
qmlProgram
())
{
qmlDocument
=
snapshot
.
value
(
qmlDocument
->
fileName
());
if
(
!
qmlDocument
)
return
-
1
;
}
const
QIcon
typeIcon
=
iconForColor
(
Qt
::
yellow
);
foreach
(
QmlJS
::
Document
::
Ptr
doc
,
snapshot
)
{
const
QFileInfo
fileInfo
(
doc
->
fileName
());
if
(
fileInfo
.
suffix
()
!=
QLatin1String
(
"qml"
))
continue
;
const
QString
typeName
=
fileInfo
.
baseName
();
if
(
typeName
.
isEmpty
())
continue
;
if
(
typeName
.
at
(
0
).
isUpper
())
{
TextEditor
::
CompletionItem
item
(
this
);
item
.
text
=
typeName
;
item
.
icon
=
typeIcon
;
m_completions
.
append
(
item
);
}
}
const
QIcon
idIcon
=
iconForColor
(
Qt
::
darkGray
);
const
QIcon
idIcon
=
iconForColor
(
Qt
::
darkGray
);
QStringList
ids
=
qmlDocument
->
ids
().
keys
();
QStringList
ids
=
qmlDocument
->
ids
().
keys
();
...
@@ -180,9 +204,21 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
...
@@ -180,9 +204,21 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
}
}
}
}
updateSnippets
();
QChar
previousChar
;
if
(
m_startPosition
>
0
)
previousChar
=
editor
->
characterAt
(
m_startPosition
-
1
);
if
(
previousChar
.
isNull
()
||
previousChar
.
isSpace
()
||
previousChar
==
QLatin1Char
(
'{'
)
||
previousChar
==
QLatin1Char
(
'}'
)
||
previousChar
==
QLatin1Char
(
':'
)
||
previousChar
==
QLatin1Char
(
';'
))
{
updateSnippets
();
m_completions
.
append
(
m_snippets
);
}
m_completions
.
append
(
m_snippets
);
return
pos
;
return
pos
;
}
}
...
...
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