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

}
相关推荐
是苏浙1 天前
零基础入门C语言之C语言实现数据结构之栈
c语言·开发语言·数据结构
后端小张1 天前
【JAVA 进阶】SpringBoot 事务深度解析:从理论到实践的完整指南
java·开发语言·spring boot·后端·spring·spring cloud·事务
y***54881 天前
C++在游戏引擎中的开发
开发语言·c++·游戏引擎
郝学胜-神的一滴1 天前
Python高级编程技术深度解析与实战指南
开发语言·python·程序人生·个人开发
charlie1145141911 天前
使用 Poetry + VS Code 创建你的第一个 Flask 工程
开发语言·笔记·后端·python·学习·flask·教程
Codeking__1 天前
查缺补漏c语言——c标准字符串函数
c语言·开发语言
rainbow_lucky01061 天前
Word-like编辑器
qt·编辑器·word-like
铅笔小新z1 天前
【C++】从理论到实践:类和对象完全指南(中)
开发语言·c++
千疑千寻~1 天前
【C++】std::move与std::forward函数的区别
开发语言·c++
Murphy_lx1 天前
C++ 条件变量
linux·开发语言·c++