X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/bc4e59dc39fedcbb323c48942f8c0fd85d75f270..711d1c0f0d3cde02cd431d145494b3ef68df4916:/src/iconmanager.cpp diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index 6cf6f001c..ab854d738 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -462,29 +462,23 @@ bool IconManager::applyImageFrame(QPixmap& icon) // add a border painter.setPen(palette.color(QPalette::Text)); - painter.setBrush(Qt::NoBrush); painter.drawRect(0, 0, width, height); painter.drawRect(1, 1, width - 2, height - 2); - - // dim image frame by 12.5 % - painter.setPen(QColor(0, 0, 0, 32)); - painter.drawRect(frame, frame, width - doubleFrame, height - doubleFrame); + + painter.setCompositionMode(QPainter::CompositionMode_Plus); + QColor blendColor = palette.color(QPalette::Normal, QPalette::Base); + + blendColor.setAlpha(255 - 32); + painter.setPen(blendColor); + painter.drawRect(0, 0, width, height); + + blendColor.setAlpha(255 - 64); + painter.setPen(blendColor); + painter.drawRect(1, 1, width - 2, height - 2); painter.end(); icon = framedIcon; - // provide an alpha channel for the border - QPixmap alphaChannel(icon.size()); - alphaChannel.fill(); - - QPainter alphaPainter(&alphaChannel); - alphaPainter.setBrush(Qt::NoBrush); - alphaPainter.setPen(QColor(32, 32, 32)); - alphaPainter.drawRect(0, 0, width, height); - alphaPainter.setPen(QColor(64, 64, 64)); - alphaPainter.drawRect(1, 1, width - 2, height - 2); - - icon.setAlphaChannel(alphaChannel); return true; } @@ -562,7 +556,7 @@ void IconManager::orderItems(KFileItemList& items) // check whether the item is part of the item list 'items' int index = -1; for (int i = 0; i < itemCount; ++i) { - if (items[i].url() == url) { + if (items.at(i).url() == url) { index = i; break; } @@ -582,7 +576,7 @@ void IconManager::orderItems(KFileItemList& items) // Algorithm 2: The number of items is <= 10 % of the row count. In this case iterate // all items and receive the corresponding row from the item. for (int i = 0; i < itemCount; ++i) { - const QModelIndex dirIndex = m_dirModel->indexForItem(items[i]); // O(n) (n = number of rows) + const QModelIndex dirIndex = m_dirModel->indexForItem(items.at(i)); // O(n) (n = number of rows) const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); const QRect itemRect = m_view->visualRect(proxyIndex); @@ -590,7 +584,7 @@ void IconManager::orderItems(KFileItemList& items) // The current item is (at least partly) visible. Move it // to the front of the list, so that the preview is // generated earlier. - items.insert(insertPos, items[i]); + items.insert(insertPos, items.at(i)); items.removeAt(i + 1); ++insertPos; ++m_pendingVisiblePreviews;