0
Qt的抱怨在运行时,当我用下面的QML文件:环路上的对象属性(QML)
import QtQuick 2.7
import QtQuick.Controls 2.0
Rectangle
{
color: palette.grey
property var spotButtonFunctions :
{
'EditViewTool' : function() {switchToEditViewToolButton.source = "../View/Icons/icon_game.png";},
'SelectTool' : function() {switchToSelectToolButton.source = "../View/Icons/icon_game.png";}
}
property var greyButtonFunctions :
{
'EditViewTool' : function() {switchToEditViewToolButton.source = "../View/Icons/icon_settings.png";},
'SelectTool' : function() {switchToSelectToolButton.source = "../View/Icons/icon_info.png";}
}
// View update slots.
function onNotifyCurrentToolSignal(currentToolName)
{
// Grey all tool buttons.
for (x in greyButtonFunctions)
greyButtonFunctions[x]();
// Spot the current tool button.
if (currentToolName !== "")
spotButtonFunctions[currentToolName]();
}
}
排队for (x in greyButtonFunctions)
错误消息有关:
Error: Cannot assign QString to double
任何想法?