diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-22 14:33:09 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-22 14:33:09 (GMT) |
commit | a8b0c84daf6cba6d557245954568b32cb690583f (patch) | |
tree | e2552c2919d88a7a3046def7fba8722d13257ada | |
parent | 3c6166983d07b6e81992b8a6080942041e37f615 (diff) | |
download | Qt-a8b0c84daf6cba6d557245954568b32cb690583f.zip Qt-a8b0c84daf6cba6d557245954568b32cb690583f.tar.gz Qt-a8b0c84daf6cba6d557245954568b32cb690583f.tar.bz2 |
S60Style: If table has defined a new background brush use that instead of drawing themed background.
-rw-r--r-- | src/gui/styles/qs60style.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a13f396..baaab59 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -213,6 +213,8 @@ void QS60StylePrivate::refreshUI() { foreach (QWidget *topLevelWidget, QApplication::allWidgets()) { topLevelWidget->updateGeometry(); + //todo: study how we can get rid of this. Apparently scrollbars cache pixelmetrics values, and we need them to update themselves + // maybe styleChanged event is enough? QCoreApplication::postEvent(topLevelWidget, new QResizeEvent(topLevelWidget->size(), topLevelWidget->size())); } } @@ -1334,21 +1336,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget); QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget); - // draw the background - const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); - const QTableView *table = qobject_cast<const QTableView *>(widget); - if (table && tableOption) { - 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 themed background for table unless background brush has been defined. + if (vopt->backgroundBrush == Qt::NoBrush) { + // draw the background + const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option); + const QTableView *table = qobject_cast<const QTableView *>(widget); + if (table && tableOption) { + 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); + } + } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, option, painter, widget);} // draw the focus rect if (isSelected) |