X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/da7ccef4886df64913b8a6a4bc14cfdb06067325..cebcf8db:/src/kitemviews/kitemlistview.h diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 6c3d3648d..8812eb8cc 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -21,6 +21,8 @@ #include #include +class KItemListContainer; +class KItemListContainerAccessible; class KItemListController; class KItemListGroupHeaderCreatorBase; class KItemListHeader; @@ -53,10 +55,13 @@ class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget { Q_OBJECT - Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset) - Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset) + Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset NOTIFY scrollOffsetChanged) + 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; @@ -142,6 +147,18 @@ public: void setGroupHeaderCreator(KItemListGroupHeaderCreatorBase *groupHeaderCreator); KItemListGroupHeaderCreatorBase *groupHeaderCreator() const; +#ifndef QT_NO_ACCESSIBILITY + /** + * Uses \a parent to create an accessible object for \a parent. That accessible object will + * then be used as the accessible parent of the accessible object for this KItemListView. + * Make sure \a parent is the container which contains this specific KItemListView. + * This method must be called once before the accessible interface is queried for this class. + */ + void setAccessibleParentsObject(KItemListContainer *accessibleParentsObject); + /** The parent of the QAccessibilityInterface of this class. */ + KItemListContainerAccessible *accessibleParent(); +#endif + /** * @return The basic size of all items. The size of an item may be larger than * the basic size (see KItemListView::itemRect()). @@ -237,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 @@ -711,6 +729,10 @@ private: QList m_visibleRoles; mutable KItemListWidgetCreatorBase *m_widgetCreator; mutable KItemListGroupHeaderCreatorBase *m_groupHeaderCreator; +#ifndef QT_NO_ACCESSIBILITY + /** The object that will be the parent of this classes QAccessibleInterface. */ + KItemListContainerAccessible *m_accessibleParent = nullptr; +#endif KItemListStyleOption m_styleOption; QHash m_visibleItems;