Results 1 to 19 of 19

Thread: Qt has no dependences?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Qt has no dependences?

    Quote Originally Posted by Zlatomir View Post
    Wysota asked if you don't have something like imageformats\imageformats\qjpeg4.dll? you need to have imageformats\qjpeg4.dll (and of course other dll's for image formats you used in your application)

    And resources are "compiled" inside the application. //see the link i gave you in my second post
    Oh..ok.
    No I do not have two folders...it's imageformats/qjpeg4.dll

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

    Default Re: Qt has no dependences?

    So this:
    Qt Code:
    1. QString myPath;
    2. myPath = "./imageformats";
    3. a.addLibraryPath(myPath);
    To copy to clipboard, switch view to plain text mode 
    didn't help your app in any way as it's just plain wrong.
    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
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Qt has no dependences?

    I made a qrc file.
    It looks like this(added prefix and then images):
    Qt Code:
    1. <RCC>
    2. <qresource prefix="/new/prefix1">
    3. <file>1.jpg</file>
    4. <file>ex.png</file>
    5. <file>o.png</file>
    6. <file>icon.png</file>
    7. </qresource>
    8. </RCC>
    To copy to clipboard, switch view to plain text mode 

    Then in .cpp file I call images like this:
    Qt Code:
    1. QPalette palette;
    2. palette.setBrush(this->backgroundRole(), QBrush(QImage("1.jpg")));
    3. this->setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

    Then,I save,build and move the exe alone to a removable disk.
    And...It doesn't work.All the images don't show(like if the qrc doesn't exist..).I add the icons to the removable disk(near exe)and it works then...

    In my main.cpp I have this:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "tictactoe.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. TicTacToe w;
    8. w.show();
    9. Q_INIT_RESOURCE(icons); //My qrc file is: icons.qrc
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Please help.
    Last edited by "BumbleBee"; 3rd April 2011 at 18:24.

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

    Default Re: Qt has no dependences?

    You have no "1.jpg" in the qrc file, you only have ":/new/prefix1/1.jpg".
    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
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Qt has no dependences?

    Quote Originally Posted by wysota View Post
    You have no "1.jpg" in the qrc file, you only have ":/new/prefix1/1.jpg".
    Sorry what?
    There is a 1.jpg "declared" in the qrc

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    But you have defined a prefix for the images, which means you have to use it (prefix) when accessing the resources.

  7. #7
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Qt has no dependences?

    Quote Originally Posted by stampede View Post
    But you have defined a prefix for the images, which means you have to use it (prefix) when accessing the resources.
    Removed.Still same effect
    Qt Code:
    1. <RCC>
    2. <qresource>
    3. <file>1.jpg</file>
    4. <file>ex.png</file>
    5. <file>o.png</file>
    6. <file>icon.png</file>
    7. </qresource>
    8. </RCC>
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    How do you access the images ? If you write QImage("1.jpg") you are not referencing the image from resource system, you have to use the colon - QImage(":/1.jpg"). It's written in the resource system documentation.

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
  •  
Qt is a trademark of The Qt Company.