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;
}
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).
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)
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);