diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-11-25 10:09:21 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-11-27 14:42:12 +0000 |
commit | b2f5ed78e187fe57308549dde306563c7a9520e3 (patch) | |
tree | 6cd1f49420f2ed9d56fcc63bffa96c7430896021 /src/plugins/projectexplorer/projectwindow.cpp | |
parent | 2ca150c097eac0aa224d8f0f1a73124a2403d12f (diff) |
ClangTools: Add "go to project settings" toolbar button
With the introduction of the "Analyze Current File" action the widget to
configure the diagnostic config was moved to the project panel (Project
mode > Project Settings > Clang Tools).
As not too many users are aware of the project settings there and
navigating there involves more user interation now (mode switch, looking
for the "Clang Tools" item), add a toolbar button as a shortcut.
Change-Id: I4c864045ef41ff501d925d3175ce604def213f29
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projectwindow.cpp')
-rw-r--r-- | src/plugins/projectexplorer/projectwindow.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index dfa20793e3..d72f7812ff 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -84,6 +84,8 @@ public: Qt::ItemFlags flags(int column) const override; bool setData(int column, const QVariant &, int role) override; + ProjectPanelFactory *factory() const { return m_factory; } + protected: ProjectPanelFactory *m_factory = nullptr; QPointer<Project> m_project; @@ -281,6 +283,13 @@ public: return activeItem ? activeItem->index() : QModelIndex(); } + TreeItem *itemForProjectPanel(Core::Id panelId) + { + return m_miscItem->findChildAtLevel(1, [panelId](const TreeItem *item){ + return static_cast<const MiscSettingsPanelItem *>(item)->factory()->id() == panelId; + }); + } + private: int m_currentChildIndex = 0; // Start with Build & Run. Project *m_project = nullptr; @@ -497,6 +506,14 @@ public: item->setData(0, QVariant(), ItemActivatedDirectlyRole); } + void activateProjectPanel(Core::Id panelId) + { + if (ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0)) { + if (TreeItem *item = projectItem->itemForProjectPanel(panelId)) + itemActivated(item->index()); + } + } + void openContextMenu(const QPoint &pos) { QMenu menu; @@ -606,6 +623,11 @@ ProjectWindow::ProjectWindow() setContextMenuPolicy(Qt::CustomContextMenu); } +void ProjectWindow::activateProjectPanel(Core::Id panelId) +{ + d->activateProjectPanel(panelId); +} + ProjectWindow::~ProjectWindow() = default; QSize SelectorDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const |