Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Displaying a logo at a particular position

    General and Desktop
    2
    4
    633
    Loading More Posts
    • 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.
    • D
      dev123 last edited by

      I have a collection of (radio)buttons on my screen, and I want to add a .png logo at a specific point (coordinate), possibly with the ability to scale up/down the image. (The feature that is provided with QPushButton.setGeometry)
      How could this be achieved? Thanks.

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        Did you place the buttons in a layout? Do you need the icon to stay within this layout, should it be a backgroud image? Maybe add a picture to show what you need. The easiest way to handle this to use the QLabel and place the png in there.

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • D
          dev123 last edited by

          I have the following code:
          QLabel myLabel;
          QPixmap pixmap("pic.png");
          myLabel.setPixmap(pixmap);
          myLabel.setMask(pixmap.mask());

          Now, I want to put myLabel below a particular button. Note that the above reports an error on line myLabel.setMask. What would be the easiest solution?

          1 Reply Last reply Reply Quote 0
          • Jeroentjehome
            Jeroentjehome last edited by

            Hi,
            First of all, the QLabel doesn't have a setMask function, so that will fail. Set the mask on the Pixmap and that should work.
            Do you want to have a button above the icon (use vertical layout)? Of should the icon be the background of the button?? (use borderimage)

            Greetz, Jeroen

            1 Reply Last reply Reply Quote 0
            • First post
              Last post