123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #include "welcomeWidget.h"
- #include "ui_welcomeWidget.h"
- #include <QDesktopWidget>
- #include "CAppInfo.h"
- welcomeWidget::welcomeWidget(QString sStudentName, QString sStudentCode,
- QString sSpecialtyName, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::welcomeWidget)
- {
- ui->setupUi(this);
- setWindowFlags(Qt::FramelessWindowHint);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- ui->label_wcw_studentName->setText(QString::fromLocal8Bit("姓名:%1-%2").arg(sStudentName).arg(sStudentCode));
- ui->label_wcw_specialty->setText(QString::fromLocal8Bit("专业:%1").arg(sSpecialtyName));
- initUI();
- }
- welcomeWidget::~welcomeWidget()
- {
- delete ui;
- }
- void welcomeWidget::initUI()
- {
- QDesktopWidget *dekwiget = QApplication::desktop();
- setGeometry(0, 0, dekwiget->width(), dekwiget->height());
- ui->widget_mask->setGeometry(0, 0, dekwiget->width(), dekwiget->height());
- ui->widget_wcw_BG->setGeometry((width() - g_appInfoPtr->m_fRate*100)/2, (height() - g_appInfoPtr->m_fRate*212)/2,
- g_appInfoPtr->m_fRate*100, g_appInfoPtr->m_fRate*212);
- ui->label_wcw_icon->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*30,
- g_appInfoPtr->m_fRate*40, g_appInfoPtr->m_fRate*40);
- ui->label_wcw_tips->adjustSize();
- ui->label_wcw_tips->setGeometry(ui->label_wcw_icon->x() + ui->label_wcw_icon->width() + g_appInfoPtr->m_fRate*20,
- ui->label_wcw_icon->y(), ui->label_wcw_tips->width(), ui->label_wcw_tips->height());
- ui->label_wcw_studentName->adjustSize();
- ui->label_wcw_studentName->setGeometry(ui->label_wcw_tips->x(), ui->label_wcw_tips->y() + ui->label_wcw_tips->height() + g_appInfoPtr->m_fRate*20,
- ui->label_wcw_studentName->width(), ui->label_wcw_studentName->height());
- ui->label_wcw_specialty->adjustSize();
- ui->label_wcw_specialty->setGeometry(ui->label_wcw_tips->x(), ui->label_wcw_studentName->y() + ui->label_wcw_studentName->height() + g_appInfoPtr->m_fRate*10,
- ui->label_wcw_specialty->width(), ui->label_wcw_specialty->height());
-
- int nWidth = ui->widget_wcw_BG->width();
- if (nWidth - g_appInfoPtr->m_fRate * 30 < ui->label_wcw_tips->x() + ui->label_wcw_tips->width())
- {
- nWidth = ui->label_wcw_tips->x() + ui->label_wcw_tips->width() + g_appInfoPtr->m_fRate * 30;
- }
- if(nWidth - g_appInfoPtr->m_fRate*30 < ui->label_wcw_studentName->x() + ui->label_wcw_studentName->width())
- {
- nWidth = ui->label_wcw_studentName->x() + ui->label_wcw_studentName->width() + g_appInfoPtr->m_fRate*30;
- }
- if(nWidth - g_appInfoPtr->m_fRate*30 < ui->label_wcw_specialty->x() + ui->label_wcw_specialty->width())
- {
- nWidth = ui->label_wcw_specialty->x() + ui->label_wcw_specialty->width() + g_appInfoPtr->m_fRate*30;
- }
- if(nWidth > ui->widget_wcw_BG->width())
- {
- ui->widget_wcw_BG->setGeometry((width() - nWidth)/2, (height() - g_appInfoPtr->m_fRate*212)/2,
- nWidth, g_appInfoPtr->m_fRate*212);
- }
- ui->btn_wcw_comfirm->setGeometry(ui->widget_wcw_BG->width() - g_appInfoPtr->m_fRate*(20 + 80), ui->widget_wcw_BG->height() - g_appInfoPtr->m_fRate*(20 + 30),
- g_appInfoPtr->m_fRate * 80, g_appInfoPtr->m_fRate * 30);
- }
- void welcomeWidget::on_btn_wcw_comfirm_clicked()
- {
- emit exitWelcomeWidget();
- }
|