PDA

View Full Version : Error: Cannot assign QJSValue to QObject*



john_god
20th August 2018, 23:39
I have a NumberAnimation where the target is a dynamic qml Item object, created with Qt.createComponent().
The code works fine but I always get a error in QtCreator Aplication Output window, I don't know how to remove that annoying error.


property var badJoeObj: ({})

NumberAnimation {
id: moveBadJoeToAnotherScreen
duration: 1000
}

function moveBadJoe2AnotherScreen(){
moveBadJoeToAnotherScreen.target = badJoeObj // <- Error: Cannot assign QJSValue to QObject*
...
}

wysota
21st August 2018, 06:56
How about:

property Item badJoeObj: null

NumberAnimation {
target: badJoeObj

// ...
}

john_god
21st August 2018, 13:00
Thanks Wysota, that works.