View Full Version : Q3listbox center items
sreedhar
24th February 2006, 10:24
Hi,
i am using Qt4.1. I have a Q3ListBox, and i want to align the items in the box, to the right or to the center.
Please reply me.
regards,
sree
jpn
24th February 2006, 10:40
Inherit Q3ListBoxItem and override:
void Q3ListBoxItem::paint ( QPainter * p ) [pure virtual protected]
In paint(), you can draw aligned text with:
void QPainter::drawText ( const QRectF & rectangle, const QString & text, const QTextOption & option = QTextOption() )
by supplying a QTextOption whose text aligment has been set to your like.
sreedhar
24th February 2006, 11:19
Thanks a lot it works fine
sreedhar
24th February 2006, 11:21
The same can be done also with
void QPainter::drawText ( const QRect & r, int flags, const QString & str, QRect * br = 0 )
where the flags can be used for alignment
sree
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.