[Solved] Using nested resources in C++/QML files
-
From my main C++ code (see below), I'm calling an animation QML file that's in my resources. This is what my main function looks like:
@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDeclarativeView view;
view.setSource(QUrl("qrc:/MyFiles/animation.qml"));
view.show();
return app.exec();
}
@Inside the animation.qml file, it's using an image that's also a resource file. Here's an abbreviated version of the QML file:
@
Rectangle {
width: 1430; height: 800; color: "lightsteelblue"
Image {
source: "qrc:/MyFiles/krlogo.jpg"
SeqeuntialAnimation {
running: true
(a NumberAnimation and a ParallelAnimation)
}
}
}
@The lightsteelblue window for the animation comes up fine, so I know the C++ part is doing its job, but I never see the image or the animation in the window that appears. I know the QML file works fine because when I execute it alone, everything moves as it should. Is there some special trick to calling a resource file from a resource file?
-
I switched the source in the QML to "/MyFiles/krlogo.jpg" and had no luck. But I then changed it to "/MyFiles/KRLogo.jpg", and it worked. Since when are filespecs case-sensitive?
Also, why is the title of my post in gray whereas most are in black? Am I on some kind of naughty list? :o)
-
[quote author="mlong" date="1314385199"]Qt resources are always case-sensitive (as are the filesystems on unix/OSX). Windows' file system is the odd man out, being case-insensitive. In practice, it's generally a good rule to assume that filenames are case-sensitive.
[/quote]
Just for the records
Mac OS X HFS+ with standard settings is case insensitive too.One should always use the right case, though. That saves you from trouble later, when you're on case sensitive systems.