Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

SVG in QPushButton on RPi



  • Hi,
    I configured my computer to cross compiling based on RaspberryPi2EGLFS (https://wiki.qt.io/RaspberryPi2EGLFS) to write programs on RPi.

    My application run on fullscreen so I use SVG file in QPushButton. When I run program on computer icons appear well but when I run on RPi icons are missing.

    When I use png or jpg icon appear but is small (icon is not scales).

    I try to set QT += core svg gui but I get error Unknown module(s) in QT: svg.

    Does anyone know how to solve this problem?
    Thank you in advance for your help.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You have to cross-compile/instal the qtsvg module.



  • Thank you for your reply.

    I have checked and I have not qtsvg folder in qtbase.

    So, I cloned once again qtbase and made ./configure but still I don't have qtsvg.

    git clone git://code.qt.io/qt/qtbase.git -b 5.6
    cd qtbase
    
    ./configure -release -opengl es2 -device linux-rasp-pi-g++ \
    -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- \
    -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs \
    -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
    

    After configure I get output:

    Build options:
      Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile cups dbus dbus-linked egl eglfs eglfs_brcm eglfs_gbm enable_new_dtags evdev eventfd fontconfig full-config gbm getaddrinfo getifaddrs glib gstreamer-0.10 harfbuzz iconv inotify ipv6ifname kms large-config largefile libinput libudev linuxfb medium-config minimal-config mremap mtdev opengl opengles2 openssl openvg pcre png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports release rpath shared small-config system-freetype system-jpeg system-png system-zlib threadsafe-cloexec tslib use_gold_linker xcb xcb-glx xcb-plugin xcb-render xcb-xlib xinput2 xkbcommon-evdev xkbcommon-qt xlib xrender 
      Build parts ............  libs
      Mode ................... release
      Using sanitizer(s)...... none
      Using C++ standard ..... c++11
      Using gold linker....... yes
      Using new DTAGS ........ yes
      Using PCH .............. yes
      Using LTCG ............. no
      Target compiler supports:
        Neon ................. no
    
    Qt modules and options:
      Qt D-Bus ............... yes (linked to dbus-1)
      Qt Concurrent .......... yes
      Qt GUI ................. yes
      Qt Widgets ............. yes
      Large File ............. yes
      QML debugging .......... yes
      Use system proxies ..... no
    
    Support enabled for:
      Accessibility .......... yes
      ALSA ................... yes
      CUPS ................... yes
      Evdev .................. yes
      FontConfig ............. yes
      FreeType ............... yes (system library)
      Glib ................... yes
      GStreamer .............. yes (0.10)
      GTK theme .............. no
      HarfBuzz ............... yes (bundled copy)
      Iconv .................. yes
      ICU .................... no
      Image formats: 
        GIF .................. yes (plugin, using bundled copy)
        JPEG ................. yes (plugin, using system library)
        PNG .................. yes (in QtGui, using system library)
      libinput................ yes
      Logging backends: 
        journald ............... no
        syslog   ............... no
      mtdev .................. yes (system library)
      Networking: 
        getaddrinfo .......... yes
        getifaddrs ........... yes
        IPv6 ifname .......... yes
        libproxy.............. no
        OpenSSL .............. yes (loading libraries at run-time)
      OpenGL / OpenVG: 
        EGL .................. yes
        OpenGL ............... yes (OpenGL ES 2.0+)
        OpenVG ............... yes-auto
      PCRE ................... yes (bundled copy)
      pkg-config ............. yes 
      PulseAudio ............. yes
      QPA backends: 
        DirectFB ............. no
        EGLFS ................ yes
          EGLFS i.MX6 ........ no
          EGLFS i.MX6 Wayland. no
          EGLFS EGLDevice .... no
          EGLFS GBM .......... yes
          EGLFS Mali ......... no
          EGLFS Raspberry Pi . yes
          EGLFS X11 .......... no
        LinuxFB .............. yes
        Mir client............ no
        XCB .................. yes (system library)
          EGL on X ........... no
          GLX ................ yes
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes (loaded at runtime)
          Xfixes ............. yes (loaded at runtime)
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes (loaded at runtime)
          Xrandr ............. yes (loaded at runtime)
          Xrender ............ yes
          XKB ................ no
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
      Session management ..... yes
      SQL drivers: 
        DB2 .................. no
        InterBase ............ no
        MySQL ................ no
        OCI .................. no
        ODBC ................. yes (plugin)
        PostgreSQL ........... no
        SQLite 2 ............. yes (plugin)
        SQLite ............... yes (plugin, using bundled copy)
        TDS .................. yes (plugin)
      tslib .................. yes
      udev ................... yes
      xkbcommon-x11........... yes (bundled copy, XKB config root: /usr/share/X11/xkb)
      xkbcommon-evdev......... yes
      zlib ................... yes (system library)
    

    I use debian and I have installed

    libqt5svg5:amd64                         5.6.1-2                              amd64        Qt 5 SVG module
    libqt5svg5-dev:amd64                     5.6.1-2                              amd64        Qt 5 SVG module development files
    

    What am I doing wrong?


  • Lifetime Qt Champion

    You are cloning the wrong module, QtSvg has its own module. Once you cloned it, you can use your cross-compile qmake to build it.



  • Thank you for help :-)

    I cloned whole qt5 and initialized only qtbase and qtsvg.
    To compile I had to install libxcb-xinerama0 libxcb-xinerama0-dev on RPi and sync systool.

    Everything work well!


Log in to reply