Hans
6th February 2013, 23:55
I had a class MyTable inherited from Q3Table.
I want to highlight the cell that's clicked by mouse by adding a red rectangular around the cell's bundary.
So I re-implemented paintFocus(QPainter * p, const QRect & cr) like this:
void MyTable::paintFocus ( QPainter * painter, const QRect & cr )
{
Q3Table::paintFocus(painter,cr);
painter->setPen(QPen(QColor(155,10,10), 2));
QRect highlight_rect = cr.adjusted(2,2, -2, -2);
painter->drawRect(highlight_rect);
update();
}
But the red Rect only appear for the first column in the first row. When clicking other cells, just the default black frame.
Why????????
8685 8686
I want to highlight the cell that's clicked by mouse by adding a red rectangular around the cell's bundary.
So I re-implemented paintFocus(QPainter * p, const QRect & cr) like this:
void MyTable::paintFocus ( QPainter * painter, const QRect & cr )
{
Q3Table::paintFocus(painter,cr);
painter->setPen(QPen(QColor(155,10,10), 2));
QRect highlight_rect = cr.adjusted(2,2, -2, -2);
painter->drawRect(highlight_rect);
update();
}
But the red Rect only appear for the first column in the first row. When clicking other cells, just the default black frame.
Why????????
8685 8686