File indexing completed on 2024-04-28 05:52:37

0001 /*
0002     This file is part of the Okteta Gui library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2021 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef OKTETA_TOUCHONLYTAPANDHOLDGESTURE_HPP
0010 #define OKTETA_TOUCHONLYTAPANDHOLDGESTURE_HPP
0011 
0012 // Qt
0013 #include <QGesture>
0014 
0015 namespace Okteta {
0016 
0017 class TouchOnlyTapAndHoldGesture : public QGesture
0018 {
0019     Q_OBJECT
0020     /// in widget coords
0021     Q_PROPERTY(QPointF position READ position WRITE setPosition)
0022 
0023 public:
0024     TouchOnlyTapAndHoldGesture() = default;
0025 
0026 public:
0027     QPointF position() const { return m_position; }
0028     void setPosition(const QPointF &pos) { m_position = pos; }
0029     void beginHoldTimeer();
0030     void cancelHoldTimer();
0031     bool isHoldTimerActive() const { return (m_timerId != 0); }
0032     void reset();
0033 
0034 private:
0035     int m_timerId = 0;
0036     QPointF m_position;
0037 };
0038 
0039 }
0040 
0041 #endif