Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
878bb9f9
Commit
878bb9f9
authored
Aug 16, 2010
by
Leandro Melo
Browse files
Make type hierarchy widget reusable accross editors.
parent
2d683cd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cpptypehierarchy.cpp
View file @
878bb9f9
...
...
@@ -168,6 +168,19 @@ CppTypeHierarchyWidget::~CppTypeHierarchyWidget()
delete
m_delegate
;
}
bool
CppTypeHierarchyWidget
::
handleReplacement
(
Core
::
IEditor
*
editor
)
{
if
(
CPPEditorEditable
*
cppEditable
=
qobject_cast
<
CPPEditorEditable
*>
(
editor
))
{
if
(
m_cppEditor
)
{
m_cppEditor
=
static_cast
<
CPPEditor
*>
(
cppEditable
->
widget
());
return
true
;
}
}
else
if
(
!
m_cppEditor
)
{
return
true
;
}
return
false
;
}
void
CppTypeHierarchyWidget
::
perform
()
{
if
(
!
m_cppEditor
)
...
...
@@ -228,11 +241,13 @@ CppTypeHierarchyStackedWidget::~CppTypeHierarchyStackedWidget()
void
CppTypeHierarchyStackedWidget
::
editorChanged
(
Core
::
IEditor
*
editor
)
{
CppTypeHierarchyWidget
*
replacement
=
new
CppTypeHierarchyWidget
(
editor
);
removeWidget
(
m_typeHiearchyWidgetInstance
);
m_typeHiearchyWidgetInstance
->
deleteLater
();
m_typeHiearchyWidgetInstance
=
replacement
;
addWidget
(
m_typeHiearchyWidgetInstance
);
if
(
!
m_typeHiearchyWidgetInstance
->
handleReplacement
(
editor
))
{
CppTypeHierarchyWidget
*
replacement
=
new
CppTypeHierarchyWidget
(
editor
);
removeWidget
(
m_typeHiearchyWidgetInstance
);
m_typeHiearchyWidgetInstance
->
deleteLater
();
m_typeHiearchyWidgetInstance
=
replacement
;
addWidget
(
m_typeHiearchyWidgetInstance
);
}
}
// CppTypeHierarchyFactory
...
...
src/plugins/cppeditor/cpptypehierarchy.h
View file @
878bb9f9
...
...
@@ -92,6 +92,8 @@ public:
CppTypeHierarchyWidget
(
Core
::
IEditor
*
editor
);
virtual
~
CppTypeHierarchyWidget
();
bool
handleReplacement
(
Core
::
IEditor
*
editor
);
public
slots
:
void
perform
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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