┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-10-19 18:03:12 +0200
committerFelix Ernst <[email protected]>2022-10-27 09:40:03 +0000
commit9478f1473006147c643c228793822b2eeb4b0606 (patch)
treed2a3d5adeba1a4052ccaa2ff6c3bd54672c4a5cd /src/kitemviews
parent3590619391ada4bc98182f385dcde605077383df (diff)
Make details view mode's full row activation optional
In d3839617193e92463806580699caa595c892b8a6 the details view mode was changed in a way that made the full row of an item the click target instead of only having the item's icon and text be the representative clickable area of an item. This commit makes this new behaviour optional through a setting which can be changed in Dolphin's settings dialog. The explanation for introducing yet another setting in this case is as follows: While the introduced change is an improvement for many typical workflows, there are some workflows for which this new behaviour is problematic. Quite prominently a usage of Dolphin that tries to maximise information density is made worse by the change because now side padding is necessary to click the view's background. While the side padding is and was optional, disabling it made switching the active view in split view mode more difficult among other things. For a more complete discussion about the issues, please check out the bug report(s) and the discussion in Dolphin's gitlab issue with number 34. Co-authored-by: Ivan Čukić <[email protected]> BUG: 453700 FIXED-IN: 22.12
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kstandarditemlistview.cpp7
-rw-r--r--src/kitemviews/kstandarditemlistview.h2
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp1
3 files changed, 9 insertions, 1 deletions
diff --git a/src/kitemviews/kstandarditemlistview.cpp b/src/kitemviews/kstandarditemlistview.cpp
index 4b7c2d9a4..0ba23e654 100644
--- a/src/kitemviews/kstandarditemlistview.cpp
+++ b/src/kitemviews/kstandarditemlistview.cpp
@@ -36,7 +36,7 @@ void KStandardItemListView::setItemLayout(ItemLayout layout)
m_itemLayout = layout;
// keep the leading padding option unchanged here
- setHighlightEntireRow(layout == DetailsLayout);
+ setHighlightEntireRow(itemLayoutHighlightEntireRow(layout));
setSupportsItemExpanding(itemLayoutSupportsItemExpanding(layout));
setScrollOrientation(layout == CompactLayout ? Qt::Horizontal : Qt::Vertical);
@@ -93,6 +93,11 @@ bool KStandardItemListView::itemSizeHintUpdateRequired(const QSet<QByteArray>& c
return false;
}
+bool KStandardItemListView::itemLayoutHighlightEntireRow(ItemLayout layout) const
+{
+ return layout == DetailsLayout;
+}
+
bool KStandardItemListView::itemLayoutSupportsItemExpanding(ItemLayout layout) const
{
return layout == DetailsLayout;
diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h
index 7f0550ec3..527d14b9d 100644
--- a/src/kitemviews/kstandarditemlistview.h
+++ b/src/kitemviews/kstandarditemlistview.h
@@ -50,6 +50,8 @@ protected:
void initializeItemListWidget(KItemListWidget* item) override;
bool itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const override;
virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const;
+ /** To be overriden by sub-classes to specify when full row highlighting should be enabled. */
+ virtual bool itemLayoutHighlightEntireRow(ItemLayout layout) const;
virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous);
void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous) override;
void onSupportsItemExpandingChanged(bool supportsExpanding) override;
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 9a2939b23..67afbb248 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -241,6 +241,7 @@ KStandardItemListWidget::KStandardItemListWidget(KItemListWidgetInformant* infor
m_customizedFont(),
m_customizedFontMetrics(m_customizedFont),
m_isExpandable(false),
+ m_highlightEntireRow(false),
m_supportsItemExpanding(false),
m_dirtyLayout(true),
m_dirtyContent(true),