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
a01c9c96
Commit
a01c9c96
authored
Mar 31, 2009
by
hjk
Browse files
cpptool: sort entry that start with a given string towards the top of
the quickopenfilter Reviewed-by: Roberto Raggi
parent
e7d2c4dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppquickopenfilter.cpp
View file @
a01c9c96
...
...
@@ -80,11 +80,12 @@ static bool compareLexigraphically(const QuickOpen::FilterEntry &a,
QList
<
QuickOpen
::
FilterEntry
>
CppQuickOpenFilter
::
matchesFor
(
const
QString
&
origEntry
)
{
QString
entry
=
trimWildcards
(
origEntry
);
QList
<
QuickOpen
::
FilterEntry
>
entries
;
QList
<
QuickOpen
::
FilterEntry
>
goodEntries
;
QList
<
QuickOpen
::
FilterEntry
>
betterEntries
;
QStringMatcher
matcher
(
entry
,
Qt
::
CaseInsensitive
);
const
QRegExp
regexp
(
"*"
+
entry
+
"*"
,
Qt
::
CaseInsensitive
,
QRegExp
::
Wildcard
);
if
(
!
regexp
.
isValid
())
return
e
ntries
;
return
goodE
ntries
;
bool
hasWildcard
=
(
entry
.
contains
(
'*'
)
||
entry
.
contains
(
'?'
));
QMutableMapIterator
<
QString
,
Info
>
it
(
m_searchList
);
...
...
@@ -106,15 +107,21 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
QVariant
id
=
qVariantFromValue
(
info
);
QuickOpen
::
FilterEntry
filterEntry
(
this
,
info
.
symbolName
,
id
,
info
.
icon
);
filterEntry
.
extraInfo
=
info
.
symbolType
;
entries
.
append
(
filterEntry
);
if
(
info
.
symbolName
.
startsWith
(
entry
))
betterEntries
.
append
(
filterEntry
);
else
goodEntries
.
append
(
filterEntry
);
}
}
}
if
(
entries
.
size
()
<
1000
)
qSort
(
entries
.
begin
(),
entries
.
end
(),
compareLexigraphically
);
if
(
goodEntries
.
size
()
<
1000
)
qSort
(
goodEntries
.
begin
(),
goodEntries
.
end
(),
compareLexigraphically
);
if
(
betterEntries
.
size
()
<
1000
)
qSort
(
betterEntries
.
begin
(),
betterEntries
.
end
(),
compareLexigraphically
);
return
entries
;
betterEntries
+=
goodEntries
;
return
betterEntries
;
}
void
CppQuickOpenFilter
::
accept
(
QuickOpen
::
FilterEntry
selection
)
const
...
...
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