Revert "ProjectTree: Add per-node "Expand" and "Collapse" actions"

This reverts commit a5785e678e.
These actions are already available from the standard tree view UI...

Change-Id: If8dfe755ee450a89588ec944ae6ff7601250cdde
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-12-20 10:41:57 +01:00
parent a5785e678e
commit 20a5aa889f
5 changed files with 3 additions and 58 deletions

View File

@@ -511,8 +511,6 @@ public:
QAction *m_openFileAction;
QAction *m_projectTreeCollapseAllAction;
QAction *m_projectTreeExpandAllAction;
QAction *m_projectTreeCollapseNodeAction = nullptr;
QAction *m_projectTreeExpandNodeAction = nullptr;
Utils::ParameterAction *m_closeProjectFilesActionFileMenu;
Utils::ParameterAction *m_closeProjectFilesActionContextMenu;
QAction *m_searchOnFileSystem;
@@ -1352,26 +1350,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// Collapse & Expand.
const Id treeGroup = Constants::G_PROJECT_TREE;
dd->m_projectTreeCollapseNodeAction = new QAction(tr("Collapse"), this);
connect(dd->m_projectTreeCollapseNodeAction, &QAction::triggered,
ProjectTree::instance(), &ProjectTree::collapseCurrentNode);
Command * const collapseNodeCmd = ActionManager::registerAction(
dd->m_projectTreeCollapseNodeAction, "ProjectExplorer.CollapseNode",
projectTreeContext);
dd->m_projectTreeExpandNodeAction = new QAction(tr("Expand"), this);
connect(dd->m_projectTreeExpandNodeAction, &QAction::triggered,
ProjectTree::instance(), &ProjectTree::expandCurrentNode);
Command * const expandNodeCmd = ActionManager::registerAction(
dd->m_projectTreeExpandNodeAction, "ProjectExplorer.ExpandNode",
projectTreeContext);
for (Core::ActionContainer * const ac : {msubProjectContextMenu, mfolderContextMenu,
mprojectContextMenu}) {
ac->addSeparator(treeGroup);
ac->addAction(collapseNodeCmd, treeGroup);
ac->addAction(expandNodeCmd, treeGroup);
}
dd->m_projectTreeCollapseAllAction = new QAction(tr("Collapse All"), this);
Command * const collapseCmd = ActionManager::registerAction(
dd->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL,

View File

@@ -154,7 +154,7 @@ void ProjectTree::update()
ProjectTreeWidget *focus = m_focusForContextMenu;
static QPointer<ProjectTreeWidget> lastFocusedProjectTreeWidget;
if (!focus) {
focus = currentWidget();
focus = Utils::findOrDefault(m_projectTreeWidgets, &ProjectTree::hasFocus);
lastFocusedProjectTreeWidget = focus;
}
if (!focus)
@@ -284,27 +284,15 @@ void ProjectTree::sessionAndTreeChanged()
emit treeChanged();
}
void ProjectTree::collapseCurrentNode()
{
if (const auto w = currentWidget())
w->collapseCurrentNode();
}
void ProjectTree::expandCurrentNode()
{
if (const auto w = currentWidget())
w->expandCurrentNode();
}
void ProjectTree::collapseAll()
{
if (const auto w = currentWidget())
if (auto w = Utils::findOrDefault(s_instance->m_projectTreeWidgets, &ProjectTree::hasFocus))
w->collapseAll();
}
void ProjectTree::expandAll()
{
if (const auto w = currentWidget())
if (auto w = Utils::findOrDefault(s_instance->m_projectTreeWidgets, &ProjectTree::hasFocus))
w->expandAll();
}
@@ -356,11 +344,6 @@ bool ProjectTree::hasFocus(ProjectTreeWidget *widget)
|| s_instance->m_focusForContextMenu == widget);
}
ProjectTreeWidget *ProjectTree::currentWidget() const
{
return findOrDefault(m_projectTreeWidgets, &ProjectTree::hasFocus);
}
void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &globalPos, Node *node)
{
QMenu *contextMenu = nullptr;

View File

@@ -82,9 +82,6 @@ public:
static Project *projectForNode(const Node *node);
static Node *nodeForFile(const Utils::FilePath &fileName);
void collapseCurrentNode();
void expandCurrentNode();
void collapseAll();
void expandAll();
@@ -120,7 +117,6 @@ private:
void updateExternalFileWarning();
static bool hasFocus(Internal::ProjectTreeWidget *widget);
Internal::ProjectTreeWidget *currentWidget() const;
void hideContextMenu();
private:

View File

@@ -430,16 +430,6 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync)
syncFromDocumentManager();
}
void ProjectTreeWidget::collapseCurrentNode()
{
m_view->collapse(m_view->currentIndex());
}
void ProjectTreeWidget::expandCurrentNode()
{
m_view->expand(m_view->currentIndex());
}
void ProjectTreeWidget::collapseAll()
{
m_view->collapseAll();

View File

@@ -67,8 +67,6 @@ public:
void toggleAutoSynchronization();
void editCurrentItem();
void collapseCurrentNode();
void expandCurrentNode();
void collapseAll();
void expandAll();