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
Tobias Hunger
qt-creator
Commits
bcad75fb
Commit
bcad75fb
authored
Sep 16, 2009
by
mae
Browse files
auto complete quote and singlequotes
parent
254d2229
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/texteditor/basetexteditor.cpp
View file @
bcad75fb
...
...
@@ -1060,6 +1060,8 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
QTextCursor
cursor
=
textCursor
();
QString
text
=
e
->
text
();
QString
autoText
;
// TODO disable this inside string or character literals
if
(
d
->
m_autoParenthesesEnabled
&&
d
->
m_document
->
tabSettings
().
m_autoParentheses
)
{
foreach
(
QChar
c
,
text
)
{
QChar
close
;
...
...
@@ -1069,6 +1071,10 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
close
=
QLatin1Char
(
')'
);
else
if
(
c
==
QLatin1Char
(
'['
))
close
=
QLatin1Char
(
']'
);
else
if
(
c
==
QLatin1Char
(
'\"'
))
close
=
c
;
else
if
(
c
==
QLatin1Char
(
'\''
))
close
=
c
;
if
(
!
close
.
isNull
())
autoText
+=
close
;
}
...
...
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