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. Can we set id for image or pixmap?

Can we set id for image or pixmap?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 3.9k 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    Like button can we set id for pixmap or image?

    Pratik Agrawal

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      If we are talking about objectName here then no, as QPixmap and QImage do not inherit from QObject.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vsorokin
        wrote on last edited by
        #3

        What do you mean, when you speaking "id".
        Can you explain more, please?

        --
        Vasiliy

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pratik041
          wrote on last edited by
          #4

          id is an integer identifier of any widget or in this case i am talking about id of image.

          Pratik Agrawal

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            No, but you can't do that with QPushButton either. Can you elaborate on this?

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vsorokin
              wrote on last edited by
              #6

              What for do you want id?

              Two ways

              1. Pointer to object already uniquely identified object.
              2. You can create QHash<int, QImage> for correlation some id with your objects.

              --
              Vasiliy

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fluca1978
                wrote on last edited by
                #7

                Are you using a property as your id?

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pratik041
                  wrote on last edited by
                  #8

                  with QPushbutton we can't use but with Qbuttongroup we can add to it. I have an image in Qpixmap
                  i want to access that image through a unique id.

                  Pratik Agrawal

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    lgeyer
                    wrote on last edited by
                    #9

                    This is a feature unique to QButtonGroup.

                    See Vass' post for a solution. Depending on how you manage the lifetime of your objects you might use QHash<int, QImage*> instead.

                    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