forked from qt-creator/qt-creator
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:
@@ -511,8 +511,6 @@ public:
|
|||||||
QAction *m_openFileAction;
|
QAction *m_openFileAction;
|
||||||
QAction *m_projectTreeCollapseAllAction;
|
QAction *m_projectTreeCollapseAllAction;
|
||||||
QAction *m_projectTreeExpandAllAction;
|
QAction *m_projectTreeExpandAllAction;
|
||||||
QAction *m_projectTreeCollapseNodeAction = nullptr;
|
|
||||||
QAction *m_projectTreeExpandNodeAction = nullptr;
|
|
||||||
Utils::ParameterAction *m_closeProjectFilesActionFileMenu;
|
Utils::ParameterAction *m_closeProjectFilesActionFileMenu;
|
||||||
Utils::ParameterAction *m_closeProjectFilesActionContextMenu;
|
Utils::ParameterAction *m_closeProjectFilesActionContextMenu;
|
||||||
QAction *m_searchOnFileSystem;
|
QAction *m_searchOnFileSystem;
|
||||||
@@ -1352,26 +1350,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
// Collapse & Expand.
|
// Collapse & Expand.
|
||||||
const Id treeGroup = Constants::G_PROJECT_TREE;
|
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);
|
dd->m_projectTreeCollapseAllAction = new QAction(tr("Collapse All"), this);
|
||||||
Command * const collapseCmd = ActionManager::registerAction(
|
Command * const collapseCmd = ActionManager::registerAction(
|
||||||
dd->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL,
|
dd->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL,
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void ProjectTree::update()
|
|||||||
ProjectTreeWidget *focus = m_focusForContextMenu;
|
ProjectTreeWidget *focus = m_focusForContextMenu;
|
||||||
static QPointer<ProjectTreeWidget> lastFocusedProjectTreeWidget;
|
static QPointer<ProjectTreeWidget> lastFocusedProjectTreeWidget;
|
||||||
if (!focus) {
|
if (!focus) {
|
||||||
focus = currentWidget();
|
focus = Utils::findOrDefault(m_projectTreeWidgets, &ProjectTree::hasFocus);
|
||||||
lastFocusedProjectTreeWidget = focus;
|
lastFocusedProjectTreeWidget = focus;
|
||||||
}
|
}
|
||||||
if (!focus)
|
if (!focus)
|
||||||
@@ -284,27 +284,15 @@ void ProjectTree::sessionAndTreeChanged()
|
|||||||
emit treeChanged();
|
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()
|
void ProjectTree::collapseAll()
|
||||||
{
|
{
|
||||||
if (const auto w = currentWidget())
|
if (auto w = Utils::findOrDefault(s_instance->m_projectTreeWidgets, &ProjectTree::hasFocus))
|
||||||
w->collapseAll();
|
w->collapseAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectTree::expandAll()
|
void ProjectTree::expandAll()
|
||||||
{
|
{
|
||||||
if (const auto w = currentWidget())
|
if (auto w = Utils::findOrDefault(s_instance->m_projectTreeWidgets, &ProjectTree::hasFocus))
|
||||||
w->expandAll();
|
w->expandAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,11 +344,6 @@ bool ProjectTree::hasFocus(ProjectTreeWidget *widget)
|
|||||||
|| s_instance->m_focusForContextMenu == 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)
|
void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &globalPos, Node *node)
|
||||||
{
|
{
|
||||||
QMenu *contextMenu = nullptr;
|
QMenu *contextMenu = nullptr;
|
||||||
|
|||||||
@@ -82,9 +82,6 @@ public:
|
|||||||
static Project *projectForNode(const Node *node);
|
static Project *projectForNode(const Node *node);
|
||||||
static Node *nodeForFile(const Utils::FilePath &fileName);
|
static Node *nodeForFile(const Utils::FilePath &fileName);
|
||||||
|
|
||||||
void collapseCurrentNode();
|
|
||||||
void expandCurrentNode();
|
|
||||||
|
|
||||||
void collapseAll();
|
void collapseAll();
|
||||||
void expandAll();
|
void expandAll();
|
||||||
|
|
||||||
@@ -120,7 +117,6 @@ private:
|
|||||||
|
|
||||||
void updateExternalFileWarning();
|
void updateExternalFileWarning();
|
||||||
static bool hasFocus(Internal::ProjectTreeWidget *widget);
|
static bool hasFocus(Internal::ProjectTreeWidget *widget);
|
||||||
Internal::ProjectTreeWidget *currentWidget() const;
|
|
||||||
void hideContextMenu();
|
void hideContextMenu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -430,16 +430,6 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync)
|
|||||||
syncFromDocumentManager();
|
syncFromDocumentManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectTreeWidget::collapseCurrentNode()
|
|
||||||
{
|
|
||||||
m_view->collapse(m_view->currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectTreeWidget::expandCurrentNode()
|
|
||||||
{
|
|
||||||
m_view->expand(m_view->currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectTreeWidget::collapseAll()
|
void ProjectTreeWidget::collapseAll()
|
||||||
{
|
{
|
||||||
m_view->collapseAll();
|
m_view->collapseAll();
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ public:
|
|||||||
|
|
||||||
void toggleAutoSynchronization();
|
void toggleAutoSynchronization();
|
||||||
void editCurrentItem();
|
void editCurrentItem();
|
||||||
void collapseCurrentNode();
|
|
||||||
void expandCurrentNode();
|
|
||||||
void collapseAll();
|
void collapseAll();
|
||||||
void expandAll();
|
void expandAll();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user