forked from qt-creator/qt-creator
ProjectExplorer: Remove redundant list from TaskWindow
Change-Id: Ic26bb27b7e53b15455cfe41a9c347aedb5e28305 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -131,7 +131,7 @@ private:
|
|||||||
class TaskWindowPrivate
|
class TaskWindowPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ITaskHandler *handler(const QAction *action)
|
ITaskHandler *handler(QAction *action)
|
||||||
{
|
{
|
||||||
ITaskHandler *handler = m_actionToHandlerMap.value(action, nullptr);
|
ITaskHandler *handler = m_actionToHandlerMap.value(action, nullptr);
|
||||||
return g_taskHandlers.contains(handler) ? handler : nullptr;
|
return g_taskHandlers.contains(handler) ? handler : nullptr;
|
||||||
@@ -141,13 +141,12 @@ public:
|
|||||||
Internal::TaskFilterModel *m_filter;
|
Internal::TaskFilterModel *m_filter;
|
||||||
TaskView m_treeView;
|
TaskView m_treeView;
|
||||||
const Core::Context m_taskWindowContext{Core::Context(Core::Constants::C_PROBLEM_PANE)};
|
const Core::Context m_taskWindowContext{Core::Context(Core::Constants::C_PROBLEM_PANE)};
|
||||||
QHash<const QAction *, ITaskHandler *> m_actionToHandlerMap;
|
QHash<QAction *, ITaskHandler *> m_actionToHandlerMap;
|
||||||
ITaskHandler *m_defaultHandler = nullptr;
|
ITaskHandler *m_defaultHandler = nullptr;
|
||||||
QToolButton *m_filterWarningsButton;
|
QToolButton *m_filterWarningsButton;
|
||||||
QToolButton *m_categoriesButton;
|
QToolButton *m_categoriesButton;
|
||||||
QToolButton *m_externalButton = nullptr;
|
QToolButton *m_externalButton = nullptr;
|
||||||
QMenu *m_categoriesMenu;
|
QMenu *m_categoriesMenu;
|
||||||
QList<QAction *> m_actions;
|
|
||||||
int m_visibleIssuesCount = 0;
|
int m_visibleIssuesCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -198,9 +197,10 @@ TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
|
|||||||
connect(d->m_treeView.selectionModel(), &QItemSelectionModel::selectionChanged,
|
connect(d->m_treeView.selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
this, [this] {
|
this, [this] {
|
||||||
const Tasks tasks = d->m_filter->tasks(d->m_treeView.selectionModel()->selectedIndexes());
|
const Tasks tasks = d->m_filter->tasks(d->m_treeView.selectionModel()->selectedIndexes());
|
||||||
for (QAction * const action : std::as_const(d->m_actions)) {
|
for (auto it = d->m_actionToHandlerMap.cbegin(); it != d->m_actionToHandlerMap.cend(); ++it) {
|
||||||
ITaskHandler * const h = d->handler(action);
|
ITaskHandler * const h = it.value();
|
||||||
action->setEnabled(h && h->canHandle(tasks));
|
QTC_ASSERT(g_taskHandlers.contains(h), continue);
|
||||||
|
it.key()->setEnabled(h && h->canHandle(tasks));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -291,7 +291,6 @@ void TaskWindow::delayedInitialization()
|
|||||||
if (h)
|
if (h)
|
||||||
h->handle(d->m_filter->tasks(d->m_treeView.selectionModel()->selectedIndexes()));
|
h->handle(d->m_filter->tasks(d->m_treeView.selectionModel()->selectedIndexes()));
|
||||||
});
|
});
|
||||||
d->m_actions << action;
|
|
||||||
|
|
||||||
Id id = h->actionManagerId();
|
Id id = h->actionManagerId();
|
||||||
if (id.isValid()) {
|
if (id.isValid()) {
|
||||||
|
Reference in New Issue
Block a user