请问lanfe:
你在帖子中说“QTable头文件中定义
virtual void paintCell( QPainter *p, int row, int col,const QRect &cr, bool selected, const QColorGroup &cg );
你可以继承QTable,然后重写paintCell函数
QColorGroup g1( cg );
if (selected==false)
g1.setColor( QColorGroup::Base, QColor(210,230,230) );
QTable::paintCell(p, row, col, cr, selected, g1);”
我的问题是:我可以直接调用该函数吗?
若可以,调用virtual void paintCell( QPainter *p, int row, int col,const QRect &cr, bool selected, const QColorGroup &cg )时cr该传递什么值?
注:提出第一个问题的原因:paintCell好像是有QTable中的( int row, int col, QTableItem * item )间接调用的,因为void QTable::setItem ( int row, int col, QTableItem * item ) [virtual] 函数的说明文档是
Inserts the table item item into the table at row row, column col, and repaints the cell. If a table item already exists in this cell it is deleted and replaced with item. The table takes ownership of the table item.
If you don't use QTableItems you may need to reimplement this function: see the notes on large tables.
因此,我认为我们作为用户,不用直接调用paintCell函数