当前位置: 首页 > news >正文

QT day1 (图形界面设计)

要求:

 功能函数模块

#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{qDebug("%s","hello world");//qDebug() << "hello world" ;//设置固定尺寸this->setFixedSize(QSize(500,420));qDebug()<<"title : "<<this->windowTitle();//设置窗口名称this->setWindowTitle("QQ");qDebug()<<"title : "<<this->windowTitle();this->setWindowIcon(QIcon("E:/QQdownload/icon_nhgbq8i4bf/QQ.png"));//this->setStyleSheet("background-color:skyblue;");//设置透明度// this->setWindowOpacity(0.8);QLabel *lab3=new QLabel(this);lab3->resize(500,200);lab3->setScaledContents(true);lab3->setPixmap(QPixmap("E:/QQdownload/icon_nhgbq8i4bf/qww.png"));//设置纯净窗口//this->setWindowFlags(Qt::FramelessWindowHint);//按钮类QPushButton//手动定义一个按钮,取名按钮1;QPushButton *bin1 = new QPushButton;//bin1->show();bin1->setParent(this);//重新设置大小bin1->resize(100,30);bin1->setText("登录");bin1->move(180,350);bin1->setStyleSheet("background-color:skyblue;");//2.手动构造一个按钮,并在构造时给定父组件QPushButton *bin2=new QPushButton(this);bin2->resize(bin1->size());bin2->setText("取消");bin2->move(300,350);bin2->setStyleSheet("background-color:skyblue;");QPushButton *bin4 = new QPushButton(QIcon("E:/QQdownload/icon_nhgbq8i4bf/QQ.png"),"注册",this);bin4->resize(bin1->size());bin4->move(10,380);bin4->setStyleSheet("background-color:white;");bin4->setEnabled(false);//5,手动构造行编辑器QLineEdit *edit1 = new QLineEdit(this);edit1->resize(200,35);edit1->move(150,220);edit1->setStyleSheet("background-color:white;");edit1->setPlaceholderText("账号");QLineEdit *edit2 = new QLineEdit(this);edit2->move(150,270);edit2->resize(edit1->size());edit2->setEchoMode(QLineEdit::Password);edit2->setPlaceholderText("密码");edit2->setStyleSheet("background-color:white;");//    QLineEdit *edit3 = new QLineEdit("请输入",this);//    edit3->move(250,150);//    edit3->resize(edit1->size());//清空文本内容edit2->clear();/////7、手动构造一个标签QLabel *lab1=new QLabel("账户:",this);lab1->resize(30,35);lab1->move(100,220);lab1->setScaledContents(true);lab1->setPixmap(QPixmap("E:/QQdownload/icon_nhgbq8i4bf/QQ.png"));QLabel *lab2=new QLabel("密码:",this);lab2->resize(lab1->size());lab2->move(100,270);//  lab2->setStyleSheet("background-color:skyblue;");lab2->setScaledContents(true);lab2->setPixmap(QPixmap("E:/QQdownload/icon_nhgbq8i4bf/denglumima.png"));}MainWindow::~MainWindow()
{delete ui;
}

 做出如下效果图:

 

 

http://www.lryc.cn/news/93254.html

相关文章:

  • JS逆向系列之猿人学爬虫第9题-动态cookie2
  • Java ~ Reference ~ FinalizerHistogram【总结】
  • 【MySQL】一文带你了解SQL
  • python基础学习3【NumPy矩阵与通用函数【矩阵相乘+平方+广播机制+转置】+ save、load、sort、repeat、unique、鸢尾花1】
  • 【Spring学习之更简单的读取和存储Bean对象】教会你使用五大类注解和方法注解去存储 Bean 对象
  • 微客云原生淘宝客APP小程序系统如何定制
  • QT CTK插件开发(六) 多对一插件
  • 【Spring Boot整合MyBatis教程】
  • ThinkPHP3.2.3通过局域网手机访问项目
  • 2306C++虚继承
  • 使用oracle遇到问题笔记
  • 我和老刘又被搞惨了
  • DDD--基本概念
  • chatgpt赋能python:Python多行注释
  • JSP详细基础教学
  • mysql修改登录用户的密码
  • SNAT和DNAT
  • 好程序员:月薪2万程序员的简历,原来长这个样子!
  • STM32之FreeRTOS
  • 有趣的图(二)(56)
  • Linux之环境变量
  • python带你制作自动点赞小程序,让我看看谁还在呆呆的手动点赞
  • shell脚本编写辅助命令
  • 高并发编程:线程池
  • 微信小程序开发uni-app-8分钟上手开发
  • 【C++11】 initializer_list | 右值引用 | 移动构造 | 完美转发
  • 基于html+css的图展示122
  • 《Unix环境高级编程》/bin/sh: ./fixup.awk: Permission denied
  • 万字长文+示例代码详解DDD中常用的架构(含代码示例)
  • Debezium UI On ECS编译安装及开放Web访问