1
0
Fork 0

JS comparison type safety warning fixes

This commit is contained in:
James Turner 2018-06-03 09:14:32 +01:00
parent e3fd7f7d61
commit 7e8b1b67e7
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ Item {
function anyAdvancedSettings(items) function anyAdvancedSettings(items)
{ {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].advanced == true) return true; if (items[i].advanced === true) return true;
} }
return false; return false;
@ -39,7 +39,7 @@ Item {
{ {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
var control = items[i]; var control = items[i];
if (control.advanced == true) { if (control.advanced === true) {
if (!control.__isDefault && !control.hidden) { if (!control.__isDefault && !control.hidden) {
//console.info("Non-default advanced setting:" + control.label + "," //console.info("Non-default advanced setting:" + control.label + ","
// + control.defaultValue + " != " + control.value) ; // + control.defaultValue + " != " + control.value) ;

View file

@ -26,7 +26,7 @@ Item {
return !hidden && (!advanced || parent.showAdvanced) return !hidden && (!advanced || parent.showAdvanced)
} }
readonly property bool __isDefault: (this.value == this.defaultValue); readonly property bool __isDefault: (this.value === this.defaultValue);
Component.onCompleted: { Component.onCompleted: {
restoreState(); restoreState();
@ -84,7 +84,7 @@ Item {
var defaultValue = ("defaultValue" in root) ? root.defaultValue : undefined; var defaultValue = ("defaultValue" in root) ? root.defaultValue : undefined;
var rawValue = _config.getValueForKey("", root.setting, defaultValue); var rawValue = _config.getValueForKey("", root.setting, defaultValue);
// console.warn("restoring state for " + root.setting + ", got raw value " + rawValue + " with type " + typeof(rawValue)) // console.warn("restoring state for " + root.setting + ", got raw value " + rawValue + " with type " + typeof(rawValue))
if (rawValue != undefined) { if (rawValue !== undefined) {
// root["value"] = rawValue // root["value"] = rawValue
this.value = rawValue this.value = rawValue
} }