40 lines
806 B
C++
40 lines
806 B
C++
//
|
|
// Created by HW on 2023/07/26.
|
|
//
|
|
|
|
#ifndef OFFICEASSISTANT_MYBUTTON_H
|
|
#define OFFICEASSISTANT_MYBUTTON_H
|
|
|
|
#include <QPushButton>
|
|
#include <QPaintEvent>
|
|
#include <QtSvg/QtSvg>
|
|
#include <QtSvg/QSvgWidget>
|
|
#include <QtSvg/QSvgRenderer>
|
|
|
|
class MyButton: public QPushButton{
|
|
public:
|
|
MyButton(QString logo,QString text,int width,int height,QWidget *parent=nullptr);
|
|
~MyButton() override;
|
|
QString getText(){
|
|
return text;
|
|
}
|
|
QSize sizeHint() const override {
|
|
return QSize(width2/2,height2/2);
|
|
}
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *e) override;
|
|
private:
|
|
QImage *logo;
|
|
QLabel *logo_label;
|
|
QLabel *text_label;
|
|
QVBoxLayout *layout;
|
|
QPixmap* logo_pixmap;
|
|
QString text;
|
|
int width2;
|
|
int height2;
|
|
};
|
|
|
|
|
|
#endif //OFFICEASSISTANT_MYBUTTON_H
|