QPushButton don't show background image in other windows pc



  • Hi
    i write a qt application on linux, and i compile also it on windows on my pc the QPushButton show the background image but in other windows pc no, the member function i use to show the background image is this:
    @
    char style[41];
    sprintf(style, "background-image: url(img/retro/%d.jpg)", retro);
    CardMat[i].ibutton->setStyleSheet(style);
    @

    CardMat[i].ibutton is a QPushButton



  • Did You check the path ? Try QDir::currentPath()+"img/.."



  • I have modified my code using QDir::currentPath() when i have the opportunity to try this in other windows pc, i tell you if work ;)

    for now thank you for help!



  • Did you distribute the image plugins in the right way?



  • [quote author="koniar" date="1330274297"]Did You check the path ? Try QDir::currentPath()+"img/.."

    [/quote]

    sorry don't work :(

    [quote author="Andre" date="1330356350"]Did you distribute the image plugins in the right way?[/quote]

    sorry i don't understand :(



  • If your app needs a plugin like sqlite or jpeg, you have to put the needed plugins in the same folder as the *.exe. The plugins need a special format i.e. jpeg plugin: imageformats/qjpeg4.dll.



  • [quote author="WellSaid" date="1330377712"]
    [quote author="Andre" date="1330356350"]Did you distribute the image plugins in the right way?[/quote]

    sorry i don't understand :([/quote]
    "click":http://bit.ly/yioWEs



  • I put the qjpeg4.dll in the same directory of *.exe of my qt application
    but not work! :'(



  • Like I mentioned above, create a folder "imageformats" and put the plugin there. After this it should work.



  • try this in mian.cpp
    QStringList libs;
    libs<<a.applicationDirPath()+"/plugins/";
    a.setLibraryPaths(libs);
    In Your application folder create folder plugins\imageformats
    copy qjpeg4.dll to imagefromats dir
    best reagrds


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.