QT day1

搞一个登录界面:

cpp 复制代码
#include "ui_mywindow.h"
#include <QDebug>
#include <iostream>
#include <QIcon>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
MyWindow::MyWindow(QWidget *parent)
    : QWidget(parent)

{

    this->setFixedSize(500,400);
    this->setWindowTitle(" LOL ");
    this->setWindowIcon(QIcon("D:\\Qt\\day1\\01demo\\lol.png"));

    QLabel *lab1 = new QLabel("",this);
    lab1->resize(500,400);
    lab1->setPixmap(QPixmap("D:\\Qt\\day1\\01demo\\bizhi.png"));
    lab1->setScaledContents(true);

    QPushButton *btn1 = new QPushButton(QIcon("D:\\Qt\\day1\\01demo\\yonghu.png"),"",this);
    btn1->resize(40,40);
    btn1->move(80,180);
    QPushButton *btn2 = new QPushButton(QIcon("D:\\Qt\\day1\\01demo\\mima.png"),"",this);
    btn2->resize(btn1->size());
    btn2->move(btn1->x(),btn1->y()+60);
    QPushButton *btn3 = new QPushButton(QIcon("D:\\Qt\\day1\\01demo\\denglu.png"),"登录",this);
    QPushButton *btn4 = new QPushButton(QIcon("D:\\Qt\\day1\\01demo\\quxiao.png"),"取消",this);
    btn3->resize(60,30);
    btn4->resize(60,30);
    btn3->move(btn1->x()+130,btn1->y()+120);
    btn4->move(btn1->x()+200,btn1->y()+120);

    QLineEdit *edit1 = new QLineEdit(this);
    edit1->resize(200,40);
    edit1->move(btn1->x()+70,btn1->y());
    edit1->setPlaceholderText("账号/邮箱");
    edit1->setMaxLength(20);
    QLineEdit *edit2 = new QLineEdit(this);
    edit2->resize(200,40);
    edit2->move(btn2->x()+70,btn2->y());
    edit2->setEchoMode(QLineEdit::Password);
    edit2->setPlaceholderText("密码");
    edit2->setMaxLength(6);


}

MyWindow::~MyWindow()
{

}
相关推荐
KIDAKN8 分钟前
java--怎么定义枚举类
java·开发语言
海天胜景10 分钟前
C# 中常用的 字符串截取方法
开发语言·c#
tkevinjd1 小时前
C++中线程库的基本操作
开发语言·c++
CodeWithMe2 小时前
【C/C++】不同防止头文件重复包含的措施
c语言·开发语言·c++
子豪-中国机器人2 小时前
C++ 信息学奥赛总复习题答案解析
开发语言·c++·算法
oioihoii2 小时前
C++11列表初始化:从入门到精通
java·开发语言·c++
zdy12635746882 小时前
python第48天打卡
开发语言·python
whoarethenext2 小时前
使用 C++/OpenCV 创建动态流星雨特效 (实时动画)
开发语言·c++·opencv
Mr...Gan3 小时前
TypeScript
开发语言·javascript·typescript
GN已被占用3 小时前
Qt 窗口
qt