diff options
| author | Peter Penz <[email protected]> | 2008-10-15 21:23:42 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-10-15 21:23:42 +0000 |
| commit | 994095076cccdb703b2bb285d4118bd9c654fd93 (patch) | |
| tree | e995c1e81df37ff024c01d1a84765b9b48e6baeb /src/dolphindetailsview.cpp | |
| parent | d6a2d5594fc7dd95e0b4d6c993672de706d3bba5 (diff) | |
Assure that the item delegate draws the hover effect and the selection for the details view only above the icon + name. Open issue: The performance when selecting files by the rubberband is too slow (will be fixed before KDE 4.2).
CCBUG: 165999
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=871874
Diffstat (limited to 'src/dolphindetailsview.cpp')
| -rw-r--r-- | src/dolphindetailsview.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 045ea6a6a..08eef4307 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -22,6 +22,7 @@ #include "dolphinmodel.h" #include "dolphincontroller.h" +#include "dolphinfileitemdelegate.h" #include "dolphinsettings.h" #include "dolphinsortfilterproxymodel.h" #include "draganddrophelper.h" @@ -737,19 +738,14 @@ void DolphinDetailsView::resizeColumns() QRect DolphinDetailsView::nameColumnRect(const QModelIndex& index) const { - // TODO: The code guesses the width of the name, but it is defined - // by KFileItemDelegate. Find a way to tell the item delegate to - // use a specified width. - QRect guessedItemContentRect = visualRect(index); - const KFileItem fileItem = m_controller->itemForIndex(index); - if (!fileItem.isNull()) { - QStyleOptionViewItem itemStyle = viewOptions(); - QFontMetrics fontMetrics(itemStyle.font); - const int itemContentWidth = itemStyle.decorationSize.width() + fontMetrics.width(fileItem.name()); - guessedItemContentRect.setWidth(itemContentWidth); + QRect rect = visualRect(index); + const KFileItem item = m_controller->itemForIndex(index); + if (!item.isNull()) { + const int width = DolphinFileItemDelegate::nameColumnWidth(item.name(), viewOptions()); + rect.setWidth(width); } - return guessedItemContentRect; + return rect; } void DolphinDetailsView::setSelectionRecursive(const QModelIndex& startIndex, |
