qskinny/src/controls/QskSwitchButton.h

67 lines
1.7 KiB
C
Raw Normal View History

2024-01-17 13:31:45 +00:00
/******************************************************************************
* QSkinny - Copyright (C) The authors
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/
2021-08-02 11:22:37 +00:00
#ifndef QSK_SWITCH_BUTTON_H
#define QSK_SWITCH_BUTTON_H
#include "QskAbstractButton.h"
2021-08-02 17:17:04 +00:00
#include <qnamespace.h>
2021-08-02 11:22:37 +00:00
class QSK_EXPORT QskSwitchButton : public QskAbstractButton
{
Q_OBJECT
using Inherited = QskAbstractButton;
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged FINAL )
2021-08-02 17:17:04 +00:00
Q_PROPERTY( bool inverted READ isInverted
WRITE setInverted NOTIFY invertedChanged FINAL )
2021-08-02 11:22:37 +00:00
Q_PROPERTY( IconMode iconMode READ iconMode
WRITE setIconMode NOTIFY iconModeChanged FINAL )
2021-08-02 11:22:37 +00:00
public:
QSK_SUBCONTROLS( Groove, Handle, Icon )
enum IconMode
{
NoIcon,
ShowIconWhenSelected,
ShowIconAlways
};
Q_ENUM( IconMode )
2021-08-02 11:22:37 +00:00
2021-08-02 17:17:04 +00:00
QskSwitchButton( Qt::Orientation, QQuickItem* parent = nullptr );
2021-08-02 11:22:37 +00:00
QskSwitchButton( QQuickItem* parent = nullptr );
2021-08-02 17:17:04 +00:00
2021-08-02 11:22:37 +00:00
~QskSwitchButton() override;
2021-08-06 07:52:12 +00:00
bool isCheckable() const override final;
2021-08-02 11:22:37 +00:00
Qt::Orientation orientation() const;
void setOrientation( Qt::Orientation );
2021-08-02 11:22:37 +00:00
2021-08-02 17:17:04 +00:00
bool isInverted() const;
void setInverted( bool );
IconMode iconMode() const;
void setIconMode( IconMode );
QskAspect::Variation effectiveVariation() const override;
2021-08-02 11:22:37 +00:00
Q_SIGNALS:
void orientationChanged( Qt::Orientation );
2021-08-02 17:17:04 +00:00
void invertedChanged( bool );
void iconModeChanged( IconMode );
2021-08-02 11:22:37 +00:00
private:
struct PrivateData;
std::unique_ptr< PrivateData > m_data;
};
2021-08-02 17:17:04 +00:00
2021-08-02 11:22:37 +00:00
#endif