2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2015-04-09 14:10:35 +02:00
|
|
|
|
|
|
|
|
#include "overridecursor.h"
|
|
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
OverrideCursor::OverrideCursor(const QCursor &cursor)
|
2018-07-23 10:45:40 +02:00
|
|
|
: m_cursor(cursor)
|
2015-04-09 14:10:35 +02:00
|
|
|
{
|
|
|
|
|
QApplication::setOverrideCursor(cursor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OverrideCursor::~OverrideCursor()
|
|
|
|
|
{
|
|
|
|
|
if (m_set)
|
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OverrideCursor::set()
|
|
|
|
|
{
|
|
|
|
|
if (!m_set) {
|
|
|
|
|
QApplication::setOverrideCursor(m_cursor);
|
|
|
|
|
m_set = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OverrideCursor::reset()
|
|
|
|
|
{
|
|
|
|
|
if (m_set) {
|
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
|
m_set = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|