diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-11-30 17:02:33 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-12-07 14:04:50 +0000 |
commit | c400923308f5c4df4e8d96a04d12dc54322f7ade (patch) | |
tree | 472da8291ca7f8bd697f77012b65fb4a7f74b64e /src/plugins/cppeditor/cpptypehierarchy.h | |
parent | f2dd45d8ce93c858b2bc4afccdbf61adadcdc64f (diff) |
Modernize Type Hierarchy
Don't freeze UI on request for show Type Hierarchy.
Move the lookup code into a separate thread.
Don't clear tree hierarchy when waiting for new one.
Show progress indicator on top of old hierarchy instead.
Add a task to ProgressManager when working on a new hierarchy.
Handle canceling the process of showing Type Hierarchy.
Implement simple progress reporting for this process.
Optimize a bit DerivedHierarchyVisitor.
Change-Id: I3894ac6ed3f4834831831f083f718f8385ca346f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cpptypehierarchy.h')
-rw-r--r-- | src/plugins/cppeditor/cpptypehierarchy.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cpptypehierarchy.h b/src/plugins/cppeditor/cpptypehierarchy.h index 836f4ba028..83b1a4d99f 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.h +++ b/src/plugins/cppeditor/cpptypehierarchy.h @@ -27,11 +27,14 @@ #include <coreplugin/inavigationwidgetfactory.h> +#include <QFuture> +#include <QFutureWatcher> #include <QList> -#include <QString> -#include <QWidget> +#include <QSharedPointer> #include <QStackedWidget> #include <QStandardItemModel> +#include <QString> +#include <QWidget> QT_BEGIN_NAMESPACE class QLabel; @@ -43,11 +46,12 @@ QT_END_NAMESPACE namespace TextEditor { class TextEditorLinkLabel; } namespace Utils { -class NavigationTreeView; class AnnotatedItemDelegate; +class NavigationTreeView; +class ProgressIndicator; } -namespace CppTools { class CppClass; } +namespace CppTools { class CppClass; class CppElement; } namespace CppEditor { namespace Internal { @@ -75,12 +79,17 @@ public: void perform(); +private slots: + void displayHierarchy(); + private: typedef QList<CppTools::CppClass> CppTools::CppClass::*HierarchyMember; void buildHierarchy(const CppTools::CppClass &cppClass, QStandardItem *parent, bool isRoot, HierarchyMember member); void showNoTypeHierarchyLabel(); void showTypeHierarchy(); + void showProgress(); + void hideProgress(); void clearTypeHierarchy(); void onItemActivated(const QModelIndex &index); @@ -91,7 +100,10 @@ private: QStandardItemModel *m_model = nullptr; Utils::AnnotatedItemDelegate *m_delegate = nullptr; TextEditor::TextEditorLinkLabel *m_inspectedClass = nullptr; - QLabel *m_noTypeHierarchyAvailableLabel = nullptr; + QLabel *m_infoLabel = nullptr; + QFuture<QSharedPointer<CppTools::CppElement>> m_future; + QFutureWatcher<QSharedPointer<CppTools::CppElement>> m_futureWatcher; + Utils::ProgressIndicator *m_progressIndicator = nullptr; }; class CppTypeHierarchyFactory : public Core::INavigationWidgetFactory |