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()
{

}
相关推荐
everyStudy26 分钟前
JS中判断字符串中是否包含指定字符
开发语言·前端·javascript
luthane28 分钟前
python 实现average mean平均数算法
开发语言·python·算法
凡人的AI工具箱1 小时前
AI教你学Python 第11天 : 局部变量与全局变量
开发语言·人工智能·后端·python
sleP4o1 小时前
Python操作MySQL
开发语言·python·mysql
是店小二呀1 小时前
【C++】C++ STL探索:Priority Queue与仿函数的深入解析
开发语言·c++·后端
洛寒瑜1 小时前
【读书笔记-《30天自制操作系统》-23】Day24
开发语言·汇编·笔记·操作系统·应用程序
ephemerals__1 小时前
【c++】动态内存管理
开发语言·c++
咩咩觉主1 小时前
en造数据结构与算法C# 群组行为优化 和 头鸟控制
开发语言·c#
doll ~CJ1 小时前
可视化工具箱-Visualization Toolkit(VTK)
qt·vtk_9.1.0·release_x64
CVer儿1 小时前
条件编译代码记录
开发语言·c++