Displaying a logo at a particular position



  • 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.



  • 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.



  • 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?



  • 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)


Log in to reply
 

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