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

}
相关推荐
2301_7943339114 分钟前
Maven 概述、安装、配置、仓库、私服详解
java·开发语言·jvm·开源·maven
葬爱家族小阿杰27 分钟前
python执行测试用例,allure报乱码且未成功生成报告
开发语言·python·测试用例
酷爱码30 分钟前
Python实现简单音频数据压缩与解压算法
开发语言·python
keepquietl37 分钟前
MQTT示例体验(C)
c语言·开发语言
newxtc43 分钟前
【JJ斗地主-注册安全分析报告】
开发语言·javascript·人工智能·安全
程序猿小D1 小时前
第22节 Node.js JXcore 打包
开发语言·人工智能·vscode·node.js·c#
小猫咪怎么会有坏心思呢1 小时前
华为OD机试-最短木板长度-二分法(A卷,100分)
java·开发语言·华为od
wo3258661451 小时前
浪潮交换机配置track检测实现高速公路收费网络主备切换NQA
开发语言·网络·php
知识中的海王1 小时前
Python html 库用法详解
开发语言·python