[Qt-interest] Changing font size in QTableWidgetItem

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Jan 20 02:13:37 CET 2009


Why not set the font role on the model? 

Of course you would need a custom model, but if you can get away with a
tablewidget the model wont be too complex.
SCott
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Paul England
> Sent: Monday, January 19, 2009 3:21 PM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] Changing font size in QTableWidgetItem
> 
> Hi
> 
> Trying to change the font size of a QTableWidget (well, the
> QTableWidgetItems in the QTableWidget).
> Something like this works, but is painfully slow:
> 
> QFont f( "Tahoma", 10, QFont::Bold );
> my_table->item( row, col )->setFont( f );
> 
> For a table of 18 rows and about 40-50 columns,  it takes a few
seconds
> to update.
> I tried this:
> tbl_main->item( row, col )->font().setPointSize( font_size );
> 
> Doesn't really work, unfortunately.  Do I have to repaint it or
something?
> 
> Thanks
> Paul
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list