0

我在 Qt Design Studio 中创建了一个项目,然后将其移至 Qt Creator。我完成了转换步骤,现在我只有 .ui.qml 文件现在我想调用 .ui.qml 文件中的一些函数。例如,我有一个形状,我想通过单击它来记录文本。但是 qt 创建者提醒我,我不能在 Qt Quick UI 表单中使用函数或 JavaScript 块。

qt 创建者中的错误:

qt 创建者中的错误

Main.ui.qml

import QtQuick 2.8

Item {
    id: main
    width: 1024
    height: 768
    
    Image {
        id: someImage
        MouseArea {
            anchors.fill: parent
            onClicked: {
                   // Here "JavaScript blocks are not supported in a Qt Quick UI 
                   // form." error occurs
            }
        }
    }
}
4

0 回答 0