yhkylin-backup-tools/kybackup/component/myiconbutton.h

35 lines
711 B
C++

#ifndef MYICONBUTTON_H
#define MYICONBUTTON_H
#include <QPushButton>
#include <QLabel>
#include <QPalette>
#include "mylabel.h"
class MyIconButton : public QPushButton
{
Q_OBJECT
public:
explicit MyIconButton(QWidget *parent = nullptr);
~MyIconButton();
void setThemeIcon(const QString &themeIconName, const QString &defaultIconName = "", int size = 16);
void setDesplayText(const QString &text);
public slots:
void changePalette(bool checked);
protected:
void paintEvent(QPaintEvent *event);
private:
QPushButton *m_iconButton;
MyLabel *m_textLabel;
QString m_themeIconName;
QString m_defaultIconName;
QString m_originalText;
};
#endif // MYICONBUTTON_H