diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 1d3d88bea3a..4d540c5db76 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -74,7 +74,7 @@ QWaylandCursorTheme::~QWaylandCursorTheme() wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) { - if (struct wl_cursor *cursor = m_cursors.value(shape, nullptr)) + if (struct wl_cursor *cursor = m_cursors[shape]) return cursor; static Q_CONSTEXPR struct ShapeAndName { @@ -206,7 +206,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) ShapeAndName{shape, ""}, byShape); for (auto it = p.first; it != p.second; ++it) { if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, it->name)) { - m_cursors.insert(shape, cursor); + m_cursors[shape] = cursor; return cursor; } } diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 751ffa68b71..3e5cff9bca1 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -109,13 +109,15 @@ private: ResizeNorthWestCursor, ResizeSouthEastCursor, ResizeNorthEastCursor, - ResizeSouthWestCursor + ResizeSouthWestCursor, + + NumWaylandCursors }; explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {} struct ::wl_cursor *requestCursor(WaylandCursor shape); struct ::wl_cursor_theme *m_theme = nullptr; - QMap m_cursors; + wl_cursor *m_cursors[NumWaylandCursors] = {}; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor