pineapple-pictures/toolbutton.cpp
2019-10-06 14:58:01 +08:00

27 lines
643 B
C++

#include "toolbutton.h"
#include "opacityhelper.h"
#include <QPainter>
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
ToolButton::ToolButton(QWidget *parent)
: QPushButton(parent)
, m_opacityHelper(new OpacityHelper(this))
{
setFlat(true);
setFixedSize(50, 50);
setStyleSheet("QPushButton {"
"background: transparent;"
"}"
"QPushButton:hover {"
"background: red;"
"}");
}
void ToolButton::setOpacity(qreal opacity, bool animated)
{
m_opacityHelper->setOpacity(opacity, animated);
}