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,22 +771,19 @@ void OutputPaneManager::popupMenu()
|
||||
QAction *act = menu.addAction(data.pane->displayName());
|
||||
act->setCheckable(true);
|
||||
act->setChecked(data.button->isPaneVisible());
|
||||
act->setData(idx);
|
||||
connect(act, &QAction::triggered, this, [this, data, idx] {
|
||||
if (data.button->isPaneVisible()) {
|
||||
data.pane->visibilityChanged(false);
|
||||
data.button->setChecked(false);
|
||||
data.button->hide();
|
||||
} else {
|
||||
showPage(idx, IOutputPane::ModeSwitch);
|
||||
}
|
||||
});
|
||||
++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()) {
|
||||
data.pane->visibilityChanged(false);
|
||||
data.button->setChecked(false);
|
||||
data.button->hide();
|
||||
} else {
|
||||
showPage(idx, IOutputPane::ModeSwitch);
|
||||
}
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void OutputPaneManager::saveSettings() const
|
||||
|
||||
Reference in New Issue
Block a user