Page 1 of 2 12 LastLast
Results 1 to 20 of 29

Thread: How to add qsvg

  1. #1
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy How to add qsvg

    Hi,

    I have an app, which has some .svg files as resources. These get passed to QIcon constructors. When my app is built dynamically, everything works, but I want to build my app statically. When I do that, the icons disappear. Sometimes I get errors from QObject::moveToThread saying that some object not being in the corrent thread (I'm not calling moveToThread), and that my ':/something.svg' files cannot be loaded because Unknown error. I also can't add qsvg to my application, because I get wierd "undefined reference to `qt_plugin_instance_qsvg()'" errors.

    Thanks for any help.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    You need an SVG icon engine to be present in your application. If you compiled the application statically, you have to import the appropriate static plugin into your application. See the docs about static plugins for more details.

  3. #3
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Thanks for your reply,

    I've read the doc like a thousand times (so if the solution really is there, I have selective vision ). I did add a QT_PLUGIN += qsvg line to my .pro file, and also a Q_IMPORT_PLUGIN(qsvg) above my main(). This is producing the linker error (undefined reference to qt_plugin_instance_qsvg() ). It looks I'm missing something, but I can't figure out what...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    Do you have the static plugin compiled?

  5. #5
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Afaik, yes. I have libqsvg4.a, libqsvg.a, libqsvgd.a, and qsvg4.dll in qt/4.3.3/plugins/iconengines

  6. #6
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    up .

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Do you use QMake binary from static Qt build? That linker error about plugin instance usually appears when you link a normal non-static plugin with your application.

  8. The following user says thank you to jacek for this useful post:

    Aceman2000 (3rd February 2008)

  9. #8
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    I have configured Qt with -static -release -no-exceptions.

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Do you have more than one Qt version installed?

  11. #10
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    No, only 4.3.3, and it's in the default directory, too.

  12. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Do you compile your application in the release mode?

  13. #12
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Yes. The linker error is in main.o (main.cpp contains the Q_IMPORT_PLUGIN(qsvg) line). Also, my project file now contains every combination of QT, _, PLUGIN, PLUGINS, +=, and qsvg that seems logical

  14. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    Could you show us the sizes of files in iconengines? ls -l will do the trick on U*ix systems.

  15. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Could you post the command that make uses to link your application?

    Run make > somefile.txt and find the line with -lqsvg in somefile.txt.

  16. #15
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    Make stdout:

    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory `D:/prog/qt/sendfile'
    g++ -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-subsystem,windows -o release\sendfile.exe object_script.sendfile.Release -L"c:\Qt\4.3.3\lib" -lmingw32 -lqtmain -LC:/Qt/4.3.3/plugins/iconengines -lqsvg4 -lQtXml -lQtGui -lQtNetwork -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
    mingw32-make[1]: Leaving directory `D:/prog/qt/sendfile'

    -lqsvg doesn't appear, not even with

    LIBS += -L$$[QT_INSTALL_PLUGINS]/iconengines -lqsvg

    Dir in iconengines:

    29 508 libqsvg.a
    2 146 libqsvg4.a
    1 255 072 libqsvgd.a
    45 568 qsvg4.dll
    Last edited by Aceman2000; 2nd February 2008 at 15:11.

  17. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    You have two installations mixed up. libqsvg4.a and qsvg4.dll are an import and dynamic libraries from a shared installation and libqsvg.a and libqsvgd.a are static plugins (release and debug version respectively). I suggest moving libqsvg4.a and the dll out of the directory as the first thing to do as your application tries to link against the dynamic version of the plugin instead of the static one - hence the error.

    And by the way, what is the contents of your lib subdirectory of the Qt installation? Do those libraries have .a or .dll extensions? If .a files have small sizes, they are import modules for dynamic libraries and not static versions of them.

  18. #17
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    I used the Qt installer, and then ran a configure command. Will reinstall, maybe it cleans things up...

  19. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    Why did you run configure? If you ran configure, then you should run make afterwards. Do you want a static compilation or is it just a way to solve your svg problems?

  20. #19
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add qsvg

    I'm following these instructions: http://wiki.qtcentre.org/index.php?t..._Qt_on_Windows

    I was misunderstandable, I did run configure AND make. Sorry about that. I want one exe file that needs no DLL's.

  21. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add qsvg

    So I suggest you download the source code only and then configure and make. Don't install binaries or you'll be mixing two installations.

  22. The following user says thank you to wysota for this useful post:

    Aceman2000 (3rd February 2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.