theshell/fadebutton.h
2017-08-07 18:08:56 +10:00

63 lines
1.6 KiB
C++

/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2017 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef FADEBUTTON_H
#define FADEBUTTON_H
#include <QWidget>
#include <QPushButton>
#include <QPainter>
#include <QPaintEvent>
#include <QLinearGradient>
#include <tvariantanimation.h>
class FadeButton : public QPushButton
{
Q_OBJECT
public:
explicit FadeButton(QWidget *parent = 0);
bool fade();
void setFade(bool fade);
void setFullText(QString fullText);
void setText(QString text);
void animateIn();
void animateOut();
signals:
public slots:
private:
bool f = false;
QString txt;
QRect oldTextRect, textRect;
QString oldText = "", currentText = "";
bool animating = false;
void paintEvent(QPaintEvent* event);
bool hovering = false;
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
};
#endif // FADEBUTTON_H