+QRectF KFileItemListWidget::textFocusRect() const
+{
+ const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing();
+ if (m_layout == CompactLayout) {
+ // In the compact layout a larger textRect() is returned to be aligned
+ // with the iconRect(). This is useful to have a larger selection/hover-area
+ // when having a quite large icon size but only one line of text. Still the
+ // focus rectangle should be shown as narrow as possible around the text.
+ QRectF rect = m_textRect;
+ const TextInfo* topText = m_textInfo.value(m_sortedVisibleRoles.first());
+ const TextInfo* bottomText = m_textInfo.value(m_sortedVisibleRoles.last());
+ rect.setTop(topText->pos.y());
+ rect.setBottom(bottomText->pos.y() + bottomText->staticText.size().height());
+ return rect;
+ }
+ return m_textRect;
+}
+