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
cd9d13ac
Commit
cd9d13ac
authored
Feb 01, 2010
by
Roberto Raggi
Browse files
Simplified triggerCompletion().
parent
18e0777e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmljseditor/qmlcodecompletion.cpp
View file @
cd9d13ac
...
...
@@ -519,22 +519,26 @@ static bool isIdentifierChar(QChar ch)
bool
QmlCodeCompletion
::
triggersCompletion
(
TextEditor
::
ITextEditable
*
editor
)
{
const
QChar
ch
=
editor
->
characterAt
(
editor
->
position
()
-
1
);
const
int
cursorPosition
=
editor
->
position
();
const
QChar
ch
=
editor
->
characterAt
(
cursorPosition
-
1
);
if
(
ch
==
QLatin1Char
(
'('
)
||
ch
==
QLatin1Char
(
'.'
))
return
true
;
else
if
(
isIdentifierChar
(
ch
))
{
if
(
QmlJSTextEditor
*
ed
=
qobject_cast
<
QmlJSTextEditor
*>
(
editor
->
widget
()))
{
QTextCursor
tc
=
ed
->
textCursor
();
tc
.
movePosition
(
QTextCursor
::
StartOfWord
,
QTextCursor
::
KeepAnchor
);
const
QString
word
=
tc
.
selectedText
();
if
(
word
.
length
()
>
2
&&
checkStartOfIdentifier
(
word
))
{
for
(
int
i
=
0
;
i
<
word
.
length
();
++
i
)
{
if
(
!
isIdentifierChar
(
word
.
at
(
i
)))
return
false
;
}
return
true
;
int
pos
=
editor
->
position
()
-
1
;
for
(;
pos
!=
-
1
;
--
pos
)
{
if
(
!
isIdentifierChar
(
editor
->
characterAt
(
pos
)))
break
;
}
++
pos
;
const
QString
word
=
editor
->
textAt
(
pos
,
cursorPosition
-
pos
);
if
(
word
.
length
()
>
2
&&
checkStartOfIdentifier
(
word
))
{
for
(
int
i
=
0
;
i
<
word
.
length
();
++
i
)
{
if
(
!
isIdentifierChar
(
word
.
at
(
i
)))
return
false
;
}
return
true
;
}
}
...
...
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