qskinny/src/controls/QskSwipeView.h

71 lines
1.9 KiB
C
Raw Normal View History

2023-06-19 09:22:34 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/
#ifndef QSK_SWIPE_VIEW_H
#define QSK_SWIPE_VIEW_H
#include "QskStackBox.h"
class QSK_EXPORT QskSwipeView : public QskStackBox
{
Q_OBJECT
2023-08-10 17:54:06 +00:00
Q_PROPERTY( int duration READ duration
WRITE setDuration RESET resetDuration NOTIFY durationChanged )
Q_PROPERTY( int swipeDistance READ swipeDistance
WRITE setSwipeDistance RESET resetSwipeDistance NOTIFY swipeDistanceChanged )
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged )
2023-08-10 17:10:31 +00:00
using Inherited = QskStackBox;
2023-06-19 09:22:34 +00:00
public:
QSK_SUBCONTROLS( Panel )
QskSwipeView( QQuickItem* parent = nullptr );
~QskSwipeView() override;
2023-08-10 17:54:06 +00:00
void setOrientation( Qt::Orientation );
Qt::Orientation orientation() const;
// Duration is the time ( in ms ) used for changing between pages
2023-06-19 09:22:34 +00:00
int duration() const;
void setDuration( int );
2023-08-10 17:10:31 +00:00
void resetDuration();
2023-08-10 17:54:06 +00:00
/*
Even if called "swipe view" we use a pan - no swipe - gesture.
( = pages are moved before the gesture has been confirmed )
The swipe distance is the minimum distance in pixels of the pan gesture
*/
int swipeDistance() const;
void setSwipeDistance( int );
void resetSwipeDistance();
2023-08-10 17:10:31 +00:00
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const;
2023-06-19 09:22:34 +00:00
2023-08-10 17:54:06 +00:00
Q_SIGNALS:
void orientationChanged( Qt::Orientation );
void durationChanged( int );
void swipeDistanceChanged( int );
2023-06-19 09:22:34 +00:00
protected:
2023-08-10 17:10:31 +00:00
bool gestureFilter( const QQuickItem*, const QEvent* ) override;
void gestureEvent( QskGestureEvent* ) override;
2023-06-19 09:22:34 +00:00
private:
2023-08-10 17:10:31 +00:00
void setAnimator( QskStackBoxAnimator* ) = delete;
2023-06-19 09:22:34 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif