Qt day1登录界面设计
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowIcon(QIcon("D:/icon_图标/icon_6j5ninlne8f/xiaoxi.png"));
this->setWindowTitle("chat app");
this->setFixedSize(400,565);
this->setStyleSheet("background-color: #4B2C91; color: white;");
QPushButton * btn1 = new QPushButton;
btn1->setParent(this);
btn1->setText("登录");
btn1->resize(310,40);
btn1->move(40,400);
btn1->setStyleSheet("color:white;background-color:skyblue;");
QLabel * lab1 = new QLabel;
lab1->setParent(this);
lab1->setText("扫码登陆");
lab1->move(110,500);
QLabel * lab2 = new QLabel;
lab2->setParent(this);
lab2->setText("其他方式");
lab2->move(lab1->x()+100,500);
QLabel * lab4 = new QLabel;
lab4->setParent(this);
lab4->resize(90, 90);
lab4->move(150, 60);
QPixmap pixmap("D:/icon_图标/icon_6j5ninlne8f/huore.png");
lab4->setPixmap(pixmap.scaled(lab4->size(), Qt::KeepAspectRatio));
QLineEdit * edit1 = new QLineEdit;
edit1->setParent(this);
edit1->resize(310,40);
edit1->move(40,200);
edit1->setText("输入账号");
edit1->setAlignment(Qt::AlignCenter);
QLineEdit * edit2 = new QLineEdit;
edit2->setParent(this);
edit2->resize(310,40);
edit2->move(40,275);
edit2->setText("输入密码");
edit2->setAlignment(Qt::AlignCenter);
edit2->setEchoMode(QLineEdit::Password);
QRadioButton * rbt1 = new QRadioButton;
rbt1->setParent(this);
rbt1->resize(8,8);
rbt1->move(40, 350);
rbt1->setStyleSheet("QRadioButton { border-radius: 10px; width: 20px; height: 20px; }");
QLabel * lab3 = new QLabel;
lab3->setParent(this);
lab3->setText("我已阅读同意协议并同意登录");
lab3->move(55,348);
}
Widget::~Widget()
{
delete ui;
}
成果图对比
原文地址:https://blog.csdn.net/shencanglang/article/details/142621767
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!