mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
after checking the kdirmodel implementation for setData() and data() this should be a better to apply a gray effect to cut items
svn path=/trunk/KDE/kdebase/apps/; revision=644763
This commit is contained in:
parent
72d4a92e10
commit
84d15b2274
|
@ -753,11 +753,11 @@ void DolphinView::showPreview(const KFileItem* item, const QPixmap& pixmap)
|
||||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||||
if (KonqMimeData::decodeIsCutSelection(mimeData) && isCutItem(*item)) {
|
if (KonqMimeData::decodeIsCutSelection(mimeData) && isCutItem(*item)) {
|
||||||
KIconEffect iconEffect;
|
KIconEffect iconEffect;
|
||||||
QPixmap cutPixmap = iconEffect.apply(pixmap, K3Icon::Desktop, K3Icon::DisabledState);
|
const QPixmap cutPixmap = iconEffect.apply(pixmap, K3Icon::Desktop, K3Icon::DisabledState);
|
||||||
m_dirModel->setData(idx, cutPixmap, Qt::DecorationRole);
|
m_dirModel->setData(idx, QIcon(cutPixmap), Qt::DecorationRole);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_dirModel->setData(idx, pixmap, Qt::DecorationRole);
|
m_dirModel->setData(idx, QIcon(pixmap), Qt::DecorationRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -930,12 +930,15 @@ void DolphinView::updateCutItems()
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
KFileItem* item = *it;
|
KFileItem* item = *it;
|
||||||
if (isCutItem(*item)) {
|
if (isCutItem(*item)) {
|
||||||
QPixmap pixmap = item->pixmap(0);
|
|
||||||
KIconEffect iconEffect;
|
|
||||||
pixmap = iconEffect.apply(pixmap, K3Icon::Desktop, K3Icon::DisabledState);
|
|
||||||
const QModelIndex idx = m_dirModel->indexForItem(*item);
|
const QModelIndex idx = m_dirModel->indexForItem(*item);
|
||||||
if (idx.isValid()) {
|
const QVariant value = m_dirModel->data(idx, Qt::DecorationRole);
|
||||||
m_dirModel->setData(idx, pixmap, Qt::DecorationRole);
|
if (value.type() == QVariant::Icon) {
|
||||||
|
const QIcon icon(qvariant_cast<QIcon>(value));
|
||||||
|
KIconEffect iconEffect;
|
||||||
|
const QPixmap pixmap = iconEffect.apply(icon.pixmap(128, 128),
|
||||||
|
K3Icon::Desktop,
|
||||||
|
K3Icon::DisabledState);
|
||||||
|
m_dirModel->setData(idx, QIcon(pixmap), Qt::DecorationRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
|
Loading…
Reference in a new issue