forked from qt-creator/qt-creator
Add search functionality to type hierarchy pane
Change-Id: I76262610cdd3781b5d665e7de501cc8a7ba4012b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -34,14 +34,16 @@
|
|||||||
#include "cppelementevaluator.h"
|
#include "cppelementevaluator.h"
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
|
|
||||||
|
#include <coreplugin/find/treeviewfind.h>
|
||||||
#include <utils/navigationtreeview.h>
|
#include <utils/navigationtreeview.h>
|
||||||
#include <utils/annotateditemdelegate.h>
|
#include <utils/annotateditemdelegate.h>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QLatin1String>
|
#include <QLatin1String>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QVBoxLayout>
|
#include <QStackedLayout>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QLabel>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace CppEditor;
|
using namespace CppEditor;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
@@ -146,14 +148,19 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
|
|||||||
m_noTypeHierarchyAvailableLabel->setAutoFillBackground(true);
|
m_noTypeHierarchyAvailableLabel->setAutoFillBackground(true);
|
||||||
m_noTypeHierarchyAvailableLabel->setBackgroundRole(QPalette::Base);
|
m_noTypeHierarchyAvailableLabel->setBackgroundRole(QPalette::Base);
|
||||||
|
|
||||||
|
m_hierarchyWidget = new QWidget(this);
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
layout->addWidget(m_inspectedClass);
|
layout->addWidget(m_inspectedClass);
|
||||||
layout->addWidget(m_treeView);
|
layout->addWidget(Core::TreeViewFind::createSearchableWrapper(m_treeView));
|
||||||
layout->addWidget(m_noTypeHierarchyAvailableLabel);
|
m_hierarchyWidget->setLayout(layout);
|
||||||
|
|
||||||
setLayout(layout);
|
m_stackLayout = new QStackedLayout;
|
||||||
|
m_stackLayout->addWidget(m_hierarchyWidget);
|
||||||
|
m_stackLayout->addWidget(m_noTypeHierarchyAvailableLabel);
|
||||||
|
m_stackLayout->setCurrentWidget(m_noTypeHierarchyAvailableLabel);
|
||||||
|
setLayout(m_stackLayout);
|
||||||
|
|
||||||
connect(CppEditorPlugin::instance(), SIGNAL(typeHierarchyRequested()), SLOT(perform()));
|
connect(CppEditorPlugin::instance(), SIGNAL(typeHierarchyRequested()), SLOT(perform()));
|
||||||
}
|
}
|
||||||
@@ -211,16 +218,12 @@ void CppTypeHierarchyWidget::buildHierarchy(const CppClass &cppClass, QStandardI
|
|||||||
|
|
||||||
void CppTypeHierarchyWidget::showNoTypeHierarchyLabel()
|
void CppTypeHierarchyWidget::showNoTypeHierarchyLabel()
|
||||||
{
|
{
|
||||||
m_inspectedClass->hide();
|
m_stackLayout->setCurrentWidget(m_noTypeHierarchyAvailableLabel);
|
||||||
m_treeView->hide();
|
|
||||||
m_noTypeHierarchyAvailableLabel->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppTypeHierarchyWidget::showTypeHierarchy()
|
void CppTypeHierarchyWidget::showTypeHierarchy()
|
||||||
{
|
{
|
||||||
m_inspectedClass->show();
|
m_stackLayout->setCurrentWidget(m_hierarchyWidget);
|
||||||
m_treeView->show();
|
|
||||||
m_noTypeHierarchyAvailableLabel->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppTypeHierarchyWidget::clearTypeHierarchy()
|
void CppTypeHierarchyWidget::clearTypeHierarchy()
|
||||||
|
@@ -37,10 +37,11 @@
|
|||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QStandardItemModel;
|
|
||||||
class QStandardItem;
|
|
||||||
class QModelIndex;
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
class QModelIndex;
|
||||||
|
class QStackedLayout;
|
||||||
|
class QStandardItem;
|
||||||
|
class QStandardItemModel;
|
||||||
template <class> class QVector;
|
template <class> class QVector;
|
||||||
template <class> class QList;
|
template <class> class QList;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -82,6 +83,8 @@ private:
|
|||||||
|
|
||||||
CPPEditorWidget *m_cppEditor;
|
CPPEditorWidget *m_cppEditor;
|
||||||
Utils::NavigationTreeView *m_treeView;
|
Utils::NavigationTreeView *m_treeView;
|
||||||
|
QWidget *m_hierarchyWidget;
|
||||||
|
QStackedLayout *m_stackLayout;
|
||||||
QStandardItemModel *m_model;
|
QStandardItemModel *m_model;
|
||||||
Utils::AnnotatedItemDelegate *m_delegate;
|
Utils::AnnotatedItemDelegate *m_delegate;
|
||||||
CppClassLabel *m_inspectedClass;
|
CppClassLabel *m_inspectedClass;
|
||||||
|
Reference in New Issue
Block a user