74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#include "mainbtn.h"
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
void MainBtn::setTxt(QString str,QString str2,QString str3)
|
|
{
|
|
m_labTxt.setText(str);
|
|
m_labEgTxt.setText(str2) ;
|
|
// m_labImage.setText(str3);
|
|
|
|
|
|
m_labImage.setStyleSheet(QString("QLabel{border-image:url(:/image/%1.png);background-color: transparent;}").arg(str3));
|
|
}
|
|
MainBtn::MainBtn(QPushButton * parent ):QPushButton (parent)
|
|
{
|
|
setObjectName("MainBtn");
|
|
|
|
m_labTxt.setObjectName("MainTxt");
|
|
m_labEgTxt.setObjectName("MainTxtEn");
|
|
#if 0
|
|
this->setStyleSheet("QPushButton{border-image:url(:/image/index_bg_setting.png);}"
|
|
"QPushButton:hover{border-image:url(:/image/index_bg_setting_hover.png);}"
|
|
"QPushButton:pressed{border-image:url(:/image/index_bg_setting_checked.png);}" );
|
|
m_labTxt.setStyleSheet("font-size: 60px;font-weight: 500;color:white;background-color:transparent;");
|
|
m_labEgTxt.setStyleSheet("font-size: 60px;font-weight:normal;color:white;background-color:transparent;");
|
|
#endif
|
|
|
|
m_labTxt.setStyleSheet("font-size: 60px;font-weight: 500;color:white;background-color:transparent;");
|
|
m_labEgTxt.setStyleSheet("font-size: 60px;font-weight:normal;color:white;background-color:transparent;");
|
|
|
|
#if 1
|
|
m_labTxt.setFixedSize(QSize(240,87));
|
|
|
|
m_labImage.setFixedSize(QSize(129,117));
|
|
|
|
#endif
|
|
QHBoxLayout * hlay = new QHBoxLayout;
|
|
QHBoxLayout * hlay2 = new QHBoxLayout;
|
|
QHBoxLayout * hlay3 = new QHBoxLayout;
|
|
hlay->addWidget(&m_labTxt);
|
|
hlay->addStretch();
|
|
hlay2->addWidget(&m_labEgTxt);
|
|
hlay2->addStretch();
|
|
hlay3->addStretch();
|
|
hlay3->addWidget(&m_labImage);
|
|
|
|
|
|
QVBoxLayout * vlay = new QVBoxLayout;
|
|
vlay->addLayout(hlay);
|
|
vlay->addLayout(hlay2);
|
|
vlay->addSpacing(143);
|
|
vlay->addLayout(hlay3);
|
|
vlay->setSpacing(0);
|
|
vlay->setContentsMargins(45,45,45,45);
|
|
setFixedSize(QSize(450,500));
|
|
setLayout(vlay);
|
|
}
|
|
MainBtn::~MainBtn()
|
|
{
|
|
|
|
}
|
|
#if 0
|
|
void MainBtn::mouseReleaseEvent(QMouseEvent * ev)
|
|
{
|
|
|
|
}
|
|
void MainBtn::paintEvent(QPaintEvent* event)
|
|
{
|
|
QStyleOption opt;
|
|
opt.init(this);
|
|
QPainter p(this);
|
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
}
|
|
#endif
|