Displaying a logo at a particular position
-
wrote on 25 Sept 2014, 07:57 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. -
wrote on 25 Sept 2014, 08:27 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.
-
wrote on 25 Sept 2014, 09:40 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?
-
wrote on 25 Sept 2014, 12:52 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)
4/4