summary refs log tree commit diff
path: root/src/ui/NhekoCursorShape.cpp
blob: 76a5e097594ea8f6cbfbb2efc916084e64e85bd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "NhekoCursorShape.h"

#include <QCursor>

NhekoCursorShape::NhekoCursorShape(QQuickItem *parent)
  : QQuickItem(parent)
  , currentShape_(Qt::CursorShape::ArrowCursor)
{
}

Qt::CursorShape
NhekoCursorShape::cursorShape() const
{
    return cursor().shape();
}

void
NhekoCursorShape::setCursorShape(Qt::CursorShape cursorShape)
{
    if (currentShape_ == cursorShape)
        return;

    currentShape_ = cursorShape;
    setCursor(cursorShape);
    emit cursorShapeChanged();
}