aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2022-07-27 10:16:54 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2022-08-01 13:15:37 +0000
commitd6429210c89316069402f6309458a2e0e77c4113 (patch)
tree5a817376f2ae7e111e5bd62e1f9522c85a129dfe
parent5318de0f7f668719f5ac3954ac3e1b5134a1042b (diff)
Fix Qt module pop-up window not showing
After selecting <inherit from parent or project default> and applying the option, subsequent invocations of the method receive currentValue as null. The Linq code therefore throws an exception and the popup never appears. Change-Id: Ifb0e1c10ad20401cad3460169333f80b4ce89dd7 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--QtVsTools.Package/QtMsBuild/QtModulesEditor.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/QtVsTools.Package/QtMsBuild/QtModulesEditor.cs b/QtVsTools.Package/QtMsBuild/QtModulesEditor.cs
index 1d098c6d..83a0e329 100644
--- a/QtVsTools.Package/QtMsBuild/QtModulesEditor.cs
+++ b/QtVsTools.Package/QtMsBuild/QtModulesEditor.cs
@@ -29,6 +29,7 @@
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Properties;
using System;
+using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
@@ -68,24 +69,28 @@ namespace QtVsTools.QtMsBuild
})
.ToList();
- var allQT = modules.SelectMany(x => x.QT).ToHashSet();
- var selectedQT = currentValue.ToString().Split(';').ToHashSet();
- var extraQT = selectedQT.Except(allQT);
+ HashSet<string> selectedQt = null;
+ IEnumerable<string> extraQt = null;
+ if (currentValue != null) {
+ var allQt = modules.SelectMany(x => x.QT).ToHashSet();
+ selectedQt = currentValue.ToString().Split(';').ToHashSet();
+ extraQt = selectedQt.Except(allQt);
- foreach (var module in modules)
- module.IsSelected = module.QT.Intersect(selectedQT).Count() == module.QT.Count;
+ foreach (var module in modules)
+ module.IsSelected = module.QT.Intersect(selectedQt).Count() == module.QT.Count;
+ }
var popup = new QtModulesPopup();
popup.SetModules(modules.OrderBy(module => module.Name));
if (popup.ShowModal().GetValueOrDefault()) {
- selectedQT = modules
+ selectedQt = modules
.Where(x => x.IsSelected)
.SelectMany(x => x.QT)
- .Union(extraQT)
+ .Union(extraQt ?? Enumerable.Empty<string>())
.ToHashSet();
}
- return string.Join(";", selectedQT);
+ return selectedQt == null ? "" : string.Join(";", selectedQt);
}
}
}