Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Problem with SetIcon when using a png

Problem with SetIcon when using a png

Scheduled Pinned Locked Moved Unsolved Language Bindings
7 Posts 2 Posters 1.1k Views
  • 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.
  • C Offline
    C Offline
    Casisto88
    wrote on last edited by
    #1

    Hello,

    It's my first Post, so I hope I give you all the Informations you need. I am using pyside2 5.13.0 on Python 3.6.5 and install it with pip.

    I write a Tool, where I have some QPushButtons. By User-Action, the displayed Icon has to be updated. I do that as followed:

    /self.values[c_number][cnt].setIcon(QIcon(path))
    

    When I'm using a JPG it's fine. But when I'm using a PNG, it didn't display anything. The Pushbutton turns grey and that is all.

    Have you a suggestion what I can do?
    I have tried the following, without any success:

    self.values[c_number][cnt].repaint()
    self.values[c_number][cnt].setIconSize(QSize(20,20))
    self.values[c_number][cnt].setIconSize(QSize(80,80))
    self.values[c_number][cnt].update()
    

    Best regards

    • Casisto
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you display that image on a QLabel ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Casisto88
        wrote on last edited by
        #3

        Thanks.
        The problem stays when I display the image on a QLabel (as Pixmap). JPG are displayed, PNG not.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you start the application with the QT_DEBUG_PLUGINS environment variable set to 1 ?

          See what is related to the image plugins.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • C Offline
            C Offline
            Casisto88
            wrote on last edited by
            #5

            Maybe not. Referring to doc.qt.io/qtforpython there is no Variable named „QT_DEBUG_PLUGINS“ and my shoots in the blue dosn‘t work.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Casisto88
              wrote on last edited by
              #6

              I‘ve use now a Build-In PNG2JPG-Converter (Pillow). It‘s very fast and has a good license.

              I‘ll let the Topic open, maybe I got Time to observe the behaviour in some weeks. Now it‘s tracked as „known Issue“

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Because the environment variable is described here. The fact that you are using python is of no importance here.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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