QbsProjectManager: Fix "Build product" action for files in groups

Change-Id: Ia557d51654ee98d89f5c2c5e4df2a1b7d32afb66
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-03-13 14:15:33 +01:00
parent 852fad87df
commit 632d64fdc7

View File

@@ -322,10 +322,13 @@ void QbsProjectManagerPlugin::updateBuildActions()
fileName = editorNode->filePath().fileName();
ProjectNode *parentProjectNode = editorNode->parentProjectNode();
const QbsProductNode *productNode = nullptr;
for (const ProjectNode *potentialProductNode = parentProjectNode;
potentialProductNode && !productNode;
potentialProductNode = potentialProductNode->parentProjectNode()) {
productNode = dynamic_cast<const QbsProductNode *>(potentialProductNode);
}
// FIXME: This code is wrong: If the file is in a Group, then productNode will be
// null and the action will be disabled. We have to walk up the tree.
auto productNode = dynamic_cast<QbsProductNode *>(parentProjectNode);
if (productNode) {
productVisible = true;
productName = productNode->displayName();