linux - Gifs on Sailfish-os -


i came here little problem, can't use local .gif in code.

i work on linux qtcreator , sailfish vm make sailfish-os application.

i tried first this example, without success.

rectangle {     width: animation.width     height: animation.height      animatedimage { id: animation; source: "../images/animatedimageitem.gif"} } 

the execution return :

qml animatedimage: error reading animated image file file:///bla/bla/.....

same problem other permissions on gif , other gif.

after researches found this page indicate download plugin, qt declare (i wish put link i'm new -_-', see comments) gifs support default.

the plugin unobtainable , found sailfish/bin/plugins/imageformats/libqgif.so in directories.

so can show gif on damn thing ?

the error seeing related filepaths. gifs supported, afaik.

instead of coding path way, consider usage of resource file improve portability , platform independence.

  • create new resource file (file -> new file or project -> qt -> qt resource file)
  • the property editor opens, click add in bottom add prefix , set prefix such / (or whatever like!)
  • click again select add files , insert image
  • right-click newly added image entry , copy resource path clipboard
  • build -> run qmake (fundamental ensure correct compilation)

the path copied in clipboard should of form:

://path_to_image.gif 

now, given qml code, can guess image folder inside source code @ same level qml folder. hence, if added .gif file folder have following path in clipboard:

://images/name.gif 

this can prepended prefix obtain final path. if prefix set /, did above, final string set in source property of animatedimage be:

"qrc:///images/name.gif" 

obviously, different prefix or different path result in different final path.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -