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 Qt has no dependences?

    Hey guys,so today I tried for the first time my Qt application on another computer,which has nothing to do with coding,so it has nor Qt neither c++ installed.


    So,I moved the .exe alone at first and what happened?...
    Lol..first it required some dlls,which is a problem that I know how to solve,but after that,when the app opened and it had no images(that I used as pixmap)...

    So then I moved the images(that were missing) with the .exe then,some of them could work,but still labels double...

    Can anyone help me?
    I need to demonstrate the program to many people,with different Windows!

    Thank ya.

    What to do?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    You need a imageformats folder in the same folder as your .exe, and in that folder you copy the dll's for the image formats you used in the application.

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

    Default Re: Qt has no dependences?

    Ok,I went to qt/plugins/imageformats.
    Then,I created a new folder in my USB called "program"e,I put there my exe and made another folder(inside "program") called "imageformats" and moved there all the dll's,
    Tried on the other pc and..same thing.

    The background image and button icons won't show.

    I even dragged the backg. image to the .exe,but it still doesn't show...
    Last edited by "BumbleBee"; 30th March 2011 at 11:12.

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    Maybe it's because "hard-coded" paths, or do you use the resource system for images? If you don't then use resources to integrate the necessary images into your application.

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

    Default Re: Qt has no dependences?

    My code is:
    Qt Code:
    1. QPalette palette;
    2. palette.setBrush(this->backgroundRole(), QBrush(QImage("1.jpg")));
    3. this->setPalette(palette);
    4.  
    5. //And this for the buttons
    6. x->setIcon(QIcon("ex.png"));
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt has no dependences?

    I put there my exe and made another folder(inside "program") called "imageformats" and moved there all the dll's,
    And how does your application know where to find these dlls?
    You have to add the path to your DLL's to the PATH environment variable.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: Qt has no dependences?

    For a starnge reason it works..lol
    I added
    Qt Code:
    1. QString myPath;
    2. myPath = "./imageformats";
    3. a.addLibraryPath(myPath);
    To copy to clipboard, switch view to plain text mode 

    And all works fine.Thanks guys,you always know the solution

  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: Qt has no dependences?

    Does by any chance you have a "imageformats" directory inside your "imageformats" directory?
    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. #9
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    @high_flyer, it's the path where Qt plugins are searched, i though that the deployment path for image plugins should be: plugins/imageformats, but that doesn't work, so default behavior seems to be imageformats folder direct in the same folder as application.

    I think the path to where images are stored is not correct, that is why i suggest you use qresource to store images and icons.

    And you don't need all the dll's from Qt_INSTALL/imageformats you need to copy only the dlls for image type you use (example: qjpeg4.dll if you use .jpg files)

    //if you don't use resources, maybe you can recreate the complete path by using QCoreApplication::applicationDirPath() and append the image name to the returned QString (if the images are in the same folder with the .exe file)
    But it's more clear and easy to use resources.

    LE: too late... i write to slow

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

    Default Re: Qt has no dependences?

    Ok guys thanks I'll try using resources(btw does recource sys require images to be in the same folder with .exe,or they are compiled inside?)!

    And wysota..I didn't understand what you asked...

  11. #11
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt has no dependences?

    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

  12. #12
    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

  13. #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: 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.


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.