Size constraints for video for QML
-
@SGaist said in Size constraints for video for QML:
You create a .qrc file
You use rcc to generate an external file
You add a call to registerResource in your sources to be able to access your data as if they were on different connections.My apologies, I had to move onto other tasks at work.
I'm still unclear as to the ordering of things
1.) I create a qrc file with nothing in it
2.) Where do I call the commandrcc -binary myresource.qrc -o myresource.rccI tried to call it in the cmd line from the project directory to no avail
Moreover, is myresource.rcc just the file name or the actual file itself?
3.) Where do I point to the path of the file I want to create as a binary external resource? WithQResource::registerResource("/path/to/myresource.rcc");Should it go in the .pro file?
I really need someone to just spell it out for me, I'm new to this. An example would help me a whole lot.
Thank you!
-
- Why empty ? Its content should be the same as if you would build the resource within your application.
- Likely because you were calling it on an empty file.
- No, it should go in your application.
-
@SGaist @abanksdev said in Size constraints for video for QML:
rcc -binary myresource.qrc -o myresource.rcc
running it in my project dir results in the following:
-bash: rcc: command not foundI must be missing something totally obvious
-
How did you install Qt ?
-
Nevermind I got that working.
Once I have the rcc file should I delete the qrc file that I built it from?
Moreover how do I set the source of a qml object to a rcc file?I assumed I should use the same path that i registered in QResource::registerResource("/path/to/myresource.rcc"); but when i do that, i don't get any errors, but yet the video im trying to display doesn't show up
-
No you don't, the .qrc file is a part of your sources the same as the rest of your code.
Again, no, use the same path as you would if it was embedded in your application.
-
Okay, for clarity's sake, here's how I'm implementing this. Let me know if anything is completely off base.
The file I am trying to embed in my application: myMovie.mov
1.) I add a new resource file called 'videos.qrc' and add myMovie.mov file to it
2.) In the project's directory I register rcc -binary videos.qrc -o videos.rcc
3.) In main.cpp in main() I use QResource::registerResource("C:/Users...qtProject/videos.rcc")
4.) In video.qml:MediaPlayer { id: video source: "qrc:/videos/myMovie.mov" autoPlay: true } VideoOutput{ source: video } -
Might be a silly question but does that video work correctly if you give the full path to it ?
-
Rather the QuickTime format is not supported by the backend.