登录框:
#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent): QMainWindow(parent)
{//窗口设置this->setFixedSize(600,600); //大小this->setWindowTitle("MUMU"); //文本内容this->setWindowOpacity(0.8); //透明度this->setWindowIcon(QIcon("C:\\Users\\12199\\Desktop\\交友.png")); //图标//QLabelQLabel *lab1 = new QLabel(this);lab1->resize(600,230);lab1->setPixmap(QPixmap("C:\\Users\\12199\\Desktop\\%BFE6[VFX23LJ_$$CFVHGAL.png"));lab1->setScaledContents(true); //设置文本自适应QLabel *lab2 = new QLabel("账号",this);lab2->resize(60,40);lab2->move(70,280);lab2->setAlignment(Qt::AlignCenter);lab2->setPixmap(QPixmap("C:\\Users\\12199\\Desktop\\icon_交友.png"));lab2->setScaledContents(true); //设置文本自适应QLabel *lab3 = new QLabel("密码",this);lab3->resize(60,40);lab3->move(70,340);lab3->setAlignment(Qt::AlignCenter);lab3->setPixmap(QPixmap("C:\\Users\\12199\\Desktop\\密码.png"));lab3->setScaledContents(true); //设置文本自适应//QLineEditQLineEdit *edit1 = new QLineEdit("账户",this);edit1->resize(230,40);edit1->move(150,280);QLineEdit *edit2 = new QLineEdit("密码",this);edit2->resize(230,40);edit2->move(150,340);edit2->setEchoMode(QLineEdit::Password);//QPushbuttonQPushButton *btn1 = new QPushButton("登录", this);btn1->resize(80,30);btn1->move(350,450);btn1->setIcon(QIcon("C:\\Users\\12199\\Desktop\\征婚交友.png"));QPushButton *btn2 = new QPushButton("取消", this);btn2->resize(80,30);btn2->move(480,450);btn2->setIcon(QIcon("C:\\Users\\12199\\Desktop\\已取消.png"));}MainWindow::~MainWindow()
{
}
思维导图: