39 lines
1 KiB
C
39 lines
1 KiB
C
|
#ifndef QMODERNPUSHBUTTONOVERLAY_H
|
||
|
#define QMODERNPUSHBUTTONOVERLAY_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QSvgWidget>
|
||
|
#include <QGraphicsOpacityEffect>
|
||
|
#include <QPropertyAnimation>
|
||
|
#include <QDebug>
|
||
|
|
||
|
// This class automatically enables and disabled the QGraphicsOpacityEffect as needed, to prevent
|
||
|
// "QPainter::begin: A paint device can only be painted by one painter at a time." Error messages
|
||
|
// When applying a QGraphicalEffect to the parent
|
||
|
class QModernPushButtonOverlay : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
friend class QModernPushButton;
|
||
|
|
||
|
private:
|
||
|
|
||
|
explicit QModernPushButtonOverlay(QWidget* overlayWidget, QObject *parent = nullptr);
|
||
|
|
||
|
QWidget* widget;
|
||
|
QGraphicsOpacityEffect* effect;
|
||
|
QPropertyAnimation* animation;
|
||
|
|
||
|
void setAnimationDuration(int duration);
|
||
|
void setVisible(bool visible);
|
||
|
void setEffectEnabled(bool enabled);
|
||
|
|
||
|
private slots:
|
||
|
void handleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State);
|
||
|
|
||
|
signals:
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // QMODERNPUSHBUTTONOVERLAY_H
|