Я пытаюсь добавить фоновую музыку в небольшое приложение. Я использую Window7 и MinGW, но получаю эту ошибку:
ASSERT: «! Url.isRelative () && (QQmlFile :: urlToLocalFileOrQrc (url) .isEmpty () ||! QDir :: isRelativePath (QQmlFile :: urlToLocalFileOrQrc (url)))» в файле qml \ qc.qq линия 1639
Неверный параметр передан функции времени выполнения C.
В функцию времени выполнения C передан неверный параметр.
Это код:
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtMultimedia 5.8
Rectangle {
id: main
width: 600
height: 400
state: "mainMenu"
property int margePixel: 30
property int tailleInfoJeux: 200
Image {
id: background
source:"qrc:/images/mainbkg"
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
sourceSize.height: 800
}
MediaPlayer{
id: musicBkg
source: "file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/bkg1.wav"
autoLoad: true
autoPlay: false
volume: 1.0
loops: Audio.Infinite
Component.onCompleted: {
//console.log(source==Qt.resolvedUrl("file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/Kalimba.mp3"))
console.log(musicBkg.supportedAudioRoles())
}
}
}
это .pro файл
# Add more folders to ship with the application, here
folder_01.source = qml/SweetCandy
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp \
bonbon.cpp \
niveau.cpp \
case.cpp \
controleur.cpp
# Installation path
# target.path =
QT += multimedia
# Please do not modify the following two lines. Required for deployment.
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()
OTHER_FILES += \
qml/SweetCandy/main.qml \
qml/SweetCandy/VueBonbon.qml \
qml/SweetCandy/VueCase.qml
HEADERS += \
bonbon.h \
niveau.h \
case.h \
controleur.h
RESOURCES += \
ressources.qrc
ICON = SweetCandyIconeLinux.png
macx: ICON = SweetCandyIconeMac.icns
win32: RC_FILE = SweetCandy.rc