修复导航栏问题
This commit is contained in:
@ -1,68 +1,69 @@
|
||||
//
|
||||
// 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>
|
||||
#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<MyButton *> *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:
|
||||
QColor text_color;
|
||||
QColor text_cover_color;
|
||||
QList<MyButton *> *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
|
||||
//
|
||||
// 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>
|
||||
#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<MyButton *> *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:
|
||||
QColor text_color;
|
||||
QColor text_cover_color;
|
||||
QString background_color;
|
||||
QList<MyButton *> *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
|
||||
|
Reference in New Issue
Block a user