| 1 | // SPDX-FileCopyrightText: Nheko Contributors |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #include "NhekoCursorShape.h" |
| 6 | |
| 7 | #include <QCursor> |
| 8 | |
| 9 | NhekoCursorShape::NhekoCursorShape(QQuickItem *parent) |
| 10 | : QQuickItem(parent) |
| 11 | , currentShape_(Qt::CursorShape::ArrowCursor) |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | Qt::CursorShape |
| 16 | NhekoCursorShape::cursorShape() const |
| 17 | { |
| 18 | return cursor().shape(); |
| 19 | } |
| 20 | |
| 21 | void |
| 22 | NhekoCursorShape::setCursorShape(Qt::CursorShape cursorShape) |
| 23 | { |
| 24 | if (currentShape_ == cursorShape) |
| 25 | return; |
| 26 | |
| 27 | currentShape_ = cursorShape; |
| 28 | setCursor(cursorShape); |
| 29 | emit cursorShapeChanged(); |
| 30 | } |
| 31 | |
| 32 | #include "moc_NhekoCursorShape.cpp" |