// // Created by HW on 2023/07/26. // #ifndef OFFICEASSISTANT_MYBUTTON_H #define OFFICEASSISTANT_MYBUTTON_H #include #include #include #include #include #include "globalvariables.h" #include "buttonstruct.h" class MyButton: public QPushButton{ Q_OBJECT signals: void clicked1(QString text, QString url); public: MyButton(ButtonStruct &buttonStruct,int width,int height,QList *buttons,QWidget *parent=nullptr); ~MyButton() override; QString getText(){ return text; } QSize sizeHint() const override; void setChecked(bool checked){ this->checked=checked; } QSize getLogicalSize() const { if(scale>=1.25){ return QSize(width2,height2); } else{ return QSize(width2,height2); }; } void setSize(int width,int height,int logicalwidth,int logicalheight){ this->width2=width; this->height2=height; this->logicalwidth=logicalwidth; this->logicalheight=logicalheight; } protected: void paintEvent(QPaintEvent *e) override; void enterEvent(QEvent *event) override; void leaveEvent(QEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; private: QList *buttons; QImage *logo; QImage *logo_cover; QVBoxLayout *layout; QString text; QString url; int width2; int height2; int logicalwidth; int logicalheight; bool checked=false; }; #endif //OFFICEASSISTANT_MYBUTTON_H