diff options
| author | Fushan Wen <[email protected]> | 2021-12-28 00:51:10 +0800 |
|---|---|---|
| committer | Fushan Wen <[email protected]> | 2021-12-28 22:48:28 +0800 |
| commit | eb0a7da653493db272ee6039d5202c5702acffc3 (patch) | |
| tree | c0d630e5123d546d6c244a362b6eb53c141435ff /src/kitemviews/kitemlistview.h | |
| parent | c071150b7d30c8826496f130b792aed47d4f8326 (diff) | |
kitemlistview: Port KItemListView::itemAt to std::optional
Use `value_or(-1)` for those functions that don't use `std::optional`.
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 404cf320f..cbb178119 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -9,6 +9,8 @@ #ifndef KITEMLISTVIEW_H #define KITEMLISTVIEW_H +#include <optional> + #include "dolphin_export.h" #include "kitemviews/kitemliststyleoption.h" #include "kitemviews/kitemlistwidget.h" @@ -160,10 +162,10 @@ public: * @return Index of the item that is below the point \a pos. * The position is relative to the upper right of * the visible area. Only (at least partly) visible - * items are considered. -1 is returned if no item is - * below the position. + * items are considered. std::nullopt is returned if + * no item is below the position. */ - int itemAt(const QPointF& pos) const; + std::optional<int> itemAt(const QPointF& pos) const; bool isAboveSelectionToggle(int index, const QPointF& pos) const; bool isAboveExpansionToggle(int index, const QPointF& pos) const; bool isAboveText(int index, const QPointF& pos) const; |
