Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
04f79bc9
Commit
04f79bc9
authored
Dec 05, 2008
by
con
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes: - Show <no symbols> in method combo box if there aren't any
Task: - 234321 RevBy: - Thorbjørn
parent
376e2983
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
src/plugins/cppeditor/cppeditor.cpp
src/plugins/cppeditor/cppeditor.cpp
+19
-5
src/plugins/cppeditor/cppeditor.h
src/plugins/cppeditor/cppeditor.h
+2
-0
No files found.
src/plugins/cppeditor/cppeditor.cpp
View file @
04f79bc9
...
...
@@ -79,6 +79,7 @@
#include <QtGui/QComboBox>
#include <QtGui/QTreeView>
#include <QtGui/QHeaderView>
#include <QtGui/QStringListModel>
using
namespace
CPlusPlus
;
using
namespace
CppEditor
::
Internal
;
...
...
@@ -202,7 +203,9 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
m_methodCombo
->
setMaxVisibleItems
(
20
);
m_overviewModel
=
new
OverviewModel
(
this
);
m_methodCombo
->
setModel
(
m_overviewModel
);
m_noSymbolsModel
=
new
QStringListModel
(
this
);
m_noSymbolsModel
->
setStringList
(
QStringList
()
<<
tr
(
"<no symbols>"
));
m_methodCombo
->
setModel
(
m_noSymbolsModel
);
connect
(
m_methodCombo
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
jumpToMethod
(
int
)));
connect
(
this
,
SIGNAL
(
cursorPositionChanged
()),
this
,
SLOT
(
updateMethodBoxIndex
()));
...
...
@@ -315,9 +318,16 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
return
;
m_overviewModel
->
rebuild
(
doc
);
OverviewTreeView
*
treeView
=
static_cast
<
OverviewTreeView
*>
(
m_methodCombo
->
view
());
treeView
->
sync
();
updateMethodBoxIndex
();
if
(
m_overviewModel
->
rowCount
()
>
0
)
{
if
(
m_methodCombo
->
model
()
!=
m_overviewModel
)
m_methodCombo
->
setModel
(
m_overviewModel
);
OverviewTreeView
*
treeView
=
static_cast
<
OverviewTreeView
*>
(
m_methodCombo
->
view
());
treeView
->
sync
();
updateMethodBoxIndex
();
}
else
{
if
(
m_methodCombo
->
model
()
!=
m_noSymbolsModel
)
m_methodCombo
->
setModel
(
m_noSymbolsModel
);
}
}
void
CPPEditor
::
updateFileName
()
...
...
@@ -325,6 +335,8 @@ void CPPEditor::updateFileName()
void
CPPEditor
::
jumpToMethod
(
int
)
{
if
(
m_methodCombo
->
model
()
!=
m_overviewModel
)
return
;
QModelIndex
index
=
m_methodCombo
->
view
()
->
currentIndex
();
Symbol
*
symbol
=
m_overviewModel
->
symbolFromIndex
(
index
);
if
(
!
symbol
)
...
...
@@ -339,12 +351,14 @@ void CPPEditor::jumpToMethod(int)
void
CPPEditor
::
updateMethodBoxIndex
()
{
if
(
m_methodCombo
->
model
()
!=
m_overviewModel
)
return
;
int
line
=
0
,
column
=
0
;
convertPosition
(
position
(),
&
line
,
&
column
);
QModelIndex
lastIndex
;
const
int
rc
=
m_overviewModel
->
rowCount
(
QModelIndex
()
);
const
int
rc
=
m_overviewModel
->
rowCount
();
for
(
int
row
=
0
;
row
<
rc
;
++
row
)
{
const
QModelIndex
index
=
m_overviewModel
->
index
(
row
,
0
,
QModelIndex
());
Symbol
*
symbol
=
m_overviewModel
->
symbolFromIndex
(
index
);
...
...
src/plugins/cppeditor/cppeditor.h
View file @
04f79bc9
...
...
@@ -42,6 +42,7 @@
QT_BEGIN_NAMESPACE
class
QAction
;
class
QComboBox
;
class
QStringListModel
;
QT_END_NAMESPACE
namespace
Core
{
...
...
@@ -138,6 +139,7 @@ private:
QList
<
int
>
m_contexts
;
QComboBox
*
m_methodCombo
;
CPlusPlus
::
OverviewModel
*
m_overviewModel
;
QStringListModel
*
m_noSymbolsModel
;
};
}
// namespace Internal
...
...
Write
Preview
Markdown
is supported
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