[Qt-interest] How to set text and icon in an overlaid fashion to a QPushButton
Andre Somers
andre at familiesomers.nl
Wed Apr 28 14:50:53 CEST 2010
On 28-4-2010 14:36, Santhosh Y wrote:
> Hi,
>
> I have a simple query:
>
> For a QPushButton I have added an icon and while trying to set the
> text, it is not shown on top of the icon instead it is showing
> right to the icon.
>
> I am using Qt-designer
>
> Thing I am trying is, for a QPushButton I want to set an icon as
> background and on top of it I want to write/set text to it (In a
> overlaid fashion)
> Please find the attached 2-images with the mail
One way of doing this, would be to load the image you want to draw on
into a QPixmap. Open a painter on your QPixmap, and paint the text over
it. Then put the pixmap on the pushbutton as it's icon.
Note, I did not try this.
André
More information about the Qt-interest-old
mailing list