KDE/kdelibs/kdeui/itemviews
Rafael Fernández López
ereslibre at kde.org
Tue Aug 4 17:57:03 BST 2009
SVN commit 1006883 by ereslibre:
Implement partial support for model->flags()
CCMAIL: kde-core-devel at kde.org
CCMAIL: sourtooth at gmail.com
M +8 -2 kcategorizedview.cpp
--- trunk/KDE/kdelibs/kdeui/itemviews/kcategorizedview.cpp #1006882:1006883
@@ -772,6 +772,7 @@
const bool alternateItem = (i - block->firstIndex.row()) % 2;
const QModelIndex index = d->proxyModel->index(i, modelColumn(), rootIndex());
+ const Qt::ItemFlags flags = d->proxyModel->flags(index);
QStyleOptionViewItemV4 option(viewOptions());
option.rect = visualRect(index);
option.widget = this;
@@ -781,10 +782,15 @@
: QStyleOptionViewItemV4::None;
option.state |= (index == d->hoveredIndex) ? QStyle::State_MouseOver
: QStyle::State_None;
- option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected
- : QStyle::State_None;
+ if (flags & Qt::ItemIsSelectable) {
+ option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected
+ : QStyle::State_None;
+ }
option.state |= (index == currentIndex()) ? QStyle::State_HasFocus
: QStyle::State_None;
+ if (!(flags & Qt::ItemIsEnabled)) {
+ option.state &= ~QStyle::State_Enabled;
+ }
itemDelegate(index)->paint(&p, option, index);
++i;
}
More information about the kde-core-devel
mailing list