123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #include "changeQuestion.h"
- #include "ui_changeQuestion.h"
- #include <QFile>
- #include "CAppInfo.h"
- changeQuestion::changeQuestion(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::changeQuestion)
- {
- ui->setupUi(this);
- setAttribute(Qt::WA_DeleteOnClose);
- // QFile qssFile(":/qss/main.qss");
- // qssFile.open(QFile::ReadOnly);
- // QString qss;
- // qss = qssFile.readAll();
- // setStyleSheet(qss);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- }
- void changeQuestion::showBtn(int nType)
- {
- sStyle = QString(R"(QPushButton
- {
- outline:none;
- background:rgba(19,187,138,1);
- border-radius:%1px;
- font-size:%2px;
- font-family:"Microsoft YaHei";
- font-weight:600;
- color:rgba(255,255,255,1);
- })").arg((int)(g_appInfoPtr->m_fRate*10))
- .arg((int)(g_appInfoPtr->m_fRate*12));
- sDisableStyle = QString(R"(QPushButton
- {
- outline:none;
- background:rgba(239,240,245,1);
- border-radius:%1px;
- font-size:%2px;
- font-family:"Microsoft YaHei";
- font-weight:600;
- color:rgba(153,153,153,1);
- })").arg((int)(g_appInfoPtr->m_fRate*10))
- .arg((int)(g_appInfoPtr->m_fRate*12));
- ui->btn_cq_previous->setStyleSheet(sStyle);
- ui->btn_cq_next->setStyleSheet(sStyle);
- ui->btn_cq_previous->setEnabled(true);
- ui->btn_cq_next->setEnabled(true);
- if(nType == 1)
- {
- ui->btn_cq_previous->setStyleSheet(sDisableStyle);
- ui->btn_cq_previous->setEnabled(false);
- }
- else if(nType == 2)
- {
- ui->btn_cq_next->setStyleSheet(sDisableStyle);
- ui->btn_cq_next->setEnabled(false);
- }
- }
- changeQuestion::~changeQuestion()
- {
- delete ui;
- }
- void changeQuestion::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
- {
- setGeometry(nLeft, nTop, nWidth, nHeight);
- QIcon icon(QPixmap(":/images/btn-icon-previous.png"));
- ui->btn_cq_previous->setIcon(icon);
- ui->btn_cq_previous->setGeometry(g_appInfoPtr->m_fRate*80, nHeight - g_appInfoPtr->m_fRate*32, g_appInfoPtr->m_fRate*100, g_appInfoPtr->m_fRate*32);
- QIcon icon1(QPixmap(":/images/btn-icon-next.png"));
- ui->btn_cq_next->setIcon(icon1);
- ui->btn_cq_next->setGeometry(ui->btn_cq_previous->x() + ui->btn_cq_previous->width() + g_appInfoPtr->m_fRate*20,
- ui->btn_cq_previous->y(), ui->btn_cq_previous->width(), ui->btn_cq_previous->height());
- }
- void changeQuestion::on_btn_cq_previous_clicked()
- {
- ui->btn_cq_previous->setStyleSheet(sDisableStyle);
- ui->btn_cq_next->setStyleSheet(sDisableStyle);
- ui->btn_cq_previous->setEnabled(false);
- ui->btn_cq_next->setEnabled(false);
- emit previousQuestion();
- }
- void changeQuestion::on_btn_cq_next_clicked()
- {
- ui->btn_cq_previous->setStyleSheet(sDisableStyle);
- ui->btn_cq_next->setStyleSheet(sDisableStyle);
- ui->btn_cq_previous->setEnabled(false);
- ui->btn_cq_next->setEnabled(false);
- emit nextQuestion();
- }
|