┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.h
diff options
context:
space:
mode:
authorAmol Godbole <[email protected]>2023-10-13 21:08:35 -0500
committerMéven Car <[email protected]>2023-10-17 15:47:34 +0000
commita59d9f85fa770a00d10e66025e102c736e18fa70 (patch)
tree9f19443512de2c0adc1fa75082ba27495188ca3f /src/kitemviews/kitemlistview.h
parentd1035e7f090a5c810e72e37a03df81b2a4389747 (diff)
KItemListView: add view position in scrollToItem()
An item, on being scrolled to, is always located at the nearest edge of the view. This is not always convenient. Allow specifying where the item should be positioned with respect to the view in scrollToItem(). BUG: 423884
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
-rw-r--r--src/kitemviews/kitemlistview.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 7bcaec704..8812eb8cc 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -59,6 +59,9 @@ class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget
Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset NOTIFY itemOffsetChanged)
public:
+ /** The position in the view to which an item should be scrolled to. */
+ enum ViewItemPosition { Beginning, Middle, End, Nearest };
+
explicit KItemListView(QGraphicsWidget *parent = nullptr);
~KItemListView() override;
@@ -251,9 +254,10 @@ public:
/**
* Scrolls to the item with the index \a index so that the item
- * will be fully visible.
+ * will be fully visible. The item is positioned within the view
+ * as specified by \a viewItemPosition.
*/
- void scrollToItem(int index);
+ void scrollToItem(int index, ViewItemPosition viewItemPosition = ViewItemPosition::Nearest);
/**
* If several properties of KItemListView are changed synchronously, it is