┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private
diff options
context:
space:
mode:
authorAkseli Lahtinen <[email protected]>2025-02-24 18:39:22 +0000
committerAkseli Lahtinen <[email protected]>2025-02-24 18:39:22 +0000
commita27443d904bc220615f2c4e8df74187b0c806d8a (patch)
tree420ff120b30bb2492a363abf9ddf80a8697d3ad9 /src/kitemviews/private
parent69c4792928edef91b5aea06772d02eb0f7c873b4 (diff)
Add smaller statusbar and set it as default
- Statusbar has three modes: Small, FullWidth and Disabled - FullWidth is the original statusbar - Small is the new default statusbar - This statusbar overlays on top of the items instead of taking space - It changes size according to content - Disabled turns statusbar completely off - Zoom slider and space information is only shown in full-width statusbar - Space information is now always on - If user navigates with keyboard, or scrolls to selection, the scrolling will take the statusbar into account - This makes sure the statusbar does not cover any items Related discussion: https://invent.kde.org/system/dolphin/-/issues/50
Diffstat (limited to 'src/kitemviews/private')
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.cpp9
-rw-r--r--src/kitemviews/private/kitemlistviewlayouter.h8
2 files changed, 17 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp
index 99a95d98c..3ed2343a8 100644
--- a/src/kitemviews/private/kitemlistviewlayouter.cpp
+++ b/src/kitemviews/private/kitemlistviewlayouter.cpp
@@ -40,6 +40,7 @@ KItemListViewLayouter::KItemListViewLayouter(KItemListSizeHintResolver *sizeHint
, m_groupHeaderHeight(0)
, m_groupHeaderMargin(0)
, m_itemInfos()
+ , m_statusBarOffset(0)
{
Q_ASSERT(m_sizeHintResolver);
}
@@ -341,6 +342,13 @@ void KItemListViewLayouter::markAsDirty()
m_dirty = true;
}
+void KItemListViewLayouter::setStatusBarOffset(int offset)
+{
+ if (m_statusBarOffset != offset) {
+ m_statusBarOffset = offset;
+ }
+}
+
#ifndef QT_NO_DEBUG
bool KItemListViewLayouter::isDirty()
{
@@ -378,6 +386,7 @@ void KItemListViewLayouter::doLayout()
itemSize.transpose();
itemMargin.transpose();
size.transpose();
+ size.rwidth() -= m_statusBarOffset;
if (grouped) {
// In the horizontal scrolling case all groups are aligned
diff --git a/src/kitemviews/private/kitemlistviewlayouter.h b/src/kitemviews/private/kitemlistviewlayouter.h
index 77d59c947..fed541a4c 100644
--- a/src/kitemviews/private/kitemlistviewlayouter.h
+++ b/src/kitemviews/private/kitemlistviewlayouter.h
@@ -154,6 +154,12 @@ public:
return m_columnCount;
}
+ /**
+ * Set the bottom offset for moving the view so that the small overlayed statusbar
+ * won't cover any items by accident.
+ */
+ void setStatusBarOffset(int offset);
+
#ifndef QT_NO_DEBUG
/**
* @return True if the layouter has been marked as dirty and hence has
@@ -219,6 +225,8 @@ private:
};
QVector<ItemInfo> m_itemInfos;
+ int m_statusBarOffset;
+
friend class KItemListControllerTest;
};