Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Packaging files in with the Qt project file 4.8
Qt 6.11 is out! See what's new in the release blog

Packaging files in with the Qt project file 4.8

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jimbo2
    wrote on last edited by
    #1

    Hi there,

    I'm porting an application from mobile to desktop Qt 4.8 and I have a bunch of image and audio files that are packaged with the application and installed via the project file.

    So for example under Symbian in the project file I had:

    @music.files = sounds/music/*
    music.path = /sounds/music #appends to private automatically
    DEPLOYMENT += music@

    Which I then accessed through the code via:

    @ QString musicName = QApplication::applicationDirPath() + "/sounds/music/TitleMenu.mp3";
    iMusicMediaSourceA = new Phonon::MediaSource(musicName);@

    On other platforms such as Sailfish I used a similar approach with the INSTALLS keyword in place of DEPLOYMENT.

    However, I'm now working on Desktop - specifically Windows, but will be porting to Linux and Mac later, and this doesn't seem to work. Can anyone point me in the right direction for how to include these files in the build?

    This is with Qt 4.8

    Many thanks.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Use QRC (Qt Resource files) - it will work the same on all platforms and does not reuqire any .pro file magic.

      (Z(:^

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jimbo2
        wrote on last edited by
        #3

        Thank you, I've tried this but unfortunately it's added about 60MB to the resource file and now the project fails to compile:

        @15:48:39: Starting: "Q:\Qt\qtcreator-2.8.1\bin\jom.exe"
        q:\Qt\4.8.5\bin\qmake.exe -spec ..\Qt\4.8.5\mkspecs\win32-msvc2010 CONFIG+=declarative_debug -o Makefile ..\PuzzleStones\PuzzleStones.pro
        Q:\Qt\qtcreator-2.8.1\bin\jom.exe -f Makefile.Debug
        cl -c -nologo -Zm200 -Zc:wchar_t- /Zm1900 -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQ_OS_PC=1 -DQT_DLL -DQT_PHONON_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\Qt\4.8.5\include\QtCore" -I"..\Qt\4.8.5\include\QtGui" -I"..\Qt\4.8.5\include\QtOpenGL" -I"..\Qt\4.8.5\include\phonon" -I"..\Qt\4.8.5\include" -I"..\Qt\4.8.5\include\ActiveQt" -I"..\Qt\4.8.5\include\phonon_compat" -I"debug" -I"..\PuzzleStones" -I"." -I"..\Qt\4.8.5\mkspecs\win32-msvc2010" -Fodebug\ @C:\Users\Duncan\AppData\Local\Temp\qrc_PuzzleStones.obj.3252.94.jom
        qrc_PuzzleStones.cpp
        cl : Command line warning D9025 : overriding '/Zm200' with '/Zm1900'
        debug\qrc_PuzzleStones.cpp(1165642) : fatal error C1060: compiler is out of heap space
        jom: Q:\build-PuzzleStones-Desktop-Debug\Makefile.Debug [debug\qrc_PuzzleStones.obj] Error 2http://qt-project.org/forums/viewthread/35147/#
        jom: Q:\build-PuzzleStones-Desktop-Debug\Makefile [debug] Error 2@

        Any idea how to fix this?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Wow, that is impressive :) You can split the resources into several smaller files. There will be no difference at runtime (QRC prefix and all will continue to work the same), and the compiler should stay within it's limits :)

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved