Skip to content
GitLab
Menu
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
9cf40745
Commit
9cf40745
authored
Dec 16, 2008
by
Thorbjørn Lindeijer
Browse files
Added option to disable completion of common prefix
Some people don't like this.
parent
e19c940d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/completionsettingspage.cpp
View file @
9cf40745
...
...
@@ -69,6 +69,7 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
m_page
->
caseSensitive
->
setChecked
(
m_completion
->
caseSensitivity
()
==
Qt
::
CaseSensitive
);
m_page
->
autoInsertBraces
->
setChecked
(
m_completion
->
autoInsertBraces
());
m_page
->
partiallyComplete
->
setChecked
(
m_completion
->
isPartialCompletionEnabled
());
return
w
;
}
...
...
@@ -79,6 +80,7 @@ void CompletionSettingsPage::finished(bool accepted)
m_completion
->
setCaseSensitivity
(
m_page
->
caseSensitive
->
isChecked
()
?
Qt
::
CaseSensitive
:
Qt
::
CaseInsensitive
);
m_completion
->
setAutoInsertBraces
(
m_page
->
autoInsertBraces
->
isChecked
());
m_completion
->
setPartialCompletionEnabled
(
m_page
->
partiallyComplete
->
isChecked
());
}
delete
m_page
;
...
...
src/plugins/cpptools/completionsettingspage.ui
View file @
9cf40745
...
...
@@ -17,7 +17,7 @@
<item>
<widget
class=
"QCheckBox"
name=
"caseSensitive"
>
<property
name=
"text"
>
<string>
Match completions
&
c
ase-sensitive
</string>
<string>
&
C
ase-sensitive
completion
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
...
...
@@ -34,6 +34,16 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"partiallyComplete"
>
<property
name=
"text"
>
<string>
Autocomplete common
&
prefix
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
9cf40745
...
...
@@ -346,6 +346,16 @@ void CppCodeCompletion::setAutoInsertBraces(bool autoInsertBraces)
m_autoInsertBraces
=
autoInsertBraces
;
}
bool
CppCodeCompletion
::
isPartialCompletionEnabled
()
const
{
return
m_partialCompletionEnabled
;
}
void
CppCodeCompletion
::
setPartialCompletionEnabled
(
bool
partialCompletionEnabled
)
{
m_partialCompletionEnabled
=
partialCompletionEnabled
;
}
/*
Searches beckward for an access operator.
*/
...
...
@@ -1030,7 +1040,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
}
else
if
(
completionItems
.
count
()
==
1
)
{
complete
(
completionItems
.
first
());
return
true
;
}
else
if
(
m_completionOperator
!=
T_LPAREN
)
{
}
else
if
(
m_partialCompletionEnabled
&&
m_completionOperator
!=
T_LPAREN
)
{
// Compute common prefix
QString
firstKey
=
completionItems
.
first
().
m_text
;
QString
lastKey
=
completionItems
.
last
().
m_text
;
...
...
src/plugins/cpptools/cppcodecompletion.h
View file @
9cf40745
...
...
@@ -84,6 +84,9 @@ public:
bool
autoInsertBraces
()
const
;
void
setAutoInsertBraces
(
bool
autoInsertBraces
);
bool
isPartialCompletionEnabled
()
const
;
void
setPartialCompletionEnabled
(
bool
partialCompletionEnabled
);
private:
void
addKeywords
();
void
addMacros
(
const
CPlusPlus
::
LookupContext
&
context
);
...
...
@@ -134,6 +137,7 @@ private:
CppModelManager
*
m_manager
;
Qt
::
CaseSensitivity
m_caseSensitivity
;
bool
m_autoInsertBraces
;
bool
m_partialCompletionEnabled
;
bool
m_forcedCompletion
;
...
...
src/plugins/cpptools/cpptoolsplugin.cpp
View file @
9cf40745
...
...
@@ -120,6 +120,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
const
bool
caseSensitive
=
settings
->
value
(
QLatin1String
(
"CaseSensitive"
),
true
).
toBool
();
m_completion
->
setCaseSensitivity
(
caseSensitive
?
Qt
::
CaseSensitive
:
Qt
::
CaseInsensitive
);
m_completion
->
setAutoInsertBraces
(
settings
->
value
(
QLatin1String
(
"AutoInsertBraces"
),
true
).
toBool
());
m_completion
->
setPartialCompletionEnabled
(
settings
->
value
(
QLatin1String
(
"PartiallyComplete"
),
true
).
toBool
());
settings
->
endGroup
();
settings
->
endGroup
();
...
...
@@ -138,6 +139,7 @@ void CppToolsPlugin::shutdown()
settings
->
beginGroup
(
QLatin1String
(
"Completion"
));
settings
->
setValue
(
QLatin1String
(
"CaseSensitive"
),
m_completion
->
caseSensitivity
()
==
Qt
::
CaseSensitive
);
settings
->
setValue
(
QLatin1String
(
"AutoInsertBraces"
),
m_completion
->
autoInsertBraces
());
settings
->
setValue
(
QLatin1String
(
"PartiallyComplete"
),
m_completion
->
isPartialCompletionEnabled
());
settings
->
endGroup
();
settings
->
endGroup
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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