mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 05:23:58 -06:00
Check if options are available before matching on them
This prevents a QML warning when the ListModel is created before the property provider is. This QML warning looked like this: 2020-03-20 15:04:30,012 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [406]: file:///home/trin/Gedeeld/Projects/Cura/cura/../resources/qml/MachineSettings/ComboBoxWithOptions.qml:74: TypeError: Cannot call method 'match' of undefined Done during Turbo Testing and Tooling.
This commit is contained in:
parent
5cfe71e516
commit
31aee866f4
2 changed files with 11 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2020 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -71,14 +71,17 @@ UM.TooltipArea
|
|||
{
|
||||
clear()
|
||||
// Options come in as a string-representation of an OrderedDict
|
||||
var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/)
|
||||
if (options)
|
||||
if(propertyProvider.properties.options)
|
||||
{
|
||||
options = options[1].split("), (")
|
||||
for (var i = 0; i < options.length; i++)
|
||||
var options = propertyProvider.properties.options.match(/^OrderedDict\(\[\((.*)\)\]\)$/);
|
||||
if(options)
|
||||
{
|
||||
var option = options[i].substring(1, options[i].length - 1).split("', '")
|
||||
append({ text: option[1], value: option[0] })
|
||||
options = options[1].split("), (");
|
||||
for(var i = 0; i < options.length; i++)
|
||||
{
|
||||
var option = options[i].substring(1, options[i].length - 1).split("', '");
|
||||
append({ text: option[1], value: option[0] });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2020 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue