Hi,
I want to display text on a QPushButton with image at center. The image is displayed properly but the text is displayed left aligned or right aligned, hoe to place it on center of the QPushButtton Image.
Any suggestions!
Thanks.
Hi,
I want to display text on a QPushButton with image at center. The image is displayed properly but the text is displayed left aligned or right aligned, hoe to place it on center of the QPushButtton Image.
Any suggestions!
Thanks.
Can you paste your code, some one might able to help.
http://kunalmaemo.blogspot.com/
Hi,
You can place the text at the center of the QPushButton Image using setStyleSheet() method.
Please try the following code snippet:
QPushButton *m_button = new QPushButton("My Button", this);
m_button->setStyleSheet("background-image: url(:/PngTest.png);"
"background-repeat: no-repeat;"
"background-position: center center");
The above snippet will set the text at the center on the QPushButton Image.
Hope this information solves your issue.
--Mayura.