Login.cpp 761 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "Login.h"
  2. #include "OriginalWnd/OriginalWnd.h"
  3. #include "ui_Login.h"
  4. #include <QStackedWidget>
  5. #include <qDebug>
  6. Login::Login(QWidget *parent)
  7. : QMainWindow(parent)
  8. , ui(new Ui::Login)
  9. {
  10. ui->setupUi(this);
  11. initForm();
  12. }
  13. Login::~Login()
  14. {
  15. delete ui;
  16. }
  17. void Login::initForm()
  18. {
  19. QPixmap pixmap(":/images/logo.png");
  20. QPixmap scaledPixmap = pixmap.scaled(283, 40, Qt::KeepAspectRatio);
  21. ui->label->setPixmap(scaledPixmap);
  22. }
  23. void Login::on_pushButton_clicked()
  24. {
  25. if (QStackedWidget *parent = qobject_cast<QStackedWidget*>(this->parentWidget())) {
  26. OriginalWnd *originalWnd = new OriginalWnd(this);
  27. parent->addWidget(originalWnd);
  28. parent->setCurrentIndex(parent->indexOf(originalWnd));
  29. }
  30. }