123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #ifndef EXPANDGROUPSETTINGCARD_H
- #define EXPANDGROUPSETTINGCARD_H
- #include <QAbstractButton>
- #include <QFrame>
- #include <QParallelAnimationGroup>
- #include <QPropertyAnimation>
- #include "Common/Icon.h"
- class VBoxLayout;
- class SettingCard;
- class ExpandButton : public QAbstractButton
- {
- Q_OBJECT
- Q_PROPERTY(float angle READ getAngle WRITE setAngle)
- public:
- explicit ExpandButton(QWidget *parent = nullptr);
- void setHover(bool hover);
- void setPressed(bool pressed);
- float getAngle() const;
- void setAngle(float angle);
- bool isHover;
- bool isPressed;
- protected:
- void mousePressEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void enterEvent(QEvent *event) override;
- void leaveEvent(QEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
- private slots:
- void onClicked();
- private:
- float m_angle;
- QPropertyAnimation *m_rotateAni;
- };
- class ExpandSettingCard : public QFrame
- {
- Q_OBJECT
- public:
- explicit ExpandSettingCard(FluentIconBase *icon, const QString &title, const QString &content,
- QWidget *parent = nullptr);
- void addWidget(QWidget *widget);
- void setExpand(bool expand);
- virtual void setValue(const QVariant &value);
- QFrame *view() const;
- VBoxLayout *viewLayout;
- public slots:
- void toggleExpand();
- protected:
- void resizeEvent(QResizeEvent *event) override;
- bool eventFilter(QObject *watched, QEvent *event) override;
- void adjustViewSize();
- private:
- void initWidget();
- private slots:
- void onAniFinished();
- private:
- bool m_isExpand;
- ExpandButton *m_expandButton;
- QFrame *m_view;
- SettingCard *m_card;
- QParallelAnimationGroup *m_aniGroup;
- QPropertyAnimation *m_slideAni;
- QPropertyAnimation *m_expandAni;
- };
- class GroupSeparator : public QWidget
- {
- Q_OBJECT
- public:
- explicit GroupSeparator(QWidget *parent = nullptr);
- void paintEvent(QPaintEvent *event) override;
- };
- class ExpandGroupSettingCard : public ExpandSettingCard
- {
- Q_OBJECT
- public:
- explicit ExpandGroupSettingCard(FluentIconBase *icon, const QString &title, const QString &content,
- QWidget *parent = nullptr);
- void addGroupWidget(QWidget *widget);
- signals:
- };
- #endif // EXPANDGROUPSETTINGCARD_H
|