diff --git a/lib/thumbnailview/previewitemdelegate.cpp b/lib/thumbnailview/previewitemdelegate.cpp --- a/lib/thumbnailview/previewitemdelegate.cpp +++ b/lib/thumbnailview/previewitemdelegate.cpp @@ -80,6 +80,7 @@ /** How darker is the border line around selection */ const int SELECTION_BORDER_DARKNESS = 140; +const int CURRENT_ITEM_BORDER_DARKNESS = 200; /** Radius of the selection rounded corners, in pixels */ const int SELECTION_RADIUS = 5; @@ -687,6 +688,8 @@ QRect rect = option.rect; const bool selected = option.state & QStyle::State_Selected; const bool underMouse = option.state & QStyle::State_MouseOver; + const bool hasFocus = option.state & QStyle::State_HasFocus; + const QWidget* viewport = d->mView->viewport(); #ifdef DEBUG_DRAW_BORDER @@ -708,13 +711,21 @@ // Select colors QColor bgColor, borderColor, fgColor; - if (selected || underMouse) { + if (selected) { + bgColor = option.palette.color(cg, QPalette::Highlight); + borderColor = bgColor.dark(SELECTION_BORDER_DARKNESS); + } else if (underMouse) { bgColor = option.palette.color(cg, QPalette::Highlight); borderColor = bgColor.dark(SELECTION_BORDER_DARKNESS); } else { bgColor = viewport->palette().color(viewport->backgroundRole()); borderColor = bgColor.light(200); } + + if (hasFocus) { + borderColor = bgColor.dark(CURRENT_ITEM_BORDER_DARKNESS); + } + fgColor = viewport->palette().color(viewport->foregroundRole()); // Compute thumbnailRect @@ -729,7 +740,7 @@ if (selected) { d->drawBackground(painter, backgroundRect, bgColor, borderColor); } else if (underMouse) { - painter->setOpacity(0.2); + painter->setOpacity(0.5); d->drawBackground(painter, backgroundRect, bgColor, borderColor); painter->setOpacity(1.); } else if (opaque) { @@ -742,6 +753,13 @@ painter->setRenderHint(QPainter::Antialiasing, false); QRect borderRect = thumbnailRect.adjusted(-1, -1, 0, 0); painter->drawRect(borderRect); + } else if (hasFocus && !selected) { + painter->setPen(borderColor); + painter->setPen(Qt::PenStyle::DotLine); + painter->setRenderHint(QPainter::Antialiasing, false); + QLine underLine = QLine(thumbnailRect.bottomLeft(), thumbnailRect.bottomRight()); + underLine.translate(0, 3); + painter->drawLine(underLine); } painter->drawPixmap(thumbnailRect.left(), thumbnailRect.top(), thumbnailPix);