]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistview.h
KItemListView: add view position in scrollToItem()
[dolphin.git] / src / kitemviews / kitemlistview.h
index 7bcaec704dee9f8316852e7457a66a6f4bcec827..8812eb8cc45d3b9fdb07649daece70f4b83d79f9 100644 (file)
@@ -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