PDA

View Full Version : QtMultimedia error Sound Effect



joaovictor
6th February 2017, 19:04
Well, my problem is the sound that did not come out because inside the call of the object "Qt.createQmlObject ()" I can not use the QtMultimedia 5.0 module with a "muted:" property that receives the value of!! Qt.application.active ; " I get an error message

file:///C:/Users/joaovictor/Desktop/demarsia/conteudo/EfeitoSonoro.qml:7: Error: Qt.createQmlObject(): failed to create object:
file:///C:/Users/joaovictor/Desktop/demarsia/conteudo/inline:1:143: Cannot assign to non-existent property "muted"

(the module .qml)
O módulo EfeitoSonoro.qml:12325



import QtQuick 2.0
import QtMultimedia 5.0
//Proxies a SoundEffect if QtMultimedia is installed
Item {
id: container

property QtObject effect: Qt.createQmlObject('import QtMultimedia 5.0; EfeitoSonoro{ source: " ' + container.source + ' "; muted: !Qt.application.active } ', container);
property url source: ""
onSourceChanged: if (effect != null) effect.source = source;
function play() {
if (effect != null)
effect.play();
}
}

anda_skoa
7th February 2017, 07:22
Your EfeitoSonoro element doesn't seem to have a "muted" property.

Also, are you sure you want to create an object of its own type inside the object?

Cheers,
_

joaovictor
8th February 2017, 18:22
Thanks !! I'm a newbie but now I understand that the call of a object is other QML object and not my created qml. now works perfectly

the SoundEffect{} is the correct call :D very thanks dude!