summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <peter.penz19@gmail.com>2012-03-20 20:03:38 (GMT)
committerPeter Penz <peter.penz19@gmail.com>2012-03-20 20:09:17 (GMT)
commit010699e756d0bb6b8659a65e8af8c08d9c424080 (patch)
tree22b4b4ecff8e7303b227cc17efb10e55afdd12e0
parent00c6dbeb2d688faa1a50867e1c5a853c2874c6a4 (diff)
Bypass crash with Polyester-style
The Polyester style crashes when drawing a header where the parent widget is 0. BUG: 296453 FIXED-IN: 4.8.2
-rw-r--r--dolphin/src/kitemviews/kitemlistheader.cpp7
-rw-r--r--dolphin/src/kitemviews/kitemlistheader_p.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/dolphin/src/kitemviews/kitemlistheader.cpp b/dolphin/src/kitemviews/kitemlistheader.cpp
index bd7dfb8..dfe76bc 100644
--- a/dolphin/src/kitemviews/kitemlistheader.cpp
+++ b/dolphin/src/kitemviews/kitemlistheader.cpp
@@ -141,7 +141,7 @@ void KItemListHeader::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
foreach (const QByteArray& role, m_visibleRoles) {
const qreal roleWidth = m_visibleRolesWidths.value(role);
const QRectF rect(x, 0, roleWidth, size().height());
- paintRole(painter, role, rect, orderIndex);
+ paintRole(painter, role, rect, orderIndex, widget);
x += roleWidth;
++orderIndex;
}
@@ -339,7 +339,8 @@ void KItemListHeader::slotSortOrderChanged(Qt::SortOrder current, Qt::SortOrder
void KItemListHeader::paintRole(QPainter* painter,
const QByteArray& role,
const QRectF& rect,
- int orderIndex) const
+ int orderIndex,
+ QWidget* widget) const
{
// The following code is based on the code from QHeaderView::paintSection().
// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@@ -378,7 +379,7 @@ void KItemListHeader::paintRole(QPainter* painter,
option.selectedPosition = QStyleOptionHeader::NotAdjacent;
option.text = m_model->roleDescription(role);
- style()->drawControl(QStyle::CE_Header, &option, painter);
+ style()->drawControl(QStyle::CE_Header, &option, painter, widget);
}
void KItemListHeader::updatePressedRoleIndex(const QPointF& pos)
diff --git a/dolphin/src/kitemviews/kitemlistheader_p.h b/dolphin/src/kitemviews/kitemlistheader_p.h
index 56f80c9..364a5f1 100644
--- a/dolphin/src/kitemviews/kitemlistheader_p.h
+++ b/dolphin/src/kitemviews/kitemlistheader_p.h
@@ -94,7 +94,11 @@ private slots:
void slotSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous);
private:
- void paintRole(QPainter* painter, const QByteArray& role, const QRectF& rect, int orderIndex) const;
+ void paintRole(QPainter* painter,
+ const QByteArray& role,
+ const QRectF& rect,
+ int orderIndex,
+ QWidget* widget = 0) const;
void updatePressedRoleIndex(const QPointF& pos);
void updateHoveredRoleIndex(const QPointF& pos);