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
783aad2a
Commit
783aad2a
authored
Jul 13, 2010
by
Kai Koehne
Browse files
CppEditor: Delay update of outline by 150 ms
parent
8d48c511
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
783aad2a
...
...
@@ -97,7 +97,7 @@
#include <sstream>
enum
{
UPDATE_
METHOD_BOX
_INTERVAL
=
150
,
UPDATE_
OUTLINE
_INTERVAL
=
150
,
UPDATE_USES_INTERVAL
=
300
};
...
...
@@ -695,9 +695,14 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
connect
(
m_sortAction
,
SIGNAL
(
toggled
(
bool
)),
CppPlugin
::
instance
(),
SLOT
(
setSortedMethodOverview
(
bool
)));
m_methodCombo
->
addAction
(
m_sortAction
);
m_updateOutlineTimer
=
new
QTimer
(
this
);
m_updateOutlineTimer
->
setSingleShot
(
true
);
m_updateOutlineTimer
->
setInterval
(
UPDATE_OUTLINE_INTERVAL
);
connect
(
m_updateOutlineTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateOutlineNow
()));
m_updateMethodBoxTimer
=
new
QTimer
(
this
);
m_updateMethodBoxTimer
->
setSingleShot
(
true
);
m_updateMethodBoxTimer
->
setInterval
(
UPDATE_
METHOD_BOX
_INTERVAL
);
m_updateMethodBoxTimer
->
setInterval
(
UPDATE_
OUTLINE
_INTERVAL
);
connect
(
m_updateMethodBoxTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateMethodBoxIndexNow
()));
m_updateUsesTimer
=
new
QTimer
(
this
);
...
...
@@ -831,11 +836,7 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
m_semanticHighlighter
->
rehighlight
(
source
);
}
m_overviewModel
->
rebuild
(
doc
);
OverviewTreeView
*
treeView
=
static_cast
<
OverviewTreeView
*>
(
m_methodCombo
->
view
());
treeView
->
sync
();
updateMethodBoxIndexNow
();
m_updateOutlineTimer
->
start
();
}
const
Macro
*
CPPEditor
::
findCanonicalMacro
(
const
QTextCursor
&
cursor
,
Document
::
Ptr
doc
)
const
...
...
@@ -1040,6 +1041,26 @@ bool CPPEditor::sortedMethodOverview() const
return
(
m_proxyModel
->
sortColumn
()
==
0
);
}
void
CPPEditor
::
updateOutlineNow
()
{
const
Snapshot
snapshot
=
m_modelManager
->
snapshot
();
Document
::
Ptr
document
=
snapshot
.
document
(
file
()
->
fileName
());
if
(
!
document
)
return
;
if
(
document
->
editorRevision
()
!=
editorRevision
())
{
m_updateOutlineTimer
->
start
();
return
;
}
m_overviewModel
->
rebuild
(
document
);
OverviewTreeView
*
treeView
=
static_cast
<
OverviewTreeView
*>
(
m_methodCombo
->
view
());
treeView
->
sync
();
updateMethodBoxIndexNow
();
}
void
CPPEditor
::
updateMethodBoxIndex
()
{
m_updateMethodBoxTimer
->
start
();
...
...
@@ -1083,7 +1104,7 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
void
CPPEditor
::
updateMethodBoxIndexNow
()
{
if
(
!
m_overviewModel
->
document
())
if
(
!
m_overviewModel
->
document
())
return
;
if
(
m_overviewModel
->
document
()
->
editorRevision
()
!=
editorRevision
())
{
...
...
src/plugins/cppeditor/cppeditor.h
View file @
783aad2a
...
...
@@ -222,6 +222,7 @@ protected:
private
Q_SLOTS
:
void
updateFileName
();
void
jumpToMethod
(
int
index
);
void
updateOutlineNow
();
void
updateMethodBoxIndex
();
void
updateMethodBoxIndexNow
();
void
updateMethodBoxToolTip
();
...
...
@@ -276,6 +277,7 @@ private:
QModelIndex
m_overviewModelIndex
;
QSortFilterProxyModel
*
m_proxyModel
;
QAction
*
m_sortAction
;
QTimer
*
m_updateOutlineTimer
;
QTimer
*
m_updateMethodBoxTimer
;
QTimer
*
m_updateUsesTimer
;
QTextCharFormat
m_occurrencesFormat
;
...
...
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