diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-05 12:12:58 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-05 12:12:58 (GMT) |
commit | 649b31e1222f551021739f71a5cc468f7df80e1c (patch) | |
tree | 45246055ceb87ba8b9cb1e71eb04930b0839e9aa /src/gui/styles/qs60style.cpp | |
parent | 28c8b38a30331fb78dab39aa069a2a717c3b1988 (diff) | |
download | Qt-649b31e1222f551021739f71a5cc468f7df80e1c.zip Qt-649b31e1222f551021739f71a5cc468f7df80e1c.tar.gz Qt-649b31e1222f551021739f71a5cc468f7df80e1c.tar.bz2 |
S60Style: intersect QTable background graphics with viewPort rect.
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index fb76b09..87353f9 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1225,18 +1225,16 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); const QTableView *table = qobject_cast<const QTableView *>(widget); if (table && tableOption) { - const QModelIndex indexCurrent = tableOption->index; - // Draw cell background only once - for the first cell - //todo: calc area based on viewport only so that 1000x1000 table doesn't get ridiculously big background - //todo: try to do this only once. For some reason, if I try to - //if ( indexCurrent.column() == 2 && indexCurrent.row() == 2 ) { - QStyleOptionViewItemV4 voptAdj2 = voptAdj2; - const QModelIndex index = table->model()->index(0,0); - const QModelIndex indexLast = table->model()->index( - table->model()->rowCount()-1,table->model()->columnCount()-1); - voptAdj2.rect = QRect( table->visualRect(index).topLeft(), table->visualRect(indexLast).bottomRight()); - drawPrimitive(PE_PanelItemViewItem, &voptAdj2, painter, widget); - //} + const QModelIndex index = tableOption->index; + //todo: Draw cell background only once - for the first cell. + QStyleOptionViewItemV4 voptAdj2 = voptAdj2; + const QModelIndex indexFirst = table->model()->index(0,0); + const QModelIndex indexLast = table->model()->index( + table->model()->rowCount()-1,table->model()->columnCount()-1); + if (table->viewport()) + voptAdj2.rect = QRect( table->visualRect(indexFirst).topLeft(), + table->visualRect(indexLast).bottomRight()).intersect(table->viewport()->rect()); + drawPrimitive(PE_PanelItemViewItem, &voptAdj2, painter, widget); } // draw the focus rect |