MCPcopy Create free account
hub / github.com/Linloir/GraphBuilder / textButton

Method textButton

customWidgets.cpp:738–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736
737
738textButton::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
758textButton::textButton(QString text, QString defC, QString hoverC, QString pressedC, QWidget *parent, qreal ratio):
759 QWidget(parent),

Callers

nothing calls this directly

Calls 1

setTextMethod · 0.45

Tested by

no test coverage detected