Qmovie does not show gif images in Mac
I would like to show the gif images. it works very well in windows but when i tried with Mac the gifs images are not loaded.
I read that i must find the file qgif4.dll but i checked in the qt directory in imageformats and it does not appear. There are only dylib and dSYM. What do i have to do to get the dlls so i can use them in my project to show the gifs?
Thank you very much
Do you have anything named qgif.dylib ?
On windows its inside the compiler folder in the Qt folder.
Hi thank you for answering. I have something similar libqgif.dylib. I suppose it is the same but not a dll.
Well DLLS are a Windows thing.
In linux its .SO files and i think dylib on MacOS is the same as a DLL/So file.
A dynamic loadable library.
Just to understand. ITs not working directly in Creator or when you run your app standalone ?
Did you use
to deploy the app ?
It often gets such extra files.
Where is your gif located ?
Does it happen when running your application through Qt Creator ?
What version of Qt are you using ?
zandarina last edited by zandarina
Thank you for answering I put the directory imagefactory where the executable is. I have also tried in the release and debug directory and in the build directory. With no luck. I have qt 5.11.1. I checked the isvalid of qmovie and it returns false. I use cmake to generate the project and xcode to compile and run the application.
std::unique_ptr<QLabel> phase_video_label(new QLabel("phase_video_label", main_frame_)); phase_video_player_ = new QMovie(this); phase_video_player_->setFileName("/Users/xxxxx/xxx/s/images/videos/dicom.gif"); std::string video_name = step.get_definition().get_video().c_str(); std::cout << video_name; phase_video_label.get()->setAlignment(Qt::AlignCenter); phase_video_label.get()->setMovie(phase_video_player_); phase_video_player_->setScaledSize(QSize(230, 123)); phase_video_player_->start(); bool ivalid = phase_video_player_->isValid(); std::cout << ivalid; auto formats = phase_video_player_->supportedFormats(); QTextCodec *codec = QTextCodec::codecForName("KOI8-R"); QString string = codec->toUnicode(formats.value(0));
I found the error, Somehow Xcode does not detect the relative path and it does not find the files. If i put full paths it works. This is why in windows worked and here it doesn't. Someone had the same problem?
@zandarina It's not XCode not finding the files, but your app. Relative paths are relative to current working directory.
The structure of the app bundle on macOS has nothing to do with an application on Windows. Either you shall copy the file in the right place in the bundle or depending on its size and use store it using the Qt Resources System.
zandarina last edited by zandarina
Yes but it is because i use it in a cpp generated with moc. In windows it considers this file generated by moc within the source path when it generates it. But it seems in mac not to consider the source path from the project if not from where it has been generated (the bin). For that reason, i need to specify the full path. Because it does not consider it in the main project path so the relative path is not working anymore.
How are you using it in a cpp file generated by moc ?
Thank you very much for anwering. I have solved it following your suggestions. I created a bundle indicating the resource folder and then I put all the folders there. Now it does not go to the bin folder. Thank you very much for all your help. I am very new in Mac and I am finding quite hard to work with it. So I appreciate all the help. Cheers
Glad you got it working !
Since everything is ok now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)