File indexing completed on 2025-01-05 03:59:25
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2013 Mohammed Nafees <nafees.technocool@gmail.com> 0004 // 0005 0006 #ifndef ARROWDISCWIDGET_H 0007 #define ARROWDISCWIDGET_H 0008 0009 #include <QWidget> 0010 #include <QPixmap> 0011 #include <QTimer> 0012 0013 namespace Marble 0014 { 0015 0016 class MarbleWidget; 0017 0018 class ArrowDiscWidget : public QWidget 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit ArrowDiscWidget( QWidget *parent = nullptr ); 0023 ~ArrowDiscWidget() override; 0024 0025 void setMarbleWidget( MarbleWidget *marbleWidget ); 0026 0027 Q_SIGNALS: 0028 void repaintNeeded(); 0029 0030 protected: 0031 void paintEvent( QPaintEvent * ) override; 0032 void mouseMoveEvent( QMouseEvent *mouseEvent ) override; 0033 void mousePressEvent( QMouseEvent *mouseEvent ) override; 0034 void mouseReleaseEvent( QMouseEvent *mouseEvent ) override; 0035 void leaveEvent( QEvent *event ) override; 0036 void repaint(); 0037 0038 private Q_SLOTS: 0039 void startPressRepeat(); 0040 void repeatPress(); 0041 0042 private: 0043 static QPixmap pixmap(const QString &id ); 0044 Qt::ArrowType arrowUnderMouse( const QPoint &position ) const; 0045 QTimer m_initialPressTimer; 0046 QTimer m_repeatPressTimer; 0047 Qt::ArrowType m_arrowPressed; 0048 int m_repetitions; 0049 0050 MarbleWidget *m_marbleWidget; 0051 QString m_imagePath; 0052 }; 0053 0054 } 0055 0056 #endif