forked from qt-creator/qt-creator
CMakePM: Add "Appy Kit/Initial Configuration Value" context menu entry
Now the "Initial Configuration" and "Current Configuration" displays in red the mismatches between kit / initial value and respectively initial and current configuration values. By having a "Apply Kit / Initial Configuration Value" context menu entry the user can resolve the mismatches if needed. Change-Id: I2e272821c3ba396cd8a6b7c81e1437cb3fd4bbad Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -895,6 +895,30 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
|
||||
if ((action = createForceAction(ConfigModel::DataItem::STRING, idx)))
|
||||
menu->addAction(action);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto applyKitOrInitialValue = new QAction(isInitialConfiguration()
|
||||
? tr("Apply Kit Value")
|
||||
: tr("Apply Initial Configuration Value"),
|
||||
this);
|
||||
menu->addAction(applyKitOrInitialValue);
|
||||
connect(applyKitOrInitialValue, &QAction::triggered, this, [this] {
|
||||
const QModelIndexList selectedIndexes = m_configView->selectionModel()->selectedIndexes();
|
||||
|
||||
const QModelIndexList validIndexes = Utils::filtered(selectedIndexes, [](const QModelIndex &index) {
|
||||
return index.isValid() && index.flags().testFlag(Qt::ItemIsSelectable);
|
||||
});
|
||||
|
||||
for (const QModelIndex &index : validIndexes) {
|
||||
if (isInitialConfiguration())
|
||||
m_configModel->applyKitValue(mapToSource(m_configView, index));
|
||||
else
|
||||
m_configModel->applyInitialValue(mapToSource(m_configView, index));
|
||||
}
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto copy = new QAction(tr("Copy"), this);
|
||||
menu->addAction(copy);
|
||||
connect(copy, &QAction::triggered, this, [this] {
|
||||
|
||||
Reference in New Issue
Block a user