- if (m_model == model) {
- return;
- }
-
- if (m_model) {
- disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- }
-
- m_model = model;
-
- if (m_model) {
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- }
-}
-
-KItemModelBase* KItemListHeader::model() const
-{
- return m_model;
-}
-
-void KItemListHeader::setVisibleRoles(const QList<QByteArray>& roles)
-{
- m_visibleRoles = roles;
- update();
-}
-
-QList<QByteArray> KItemListHeader::visibleRoles() const
-{
- return m_visibleRoles;
-}
-
-void KItemListHeader::setVisibleRolesWidths(const QHash<QByteArray, qreal> rolesWidths)
-{
- m_visibleRolesWidths = rolesWidths;
-
- // Assure that no width is smaller than the minimum allowed width
- const qreal minWidth = minimumRoleWidth();
- QMutableHashIterator<QByteArray, qreal> it(m_visibleRolesWidths);
- while (it.hasNext()) {
- it.next();
- if (it.value() < minWidth) {
- m_visibleRolesWidths.insert(it.key(), minWidth);