myWidget.cpp
#include "mywidget.h"MyWidget::MyWidget(QWidget *parent): QWidget(parent)
{//设置窗口标题this->setWindowTitle("QQ");//设置窗口图标this->setWindowIcon(QIcon("C:\\Users\\张谦\\Desktop\\pictrue\\qq.png"));//设置背景颜色this->setStyleSheet("background-color:rgb(173,200,255)");//设置窗口大小this->resize(428,330);//设置固定大小this->setFixedSize(428,330);//创建登录按钮QPushButton *btn1 = new QPushButton(this);btn1->setText("登录");btn1->setStyleSheet("background-color:rgb(28,196,252)");//移动按钮和设置大小btn1->move(110,250);btn1->resize(236,35);//行编辑器QLineEdit *edit1 = new QLineEdit(this);edit1->resize(256,35);edit1->move(100,150);edit1->setPlaceholderText("手机号/QQ号/邮箱");QLineEdit *edit2 = new QLineEdit(this);edit2->resize(256,35);edit2->move(100,200);edit2->setPlaceholderText("密码");edit2->setEchoMode(QLineEdit::Password);//设置标签类QLabel *lab1 = new QLabel(this);lab1->resize(428,128);//设置动态图QMovie *mv = new QMovie("C:\\Users\\张谦\\Desktop\\pictrue\\qqbackground.gif");lab1->setMovie(mv);mv->start();lab1->setScaledContents(true);//设置小图标QLabel *lab2 = new QLabel(this);lab2->resize(35,35);lab2->move(65,150);lab2->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\qq.png"));lab2->setScaledContents(true);QLabel *lab3 = new QLabel(this);lab3->resize(35,35);lab3->move(65,200);lab3->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\passwd.jpg"));lab3->setScaledContents(true);//放置头像QLabel *lab4 = new QLabel(this);lab4->resize(80,80);lab4->move(174,60);lab4->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\head.png"));lab4->setScaledContents(true);}MyWidget::~MyWidget()
{
}