- // indicate the shown URL of the next column by highlighting the shown folder item
- const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
- const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
- const QModelIndex dirIndex = dirModel->indexForUrl(m_childUrl);
- const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
- if (proxyIndex.isValid()) {
- const QRect itemRect = visualRect(proxyIndex);
- QPainter painter(viewport());
- painter.save();
-
- QColor color = KColorScheme(KColorScheme::View).foreground();
- color.setAlpha(32);
- painter.setPen(Qt::NoPen);
- painter.setBrush(color);
- painter.drawRect(itemRect);
-
- painter.restore();
+ if (!m_childUrl.isEmpty()) {
+ // indicate the shown URL of the next column by highlighting the shown folder item
+ const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
+ const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
+ const QModelIndex dirIndex = dirModel->indexForUrl(m_childUrl);
+ const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
+ if (proxyIndex.isValid() && !selectionModel()->isSelected(proxyIndex)) {
+ const QRect itemRect = visualRect(proxyIndex);
+ QPainter painter(viewport());
+ painter.save();
+
+ QColor color = KColorScheme(KColorScheme::View).foreground();
+ color.setAlpha(32);
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(color);
+ painter.drawRect(itemRect);
+
+ painter.restore();
+ }