diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-06-26 13:13:41 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-06-26 13:13:41 (GMT) |
commit | cd561fd7db957879810d0716136d32c117744844 (patch) | |
tree | 91dbe15c9db178082c3ae5c5e37dd895d644703b /src | |
parent | 0af00c3e45af09faab4598725de7f7258211d0f9 (diff) | |
download | Qt-cd561fd7db957879810d0716136d32c117744844.zip Qt-cd561fd7db957879810d0716136d32c117744844.tar.gz Qt-cd561fd7db957879810d0716136d32c117744844.tar.bz2 |
S60Style: Slightly less complex way of drawing the QHeaderView in style.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 794e19f..82b42a6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1802,27 +1802,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, break; case CE_Header: if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QS60StylePrivate::SkinElementFlags adjFlags = flags; - QRect mtyRect = header->rect; - const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - if (header->orientation == Qt::Horizontal) { - if (header->position == QStyleOptionHeader::OnlyOneSection) - mtyRect.adjust(frameWidth,1,frameWidth,-frameWidth); - else - mtyRect.adjust(-frameWidth,1,frameWidth,-frameWidth); - } else { - if ( header->direction == Qt::LeftToRight ) { - mtyRect.adjust(1,-frameWidth,0,frameWidth); - adjFlags |= QS60StylePrivate::SF_PointWest; - } else { - mtyRect.adjust(-1,frameWidth,0,-frameWidth); - adjFlags |= QS60StylePrivate::SF_PointEast; - } - } - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags); - - QRegion clipRegion = painter->clipRegion(); - painter->setClipRect(option->rect); drawControl(CE_HeaderSection, header, painter, widget); QStyleOptionHeader subopt = *header; subopt.rect = subElementRect(SE_HeaderLabel, header, widget); @@ -1832,7 +1811,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, subopt.rect = subElementRect(SE_HeaderArrow, option, widget); drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); } - painter->setClipRegion(clipRegion); } break; #ifndef QT_NO_TOOLBAR @@ -1881,9 +1859,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_ShapedFrame: if (qobject_cast<const QTextEdit *>(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags); - } else if (qobject_cast<const QAbstractScrollArea *>(widget) && qobject_cast<const QTableView *>(widget)) { + } else if (qobject_cast<const QTableView *>(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags); + } else if (const QHeaderView *header = qobject_cast<const QHeaderView *>(widget)) { + if (header->orientation() == Qt::Horizontal) { + QRect headerRect = option->rect; + const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + headerRect.adjust(0,frameWidth,-2*frameWidth,0); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags); + } else { + //todo: update to horizontal table graphic + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest); } + } if (option->state & State_HasFocus) drawPrimitive(PE_FrameFocusRect, option, painter, widget); break; |