nheko/src/ui/NhekoCursorShape.cpp

30 lines
587 B
C++
Raw Normal View History

2021-03-05 00:35:15 +01:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
2021-02-14 01:28:28 +01:00
#include "NhekoCursorShape.h"
#include <QCursor>
NhekoCursorShape::NhekoCursorShape(QQuickItem *parent)
: QQuickItem(parent)
, currentShape_(Qt::CursorShape::ArrowCursor)
{}
Qt::CursorShape
NhekoCursorShape::cursorShape() const
{
2021-09-18 00:22:33 +02:00
return cursor().shape();
2021-02-14 01:28:28 +01:00
}
void
NhekoCursorShape::setCursorShape(Qt::CursorShape cursorShape)
{
2021-09-18 00:22:33 +02:00
if (currentShape_ == cursorShape)
return;
2021-02-14 01:28:28 +01:00
2021-09-18 00:22:33 +02:00
currentShape_ = cursorShape;
setCursor(cursorShape);
emit cursorShapeChanged();
2021-02-14 01:28:28 +01:00
}