Hi Martin,

Since my project is not a qml project but a C++ one, I have to deploy 
the qml with the executable. So to do that I use a resource .qrc file 
that has reference to my qml files:
<RCC>
     <qresource prefix="/">
         <file>qml/main.qml</file>
         <file>qml/RssModel.qml</file>
     </qresource>
</RCC>
This has the effect that the qml are available but the path to them is 
now a resource path not a file system path.
To access the qml from C++ I do the following:
ui->declarativeView->setSource(QUrl::fromLocalFile(":/qml/main.qml"));

This works perfectly if I don't use import Qt.multimedia, so it is not 
the path.

What I can see is that when run as a direct qml project, tvtennis is 
loading
  QDeclarativeEngine::importPlugin "Qt.multimedia" from 
"C:/Qt/qtcreator-1.3.83/bin/Qt/multimedia/multimedia.dll"

So when using QML projects I am not using my Qt 4.7 installed in 
C:\Qt\4.7.0-beta1\ instead I am using the one that came with QtCreator 
and something triggers loading those libraries as plugins.

Now , my Qt 4.7 beta 1 also have this libraries in 
C:\Qt\4.7.0-beta1\imports\Qt\multimedia\ but I do not know what should I 
do to make them load as plugins when qml engine starts. It is probably 
something that the qml viewer does and my project doesn't.

Any help is appreciated.

Regards,
Cristi

Martin Jones wrote:
> This looks suspicious:
> 
>> "" file::/qml/main.qml:2:1: module "Qt.multimedia" is not installed
> 
> That isn't a valid URL.  Did you supply a valid URL for the QML file?  
> QUrl::fromLocalFile() is the easiest way.
> 
> Regards,
> Martin.
> 
> On Tue, 15 Jun 2010 06:55:09 pm ext Cristian Daniel Stamateanu wrote:
>> Hello Justin,
>> Here is the output for tvtennis:
>> Starting C:\Qt\qtcreator-1.3.83\bin\qml.exe
>> C:/Qt/4.7.0-beta1/examples/declarative/tvtennis/tvtennis.qml
>> QDeclarativeEngine::addImportPath "C:/Qt/qtcreator-1.3.83/bin"
>> QDeclarativeEngine::addToImport 0x205a3a4 "." -1.-1 File as ""
>> QDeclarativeEngine::addToImport 0x205a3a4 "Qt" 4.7 Library as ""
>> QDeclarativeEngine::addToImport 0x205a3a4 "Qt.multimedia" 4.7 Library as ""
>> QDeclarativeEngine::add: loaded
>> "C:/Qt/qtcreator-1.3.83/bin/Qt/multimedia/qmldir"
>> QDeclarativeEngine::importPlugin "Qt.multimedia" from
>> "C:/Qt/qtcreator-1.3.83/bin/Qt/multimedia/multimedia.dll"
>> QDeclarativeEngine::resolveType "Rectangle" = "QDeclarativeRectangle"
>> QDeclarativeEngine::resolveType "SoundEffect" = "QSoundEffect"
>> QDeclarativeEngine::resolveType "SequentialAnimation" =
>> "QDeclarativeSequentialAnimation"
>> QDeclarativeEngine::resolveType "NumberAnimation" =
>> "QDeclarativeNumberAnimation"
>> QDeclarativeEngine::resolveType "ScriptAction" = "QDeclarativeScriptAction"
>> QDeclarativeEngine::resolveType "PropertyAction" =
>> "QDeclarativePropertyAction"
>> QDeclarativeEngine::resolveType "SpringFollow" = "QDeclarativeSpringFollow"
>> QDeclarativeEngine::resolveType "Repeater" = "QDeclarativeRepeater"
>> Wall startup time: 12
>> C:\Qt\qtcreator-1.3.83\bin\qml.exe exited with code 0
>>
>>
>> and here is the output for my app:
>> Starting C:\Qt\workspace\qpodcatcher-build\debug\qpodcatcher.exe...
>> QDeclarativeEngine::addToImport 0x173efeac "." -1.-1 File as ""
>> QDeclarativeEngine::addToImport 0x173efeac "Qt" 4.7 Library as ""
>> QDeclarativeEngine::addToImport 0x173efeac "Qt.multimedia" 4.7 Library as
>> "" file::/qml/main.qml:2:1: module "Qt.multimedia" is not installed
>>       import Qt.multimedia 4.7
>>       ^
>>
>> Best Regards,
>> Cristian
>>
>> Justin McPherson wrote:
>>> Hi,
>>>
>>> On 14/06/2010, at 11:43 PM, ext Cristian Daniel Stamateanu wrote:
>>>> I have a C++ project that displays QML files inside a QDeclarativeView.
>>>> I tried to make Audio work according to the user manual example and I
>>>> cannot:
>>>>
>>>> import Qt 4.7
>>>> import Qt.multimedia 4.7
>>>>
>>>> Audio { source: "audio/song.mp3" }
>>>>
>>>> I get the following error:
>>>> file::/qml/main.qml:2:1: module "Qt.multimedia" is not installed
>>>>
>>>>      import Qt.multimedia 4.7
>>>>
>>>> I am using Qt 4.7 beta 1 and Qt Creator Beta 1.3.83 on a Windows 7  32
>>>> bit machine.
>>>>
>>>> First I thought I may have missing the Qt Multimedia altogether, but I
>>>> have libQtMultimedia4 in the lib folders. Furthermore, loading tvtennis
>>>> from qt4 samples works like a charm and it seems to have the same
>>>> Qt.multimedia import.
>>> That's a strange one. If it works in one place it should work elsewhere.
>>>
>>> The library that you mention, libQtMultimedia4, is ultimately where the
>>> multimedia code lives, additionally there is a qml import plugin that
>>> lives in imports/Qt/multimedia, which is how the runtime locates the
>>> multimedia elements.
>>>
>>> You could try setting QML_IMPORT_TRACE=1 when running your application,
>>> and also when running the Qml application (to play tvtennis). You should
>>> then be able to see messages about the import process.
>>>
>>> Please post the results.
>>>
>>>
>>> - Justin
>>>
>>>> Regards,
>>>> Cristi
>>>> _______________________________________________
>>>> Qt-qml mailing list
>>>> [email protected]
>>>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>> _______________________________________________
>> Qt-qml mailing list
>> [email protected]
>> http://lists.trolltech.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to