| 736 | |
| 737 | |
| 738 | textButton::textButton(QString text, QWidget *parent, qreal ratio) : |
| 739 | QWidget(parent) |
| 740 | { |
| 741 | QFont textFont = QFont("Corbel", 10); |
| 742 | QFontMetrics fm(textFont); |
| 743 | qreal height = fm.lineSpacing(); |
| 744 | btnText = new QLabel(this); |
| 745 | btnText->setText(text); |
| 746 | btnText->setFont(textFont); |
| 747 | btnText->setFixedHeight(height); |
| 748 | btnText->setFixedWidth(fm.size(Qt::TextSingleLine, text).width() + 2); |
| 749 | btnText->setStyleSheet("color:#1c1c1c"); |
| 750 | btnText->setAlignment(Qt::AlignCenter); |
| 751 | |
| 752 | bgWidget = new QWidget(this); |
| 753 | bgWidget->setStyleSheet("background-color:"+defaultColor+";border-radius:5px;"); |
| 754 | |
| 755 | this->setFixedHeight(btnText->height() / ratio); |
| 756 | } |
| 757 | |
| 758 | textButton::textButton(QString text, QString defC, QString hoverC, QString pressedC, QWidget *parent, qreal ratio): |
| 759 | QWidget(parent), |