forked from qt-creator/qt-creator
OutputPane: Modernize menu
Use lambdas instead of user data. Change-Id: I66585df8de2f1f3ea42f66c6f3b0df7d4d3f3f01 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -771,15 +771,7 @@ void OutputPaneManager::popupMenu()
|
|||||||
QAction *act = menu.addAction(data.pane->displayName());
|
QAction *act = menu.addAction(data.pane->displayName());
|
||||||
act->setCheckable(true);
|
act->setCheckable(true);
|
||||||
act->setChecked(data.button->isPaneVisible());
|
act->setChecked(data.button->isPaneVisible());
|
||||||
act->setData(idx);
|
connect(act, &QAction::triggered, this, [this, data, idx] {
|
||||||
++idx;
|
|
||||||
}
|
|
||||||
QAction *result = menu.exec(QCursor::pos());
|
|
||||||
if (!result)
|
|
||||||
return;
|
|
||||||
idx = result->data().toInt();
|
|
||||||
QTC_ASSERT(idx >= 0 && idx < g_outputPanes.size(), return);
|
|
||||||
OutputPaneData &data = g_outputPanes[idx];
|
|
||||||
if (data.button->isPaneVisible()) {
|
if (data.button->isPaneVisible()) {
|
||||||
data.pane->visibilityChanged(false);
|
data.pane->visibilityChanged(false);
|
||||||
data.button->setChecked(false);
|
data.button->setChecked(false);
|
||||||
@@ -787,6 +779,11 @@ void OutputPaneManager::popupMenu()
|
|||||||
} else {
|
} else {
|
||||||
showPage(idx, IOutputPane::ModeSwitch);
|
showPage(idx, IOutputPane::ModeSwitch);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
++idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPaneManager::saveSettings() const
|
void OutputPaneManager::saveSettings() const
|
||||||
|
|||||||
Reference in New Issue
Block a user