mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-15 09:10:52 +03:00
First commit
This commit is contained in:
22
custombutton.cpp
Normal file
22
custombutton.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "custombutton.h"
|
||||
|
||||
CustomButton::CustomButton(const QString &text1, const QString &text2, const QString &text3, const QColor &lineColor, QWidget *parent)
|
||||
: QPushButton(parent), text1(text1), text2(text2), text3(text3), lineColor(lineColor) {
|
||||
setMinimumHeight(60);
|
||||
setMinimumWidth(100);
|
||||
}
|
||||
|
||||
void CustomButton::paintEvent(QPaintEvent *event) {
|
||||
QPushButton::paintEvent(event);
|
||||
QPainter painter(this);
|
||||
QPalette pal = palette();
|
||||
QColor textColor = pal.color(QPalette::ButtonText);
|
||||
|
||||
QPen pen(lineColor, 5);
|
||||
painter.setPen(pen);
|
||||
painter.drawLine(10, 9, 10, 50);
|
||||
|
||||
QRect rect(20, 0, width() - 25, height());
|
||||
painter.setPen(textColor);
|
||||
painter.drawText(rect, Qt::AlignVCenter | Qt::AlignLeft, text1 + "\n" + text2 + "\n" + text3);
|
||||
}
|
||||
Reference in New Issue
Block a user