内存错误调完了
This commit is contained in:
@ -15,8 +15,6 @@ MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButto
|
||||
}
|
||||
|
||||
MyButton::~MyButton() {
|
||||
delete logo;
|
||||
delete logo_cover;
|
||||
}
|
||||
|
||||
void MyButton::paintEvent(QPaintEvent *e) {
|
||||
@ -33,13 +31,17 @@ void MyButton::paintEvent(QPaintEvent *e) {
|
||||
int text_y=(logo_width+logo_y+10);
|
||||
QRectF logo_rect(logo_x, logo_y, logo_width, logo_width);
|
||||
QRectF text_rect(text_x,text_y, TEXT_SIZE*text.length()*scale*2,TEXT_SIZE*scale*2);
|
||||
painter.setPen(QColor("#FFFFFF"));
|
||||
painter.drawImage(logo_rect, *logo);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
|
||||
if(checked){
|
||||
QRectF rect(0, this->height()-6, this->width(), 5);
|
||||
painter.fillRect(rect, QColor("#FFFFFF"));
|
||||
}
|
||||
painter.setPen(QColor("#FFFFFF"));
|
||||
painter.drawImage(logo_rect, *logo_cover);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
else {
|
||||
painter.setPen(QColor("#FFFFFF"));
|
||||
painter.drawImage(logo_rect, *logo);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
}
|
||||
QSize MyButton::sizeHint() const {
|
||||
|
Reference in New Issue
Block a user