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
ff2afcab
Commit
ff2afcab
authored
Mar 25, 2009
by
con
Browse files
Sort method combo box alphabetically.
Patch received by Kris Wong.
parent
5c9778e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
ff2afcab
...
...
@@ -75,6 +75,7 @@
#include <QtGui/QTextEdit>
#include <QtGui/QComboBox>
#include <QtGui/QTreeView>
#include <QtGui/QSortFilterProxyModel>
using
namespace
CPlusPlus
;
using
namespace
CppEditor
::
Internal
;
...
...
@@ -239,11 +240,17 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
QTreeView
*
methodView
=
new
OverviewTreeView
;
methodView
->
header
()
->
hide
();
methodView
->
setItemsExpandable
(
false
);
methodView
->
setSortingEnabled
(
true
);
methodView
->
sortByColumn
(
0
,
Qt
::
AscendingOrder
);
m_methodCombo
->
setView
(
methodView
);
m_methodCombo
->
setMaxVisibleItems
(
20
);
m_overviewModel
=
new
OverviewModel
(
this
);
m_methodCombo
->
setModel
(
m_overviewModel
);
m_proxyModel
=
new
QSortFilterProxyModel
(
this
);
m_proxyModel
->
setSourceModel
(
m_overviewModel
);
m_proxyModel
->
setDynamicSortFilter
(
true
);
m_proxyModel
->
setSortCaseSensitivity
(
Qt
::
CaseInsensitive
);
m_methodCombo
->
setModel
(
m_proxyModel
);
connect
(
m_methodCombo
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
jumpToMethod
(
int
)));
connect
(
this
,
SIGNAL
(
cursorPositionChanged
()),
this
,
SLOT
(
updateMethodBoxIndex
()));
...
...
@@ -366,7 +373,7 @@ void CPPEditor::updateFileName()
void
CPPEditor
::
jumpToMethod
(
int
)
{
QModelIndex
index
=
m_methodCombo
->
view
()
->
currentIndex
();
QModelIndex
index
=
m_proxyModel
->
mapToSource
(
m_methodCombo
->
view
()
->
currentIndex
()
)
;
Symbol
*
symbol
=
m_overviewModel
->
symbolFromIndex
(
index
);
if
(
!
symbol
)
return
;
...
...
@@ -394,7 +401,7 @@ void CPPEditor::updateMethodBoxIndex()
if
(
lastIndex
.
isValid
())
{
bool
blocked
=
m_methodCombo
->
blockSignals
(
true
);
m_methodCombo
->
setCurrentIndex
(
lastIndex
.
row
());
m_methodCombo
->
setCurrentIndex
(
m_proxyModel
->
mapFromSource
(
lastIndex
)
.
row
());
updateMethodBoxToolTip
();
(
void
)
m_methodCombo
->
blockSignals
(
blocked
);
}
...
...
src/plugins/cppeditor/cppeditor.h
View file @
ff2afcab
...
...
@@ -37,6 +37,7 @@
QT_BEGIN_NAMESPACE
class
QComboBox
;
class
QSortFilterProxyModel
;
QT_END_NAMESPACE
namespace
CPlusPlus
{
...
...
@@ -161,6 +162,7 @@ private:
QList
<
int
>
m_contexts
;
QComboBox
*
m_methodCombo
;
CPlusPlus
::
OverviewModel
*
m_overviewModel
;
QSortFilterProxyModel
*
m_proxyModel
;
};
}
// namespace Internal
...
...
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