forked from qt-creator/qt-creator
Don't call CppTypeHierarchyWidget::perform() twice
In case a Type Hierarchy widget isn't visible, the CppIncludeHierarchyWidget::perform() is called twice when requested from "Open Type Hierarchy" context menu. The instances of CppIncludeHierarchyWidget class are created only when Type Hierarchy item is selected form the combobox, and are destroyed when different item is selected. A call to: NavigationWidget::activateSubWidget(Constants::TYPE_HIERARCHY_ID, Side::Left) may be ignored (in case Type Hierarchy widget was visible) or may recreate the widget and invoke CppTypeHierarchyWidget::perform() for the first time (in case when Type Hierarchy wasn't visible). Just after this we emit typeHierarchyRequested(), which in turn invokes perform() one more time unconditionally. In order to fix it, we emit the signal typeHierarchyRequested() first (which will invoke perform() only when the Type Hierarchy widget was visible), and later call activateSubWidget(), which invoke perform only when we are recreating a widget. This shorten the freeze time for calculating big hierarchies, like for ExtensionSystem::IPlugin, by 50%. We do the same for CppIncludeHierarchyWidget. Change-Id: If58fba4ba1dc32999d106fc2faa712e05442caf3 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -386,16 +386,16 @@ QVector<QObject *> CppEditorPlugin::createTestObjects() const
|
|||||||
void CppEditorPlugin::openTypeHierarchy()
|
void CppEditorPlugin::openTypeHierarchy()
|
||||||
{
|
{
|
||||||
if (currentCppEditorWidget()) {
|
if (currentCppEditorWidget()) {
|
||||||
NavigationWidget::activateSubWidget(Constants::TYPE_HIERARCHY_ID, Side::Left);
|
|
||||||
emit typeHierarchyRequested();
|
emit typeHierarchyRequested();
|
||||||
|
NavigationWidget::activateSubWidget(Constants::TYPE_HIERARCHY_ID, Side::Left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppEditorPlugin::openIncludeHierarchy()
|
void CppEditorPlugin::openIncludeHierarchy()
|
||||||
{
|
{
|
||||||
if (currentCppEditorWidget()) {
|
if (currentCppEditorWidget()) {
|
||||||
NavigationWidget::activateSubWidget(Constants::INCLUDE_HIERARCHY_ID, Side::Left);
|
|
||||||
emit includeHierarchyRequested();
|
emit includeHierarchyRequested();
|
||||||
|
NavigationWidget::activateSubWidget(Constants::INCLUDE_HIERARCHY_ID, Side::Left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user