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. QPushButton don't show background image in other windows pc

QPushButton don't show background image in other windows pc

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 4.2k 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.
  • W Offline
    W Offline
    WellSaid
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koniar
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • W Offline
        W Offline
        WellSaid
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Did you distribute the image plugins in the right way?

          1 Reply Last reply
          0
          • W Offline
            W Offline
            WellSaid
            wrote on last edited by
            #5

            [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 :(

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Scylla
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                [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

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  WellSaid
                  wrote on last edited by
                  #8

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

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Scylla
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      koniar
                      wrote on last edited by
                      #10

                      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

                      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