diff options
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 4 | ||||
| -rw-r--r-- | src/panels/places/placespanel.h | 4 |
2 files changed, 5 insertions, 3 deletions
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<QUrl>(); + const QUrl url = m_model->data(m_hoveredIndex.value_or(-1)).value("url").value<QUrl>(); const QString text = url.toDisplayString(QUrl::PreferLocalFile); QToolTip::showText(m_hoverPos, text); } diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index ce28c8c08..e19447cbf 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -8,6 +8,8 @@ #ifndef PLACESPANEL_H #define PLACESPANEL_H +#include <optional> + #include "panels/panel.h" #include <QUrl> @@ -93,7 +95,7 @@ private: QMimeData* m_itemDropEventMimeData; QDropEvent* m_itemDropEvent; QTimer m_tooltipTimer; - int m_hoveredIndex; + std::optional<int> m_hoveredIndex; QPoint m_hoverPos; }; |
