qskinny/src/controls/QskPageIndicator.h

76 lines
2.0 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
2023-04-06 07:23:37 +00:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 16:21:34 +00:00
*****************************************************************************/
#ifndef QSK_PAGE_INDICATOR_H
#define QSK_PAGE_INDICATOR_H
#include "QskControl.h"
class QSK_EXPORT QskPageIndicator : public QskControl
{
Q_OBJECT
2018-08-03 06:15:28 +00:00
Q_PROPERTY( int count READ count
WRITE setCount NOTIFY countChanged FINAL )
Q_PROPERTY( qreal currentIndex READ currentIndex
WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL )
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged FINAL )
2017-07-21 16:21:34 +00:00
using Inherited = QskControl;
2018-08-03 06:15:28 +00:00
public:
2022-01-04 12:58:34 +00:00
QSK_SUBCONTROLS( Panel, Bullet )
QSK_STATES( Selected )
2017-07-21 16:21:34 +00:00
QskPageIndicator( QQuickItem* parent = nullptr );
QskPageIndicator( int count, QQuickItem* parent = nullptr );
2018-07-31 15:32:25 +00:00
~QskPageIndicator() override;
2017-07-21 16:21:34 +00:00
int count() const;
qreal currentIndex() const;
Qt::Orientation orientation() const;
void setOrientation( Qt::Orientation );
2022-01-04 12:58:34 +00:00
qreal valueRatioAt( int index ) const;
2022-01-04 14:58:49 +00:00
QRectF bulletRect( int index ) const;
int indexAtPosition( const QPointF& ) const;
2022-01-04 12:58:34 +00:00
QskAspect::Variation effectiveVariation() const override;
2022-01-04 13:34:15 +00:00
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
2020-12-17 15:14:56 +00:00
void countChanged( int );
void currentIndexChanged( qreal );
void orientationChanged( Qt::Orientation );
2022-01-04 14:58:49 +00:00
void pageRequested( int index );
2017-07-21 16:21:34 +00:00
2018-08-03 06:15:28 +00:00
public Q_SLOTS:
2017-07-21 16:21:34 +00:00
void setCount( int count );
void setCurrentIndex( qreal index );
2022-01-04 14:58:49 +00:00
protected:
void mousePressEvent( QMouseEvent* e ) override;
2022-01-05 10:59:32 +00:00
void mouseUngrabEvent() override;
2022-01-04 14:58:49 +00:00
void mouseReleaseEvent( QMouseEvent* e ) override;
void keyPressEvent( QKeyEvent* ) override;
2022-01-05 10:59:32 +00:00
#ifndef QT_NO_WHEELEVENT
2022-01-04 14:58:49 +00:00
void wheelEvent( QWheelEvent* ) override;
2022-01-05 10:59:32 +00:00
#endif
2022-01-04 14:58:49 +00:00
2018-08-03 06:15:28 +00:00
private:
2022-01-05 10:59:32 +00:00
void incrementRequested( int );
2017-07-21 16:21:34 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif