2017-09-29 06:53:21 +00:00
|
|
|
#ifndef QTMATERIALCHECKABLE_H
|
|
|
|
#define QTMATERIALCHECKABLE_H
|
|
|
|
|
|
|
|
#include <QtWidgets/QAbstractButton>
|
2022-02-17 01:59:33 +00:00
|
|
|
namespace md
|
|
|
|
{
|
|
|
|
class CheckablePrivate;
|
2017-09-29 06:53:21 +00:00
|
|
|
|
2022-02-17 01:59:33 +00:00
|
|
|
class Checkable : public QAbstractButton
|
2017-09-29 06:53:21 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum LabelPosition {
|
|
|
|
LabelPositionLeft,
|
|
|
|
LabelPositionRight,
|
|
|
|
};
|
|
|
|
|
2022-02-17 01:59:33 +00:00
|
|
|
explicit Checkable(QWidget *parent = 0);
|
|
|
|
~Checkable();
|
2017-09-29 06:53:21 +00:00
|
|
|
|
|
|
|
void setLabelPosition(LabelPosition placement);
|
|
|
|
LabelPosition labelPosition() const;
|
|
|
|
|
|
|
|
void setUseThemeColors(bool value);
|
|
|
|
bool useThemeColors() const;
|
|
|
|
|
|
|
|
void setCheckedColor(const QColor &color);
|
|
|
|
QColor checkedColor() const;
|
|
|
|
|
|
|
|
void setUncheckedColor(const QColor &color);
|
|
|
|
QColor uncheckedColor() const;
|
|
|
|
|
|
|
|
void setTextColor(const QColor &color);
|
|
|
|
QColor textColor() const;
|
|
|
|
|
|
|
|
void setDisabledColor(const QColor &color);
|
|
|
|
QColor disabledColor() const;
|
|
|
|
|
|
|
|
void setCheckedIcon(const QIcon &icon);
|
|
|
|
QIcon checkedIcon() const;
|
|
|
|
|
|
|
|
void setUncheckedIcon(const QIcon &icon);
|
|
|
|
QIcon uncheckedIcon() const;
|
|
|
|
|
|
|
|
QSize sizeHint() const Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
protected:
|
2022-02-17 01:59:33 +00:00
|
|
|
Checkable(CheckablePrivate &d, QWidget *parent = 0);
|
2017-09-29 06:53:21 +00:00
|
|
|
|
|
|
|
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void setupProperties();
|
|
|
|
|
2022-02-17 01:59:33 +00:00
|
|
|
const QScopedPointer<CheckablePrivate> d_ptr;
|
2017-09-29 06:53:21 +00:00
|
|
|
|
|
|
|
private:
|
2022-02-17 01:59:33 +00:00
|
|
|
Q_DISABLE_COPY(Checkable)
|
|
|
|
Q_DECLARE_PRIVATE(Checkable)
|
2017-09-29 06:53:21 +00:00
|
|
|
};
|
2022-02-17 01:59:33 +00:00
|
|
|
}
|
2017-09-29 06:53:21 +00:00
|
|
|
|
|
|
|
#endif // QTMATERIALCHECKABLE_H
|