#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(640,520);
//设置窗口标题
this->setWindowTitle("QQ");
//设置窗口图标
this->setWindowIcon(QIcon("C:\\Logo\\44.png"));
this->setStyleSheet("background-color:white");
//定义一个标签,并直接指定父组件,(背景)
QLabel *lab1 = new QLabel("背景",this);
lab1->setPixmap(QPixmap("C:/Logo/beijing.png"));
lab1->resize(640,200);
//背景标签(企鹅),(QQ)
QLabel *lab2 = new QLabel("标签",this);
lab2->setStyleSheet("background-color:white");
lab2->setPixmap(QPixmap("C:/Logo/11.png"));
lab2->resize(39,44);
lab2->move(8,8);
lab2->setScaledContents(true);
//QLabel *lab3 = new QLabel("QQ",this);
//lab3->resize(54,43);
//lab3->move(54,8);
//设置文本大小
//lab3->setFont(QFont("微软雅黑",13));
//lab3->setStyleSheet("color:pink");
//头像
QLabel *lab4 = new QLabel("头像",this);
lab4->setFont(QFont("微软雅黑",40));
lab4->move(240,120);
lab4->resize(120,125);
lab4->setPixmap(QPixmap("C:/Logo/uu.png"));
lab4->setStyleSheet("border-radius:60");
//自适应大小
lab4->setScaledContents(true);
//账号密码
QLabel *lab5 = new QLabel("账号",this);
lab5->resize(33,44);
lab5->move(155,260);
lab5->setPixmap(QPixmap("C:/Logo/44.png"));
lab5->setScaledContents(true);
QLabel *lab6 = new QLabel("密码",this);
lab6->resize(19,29);
lab6->move(160,315);
lab6->setPixmap(QPixmap("C:/Logo/denglumima.png"));
lab6->setScaledContents(true);
//设置行编辑器
QLineEdit *edit1 = new QLineEdit(this);
edit1->resize(230,44);
edit1->move(190,260);
edit1->setStyleSheet("border:none");//像素1px
//设置占位文本
edit1->setPlaceholderText("QQ号/手机号/邮箱");
QLineEdit *edit2 = new QLineEdit(this);
edit2->resize(230,44);
edit2->move(190,313);
edit2->setStyleSheet("border:none");//像素1px
//设置占位文本
edit2->setPlaceholderText("密码");
edit2->setEchoMode(QLineEdit::Password);
//按钮
QPushButton *btn1 = new QPushButton(QIcon("C:\\Logo\\denglu_1.png"), "登录", this);
btn1->resize(120,60);
btn1->move(165,360);
btn1->setStyleSheet("background-color:skyblue;border-radius:10");
QPushButton *btn2 = new QPushButton(QIcon("C:\\Logo\\quxiao.png"), "取消", this);
btn2->resize(btn1->size());
btn2->move(310,360);
btn2->setStyleSheet("background-color:skyblue;border-radius:10");
}
MainWindow::~MainWindow()
{
delete ui;
}