Warning, file /graphics/washipad/src/event.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of Washi Pad
0002 // SPDX-FileCopyrightText: 2018 Kevin Ottens <ervin@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #include "event.h"
0006 
0007 #include <QTabletEvent>
0008 #if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
0009 #include <QPointingDevice>
0010 #endif
0011 
0012 Event TabletEvent::create(QTabletEvent *event)
0013 {
0014     return {
0015         static_cast<float>(event->posF().x()),
0016         static_cast<float>(event->posF().y()),
0017         static_cast<float>(event->pressure()),
0018 #if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
0019         (event->pointerType() == QPointingDevice::PointerType::Eraser) ? Pointer::Eraser : Pointer::Pen
0020 #else
0021         (event->pointerType() == QTabletEvent::Eraser) ? Pointer::Eraser : Pointer::Pen
0022 #endif
0023     };
0024 }
0025 
0026 Event MouseEvent::create(const float x, const float y, const int button)
0027 {
0028     return {
0029         static_cast<float>(x),
0030         static_cast<float>(y),
0031         static_cast<float>(0.5f),
0032         (button == Qt::RightButton) ? Pointer::Eraser : Pointer::Pen
0033     };
0034 }