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

}
相关推荐
秦老师Q7 小时前
php零基础入门到实战,从语法到框架,一篇搞定
开发语言·php
驭渊的小故事7 小时前
多线程02
java·开发语言·jvm
阿里嘎多学长7 小时前
2026-09-09 GitHub 热点项目精选
开发语言·程序员·github·代码托管
君顾18 小时前
本地折扣卡 CPS 平台搭建:从系统架构到落地实战
java·开发语言·折扣卡
liangshanbo12159 小时前
手写 Function.prototype.call 与 Function.prototype.apply 面试题满分答案
开发语言·javascript·原型模式
Zenova EdgeOS9 小时前
C++ 工业边缘 libcurl HTTP 客户端实战
开发语言·c++·网络协议·边缘计算
Jackson_GJH9 小时前
Qt 右键自定义菜单的实现
开发语言·c++·qt
CoderYanger9 小时前
前端基础——JavaScript(WebAPI)(下篇)
java·开发语言·前端·javascript·程序人生·面试·职场和发展
小木_.10 小时前
Python 离线识别滑块缺口距离,项目推荐
开发语言·python·滑块识别·人机验证·滑块缺口·缺口识别
liliangcsdn10 小时前
因子权重矩阵处理-因子权重收缩Shrinkage算法的探索
开发语言·python·机器学习