Results 1 to 10 of 10

Thread: Setting a .pro file for a resource project.

  1. #1
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Setting a .pro file for a resource project.

    Hi!

    I want to manage resource media files (icons, stylesheets, sounds, ecc.) as separated files without a built-in resource ".qrc" file.

    All these resources are located in a "media" subfolder in my source tree. I need to copy this sub-tree (which has its root in the media folder) in the dest directory (a classic "bin/" directory).

    Before "build"
    Qt Code:
    1. - src/
    2.  
    3. -- media/
    4. --- icons/
    5. --- sounds/
    6. --- styles/
    7.  
    8. -- code/
    9.  
    10. -- bin/
    To copy to clipboard, switch view to plain text mode 

    After "build"
    Qt Code:
    1. - src/
    2.  
    3. -- media/
    4. --- icons/
    5. --- sounds/
    6. --- styles/
    7.  
    8. -- code/
    9.  
    10. -- bin/
    11. --- code.bin
    12. --- media/
    13. ---- icons/
    14. ---- sounds/
    15. ---- styles/
    To copy to clipboard, switch view to plain text mode 

    Can I use a .pro file for this (so i can use QCreator to build all project files)?

    Thanks!

  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: Setting a .pro file for a resource project.

    Yes, you can. You have to create an install target and fill it out properly. Consult our wiki and/or qmake docs for details.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Setting a .pro file for a resource project.

    Mmm...Sorry but I don't understand how can i write it. This is my media/themes/default/default.pro file:

    Qt Code:
    1. style.path = ../../../bin/themes/default
    2. style.files = ./*
    3. INSTALLS += style
    To copy to clipboard, switch view to plain text mode 

    but it doesn't work (the build process fails).

  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: Setting a .pro file for a resource project.

    qmake Code:
    1. style.path = ../../bin/themes/default
    2. FILES_TO_INSTALL = file1 file2 file3 ...
    3. style.files = FILES_TO_INSTALL
    4. INSTALLS += style
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Setting a .pro file for a resource project.

    Qt Code:
    1. error: undefined reference to `main'.
    2. error: collect2: ld returned 1 exit status.
    To copy to clipboard, switch view to plain text mode 

    Which template should I use for my project? "app" or "lib"?

    P.S. I'm using QtCreator for build my projects...

  6. #6
    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: Setting a .pro file for a resource project.

    Quote Originally Posted by zuck View Post
    Which template should I use for my project? "app" or "lib"?
    It doesn't matter for the installation part. Use the one that's relevant to your project. If your project is an application, use "app", if it's a library use "lib".

    P.S. I'm using QtCreator for build my projects...
    No, you are using qmake to build your project. You are using Qt Creator to edit files from your project.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Setting a .pro file for a resource project.

    Quote Originally Posted by wysota View Post
    It doesn't matter for the installation part. Use the one that's relevant to your project. If your project is an application, use "app", if it's a library use "lib".
    Ok but the original goal was to create a stand-alone project for all resource files and another one for my main application code. If it's impossible I can merge my environment into a single project.

    No, you are using qmake to build your project. You are using Qt Creator to edit files from your project.
    Yes, you are right

  8. #8
    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: Setting a .pro file for a resource project.

    Quote Originally Posted by zuck View Post
    Ok but the original goal was to create a stand-alone project for all resource files and another one for my main application code. If it's impossible I can merge my environment into a single project.
    Merge it into one project. It doesn't make sense to separate them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    zuck (8th April 2009)

  10. #9
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Setting a .pro file for a resource project.

    Thanks! It works!

    This is the final code:

    Qt Code:
    1. # ... CUT ...
    2.  
    3. # Media files.
    4. MEDIASRCDIR = themes/default
    5. MEDIADESTDIR = $$DESTDIR/$$MEDIASRCDIR
    6. style.path = $$MEDIADESTDIR
    7. style.files = $$MEDIASRCDIR/*
    8. INSTALLS += style
    To copy to clipboard, switch view to plain text mode 

    It needs a make install command to works

  11. #10
    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: Setting a .pro file for a resource project.

    Yes, it does. I thought it was obvious, sorry for not mentioning it explicitely.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 8th July 2008, 19:37
  2. Re: Opening Project file Issue in Edyuk
    By philwinder in forum Qt-based Software
    Replies: 6
    Last Post: 5th May 2008, 20:49
  3. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  4. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22
  5. Replies: 2
    Last Post: 8th November 2007, 20:15

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.