结果对比
代码
#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
this->setWindowIcon(QIcon("C:\\Users\\86156\\Desktop\\p\\4.jpg"));
this->resize(1080,610);//设置窗口大小
this->setFixedSize(1080,610);//固定窗口大小
this->setStyleSheet("background-color:black");//设置背景颜色
this->setWindowFlag(Qt::FramelessWindowHint);//隐藏头部
QPushButton *btn1=new QPushButton;
btn1->setParent(this);
btn1->setText("登录");
btn1->setStyleSheet("background-color:rgb(255,128,52)");
btn1->resize(245,50);
btn1->move(418,484);
QLineEdit *edit1=new QLineEdit(this);
edit1->resize(245,43);
edit1->move(418,393);
edit1->setPlaceholderText("请输入密码");
edit1->setStyleSheet("background-color:white");
edit1->setEchoMode(QLineEdit::Password);//密码
QLineEdit *edit0=new QLineEdit(this);
edit0->setPlaceholderText("请输入QQ号码");
edit0->setStyleSheet("background-color:white");
edit0->resize(245,43);
edit0->move(418,340);
QLineEdit *edit2=new QLineEdit("保存账号",this);
edit2->setStyleSheet("background-color:white");
edit2->resize(70,20);
edit2->move(448,445);
QLineEdit *edit3=new QLineEdit("",this);
edit3->setStyleSheet("background-color:white");
edit3->resize(20,20);
edit3->move(418,445);
QLabel *lab=new QLabel(this);
//lab->move(200,200);
lab->resize(341,610);
lab->setPixmap(QPixmap("C:\\Users\\86156\\Desktop\\p\\1.jpg"));
lab->setScaledContents(true);
//lab ->setStyleSheet("background-color:white");
QLabel *lab1=new QLabel(this);
lab1->move(739,0);
lab1->resize(341,610);
lab1->setScaledContents(true);
lab1->setPixmap(QPixmap("C:\\Users\\86156\\Desktop\\p\\2.jpg"));
//lab1 ->setStyleSheet("background-color:white");
QLabel *lab2=new QLabel(this);//图标
lab2->move(477,100);
lab2->resize(100,110);
lab2->setPixmap(QPixmap("C:\\Users\\86156\\Desktop\\p\\4.jpg"));
//lab1 ->setStyleSheet("background-color:white");
QLabel *lab6=new QLabel(this);
lab6->move(458,230);
lab6->resize(150,100);
lab6->setScaledContents(true);
lab6->setPixmap(QPixmap("C:\\Users\\86156\\Desktop\\p\\6.jpg"));
}
MyWidget::~MyWidget()
{
}