Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, July 2007
QAbstractButton text size


Message 1 in thread

I am using QPushButton, therefore QAbstractButton. I have
re-implemented paintEvent(QPaintEvent*) to change the color of the
button text as neccesary depending on the returned state of
isChecked().

Is there a way of changing the text size ? I have tried
setText("<h2>99</h2>"); but my 99 is the same size as all the others.

Cheers

Dave






-- 
 [ signature omitted ] 

Message 2 in thread

Hi,
what version of Qt are you using? Have you tried setFont(QFont ( const 
QString & family, int pointSize = -1, int weight = -1, bool italic = false 
))?

Regards,
Ernest

On Sat, 28 Jul 2007, dave selby wrote:

> I am using QPushButton, therefore QAbstractButton. I have
> re-implemented paintEvent(QPaintEvent*) to change the color of the
> button text as neccesary depending on the returned state of
> isChecked().
>
> Is there a way of changing the text size ? I have tried
> setText("<h2>99</h2>"); but my 99 is the same size as all the others.
>
> Cheers
>
> Dave
>
>
>
>
>
>
> -- 
>
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 3 in thread

QFont tmpFont = button->font();
tmpFont->setPointSize(); // tmpFont->setPixelSize(); tmpFont->setBold(); etc.
button->setFont(tmpFont);

you could also just adjust the buttons foreground color on state change, so no 
real reason to reimplement ::paintEvent()

Thomas

Am Samstag, 28. Juli 2007 23:22 schrieb dave selby:
> I am using QPushButton, therefore QAbstractButton. I have
> re-implemented paintEvent(QPaintEvent*) to change the color of the
> button text as neccesary depending on the returned state of
> isChecked().
>
> Is there a way of changing the text size ? I have tried
> setText("<h2>99</h2>"); but my 99 is the same size as all the others.
>
> Cheers
>
> Dave

-- 
 [ signature omitted ]