9.15号作业

博客主要围绕Qt展开,包含两方面内容,一是实现登录注册界面,二是涉及思维导图相关内容,体现了Qt在界面设计及相关功能实现上的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.实现登录注册界面

#include "mytest.h"
#include "ui_mytest.h"

mytest::mytest(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::mytest)
{
    ui->setupUi(this);
    //构造一个登录按钮,并指定父组件,图标,和文本内容
     QPushButton *btn1=new QPushButton(QIcon("C:\\Users\\wuhuiwu\\Desktop\\login.png"),"登录",this);
    //设置固定长度
    this->setFixedSize(400,300);
    //设置窗口标题
    this->setWindowTitle("Widget");
    //设置窗口图标
    this->setWindowIcon(QIcon("C:\\Users\\wuhuiwu\\Desktop\\wodepeizhenshi.png"));
    //设置窗口尺寸
    btn1->setFixedSize(70,40);
    //移动按钮
    btn1->move(150,250);
    //再构造一个按钮,并给定父组件,图标,文本内容
    QPushButton *btn2=new QPushButton(QIcon("C:\\Users\\wuhuiwu\\Desktop\\cancel.png"),"取消",this);
    //设置按钮尺寸
    btn2->setFixedSize(70,40);
    //移动按钮
    btn2->move(btn1->x()+70,btn1->y());
    //实例化一个标签并指定父组件
    QLabel *lab1=new QLabel(this);
    //设置尺寸
    lab1->resize(400,150);
    //设置图片
    lab1->setPixmap(QPixmap("C:\\Users\\wuhuiwu\\Desktop\\7ba4d7fbf4c74c3491faffcd2a2045b2.jpg"));
     lab1->setScaledContents(true);
    //实例化一个标签并指定父组件
    QLabel *lab2=new QLabel(this);
    //设置图片
    lab2->setPixmap(QPixmap("C:\\Users\\wuhuiwu\\Desktop\\userName.jpg"));
    //设置尺寸
    lab2->resize(40,30);
    //引动图标
     lab2->move(120,160);
      lab2->setScaledContents(true);
     //实例化一个标签并指定父组件
     QLabel *lab3=new QLabel(this);
     //设置图片
     lab3->setPixmap(QPixmap("C:\\Users\\wuhuiwu\\Desktop\\passwd.jpg"));
     //设置尺寸
     lab3->resize(40,30);
     //移动图标
      lab3->move(lab2->x(),lab2->y()+50);
       lab3->setScaledContents(true);
      //构建一个文本编辑器
      QLineEdit *edit1=new QLineEdit(this);
      //设置尺寸
      edit1->resize(100,30);
      edit1->move(lab2->x()+60,lab2->y());
      //设置占位文本
        edit1->setPlaceholderText("账号名");

      //构建一个文本编辑器
      QLineEdit *edit2=new QLineEdit(this);
      //设置尺寸
      edit2->resize(100,30);
      edit2->move(edit1->x(),edit1->y()+50);
      //设置回显模式
       edit2->setEchoMode(QLineEdit::Password);
       edit1->setMaxLength(6);

}

mytest::~mytest()
{
    delete ui;
}

2.思维导图

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值