From eb0a7da653493db272ee6039d5202c5702acffc3 Mon Sep 17 00:00:00 2001 From: Fushan Wen Date: Tue, 28 Dec 2021 00:51:10 +0800 Subject: kitemlistview: Port KItemListView::itemAt to std::optional Use `value_or(-1)` for those functions that don't use `std::optional`. --- src/panels/places/placespanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/panels/places/placespanel.cpp') diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index b9fc4a897..4d95c08eb 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -221,7 +221,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) if (!isDevice) { menu.addSeparator(); } - + if (isDevice) { ejectAction = m_model->ejectAction(index); if (ejectAction) { @@ -511,7 +511,7 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success) void PlacesPanel::slotShowTooltip() { - const QUrl url = m_model->data(m_hoveredIndex).value("url").value(); + const QUrl url = m_model->data(m_hoveredIndex.value_or(-1)).value("url").value(); const QString text = url.toDisplayString(QUrl::PreferLocalFile); QToolTip::showText(m_hoverPos, text); } -- cgit v1.3