forked from qt-creator/qt-creator
QmlDesigner: Choose new target from filtered targets
Task-number: QDS-10137 Change-Id: Ic74262862996c73ab5119793b92575035d590f60 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -504,17 +504,33 @@ void ToolBarBackend::setCurrentStyle(int index)
|
|||||||
view->resetPuppet();
|
view->resetPuppet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::Kit *kitForDisplayName(const QString &displayName)
|
||||||
|
{
|
||||||
|
const auto kits = ProjectExplorer::KitManager::kits();
|
||||||
|
|
||||||
|
for (auto kit : kits) {
|
||||||
|
if (kit->displayName() == displayName)
|
||||||
|
return kit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
void ToolBarBackend::setCurrentKit(int index)
|
void ToolBarBackend::setCurrentKit(int index)
|
||||||
{
|
{
|
||||||
auto project = ProjectExplorer::ProjectManager::startupProject();
|
auto project = ProjectExplorer::ProjectManager::startupProject();
|
||||||
QTC_ASSERT(project, return );
|
QTC_ASSERT(project, return );
|
||||||
|
|
||||||
const auto kits = ProjectExplorer::KitManager::kits();
|
const auto kits = ToolBarBackend::kits();
|
||||||
|
|
||||||
QTC_ASSERT(kits.size() > index, return);
|
QTC_ASSERT(kits.size() > index, return );
|
||||||
QTC_ASSERT(index >= 0, return );
|
QTC_ASSERT(index >= 0, return );
|
||||||
|
|
||||||
const auto kit = kits.at(index);
|
const auto kitDisplayName = kits.at(index);
|
||||||
|
|
||||||
|
const auto kit = kitForDisplayName(kitDisplayName);
|
||||||
|
|
||||||
|
QTC_ASSERT(kit, return );
|
||||||
|
|
||||||
auto newTarget = project->target(kit);
|
auto newTarget = project->target(kit);
|
||||||
if (!newTarget)
|
if (!newTarget)
|
||||||
|
Reference in New Issue
Block a user