forked from qt-creator/qt-creator
ProjectTree: Do not register action more than once
Change-Id: I9d9c86694cd8066ba4be2a065805a3b52bc272ff Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -256,12 +256,14 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
|
|||||||
connect(m_filterGeneratedFilesAction, &QAction::toggled,
|
connect(m_filterGeneratedFilesAction, &QAction::toggled,
|
||||||
this, &ProjectTreeWidget::setGeneratedFilesFilter);
|
this, &ProjectTreeWidget::setGeneratedFilesFilter);
|
||||||
|
|
||||||
|
const char focusActionId[] = "ProjectExplorer.FocusDocumentInProjectTree";
|
||||||
|
if (!ActionManager::command(focusActionId)) {
|
||||||
auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this);
|
auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this);
|
||||||
Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree,
|
Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree, focusActionId);
|
||||||
"ProjectExplorer.FocusDocumentInProjectTree");
|
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+L")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+L")));
|
||||||
connect(focusDocumentInProjectTree, &QAction::triggered,
|
connect(focusDocumentInProjectTree, &QAction::triggered,
|
||||||
this, [this]() { syncFromDocumentManager(); });
|
this, [this]() { syncFromDocumentManager(); });
|
||||||
|
}
|
||||||
|
|
||||||
m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this);
|
m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this);
|
||||||
m_trimEmptyDirectoriesAction->setCheckable(true);
|
m_trimEmptyDirectoriesAction->setCheckable(true);
|
||||||
|
Reference in New Issue
Block a user