This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
modern-linbo-gui/headers/qmodernpushbuttonoverlay.h
2020-11-19 14:39:32 +01:00

38 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