QT--2

devtools/2024/10/21 1:51:02/

 Qt界面设计

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent)
{//=======窗口相关设置======this->resize(680,520);this->setFixedSize(680,520);this->setWindowTitle("Tim");this->setWindowFlag(Qt::FramelessWindowHint);this->setStyleSheet("background-color:rgb(255,255,255)");//=======标签相关设置======QLabel *lab1 = new QLabel(this);lab1->resize(400,520);lab1->setPixmap(QPixmap(":/pictrue/tim.png"));//=======行编辑器相关设置=======edit1 = new QLineEdit(this);edit1->resize(220,50);edit1->move(430,270-50);edit1->setPlaceholderText("QQ号码/手机号/邮箱");edit2 = new QLineEdit(this);edit2->resize(220,50);edit2->move(430,270);edit2->setPlaceholderText("密码");edit2->setEchoMode(QLineEdit::Password);//=======按钮相关设置=====QPushButton *btn1 = new QPushButton(this);btn1->resize(64,64);btn1->move(500-32,120-32);btn1->setStyleSheet("background-color:rgb(17,145,255);border-radius:32px");btn1->setIcon(QIcon(":\\pictrue\\qie.png"));QPushButton *btn2 = new QPushButton(this);btn2->resize(64,64);btn2->move(580-32,120-32);btn2->setStyleSheet("background-color:rgb(245,245,245);border-radius:32px");btn2->setIcon(QIcon(":\\pictrue\\wechat.png"));QPushButton *btn3 = new QPushButton("记住密码",this);btn3->resize(74,25);btn3->move(430,440);btn3->setIcon(QIcon(":\\pictrue\\kuang.png"));QPushButton *btn4 = new QPushButton("自动登陆",this);btn4->resize(74,25);btn4->move(430,470);btn4->setIcon(QIcon(":\\pictrue\\kuang.png"));QPushButton *btn5 = new QPushButton("找回密码",this);btn5->resize(74,25);btn5->move(600,440);QPushButton *btn6 = new QPushButton("注册密码",this);btn6->resize(74,25);btn6->move(600,470);btn7 = new QPushButton(this);btn7->resize(25,25);btn7->move(640,12);btn7->setIcon(QIcon(":\\pictrue\\x.png"));QPushButton *btn8 = new QPushButton(this);btn8->resize(25,25);btn8->move(605,12);btn8->setIcon(QIcon(":\\pictrue\\set.png"));btn9 = new QPushButton("登录",this);btn9->resize(220,50);btn9->move(430,270+80);btn9->setStyleSheet("background-color:red;border-radius:5px");connect(edit1, &QLineEdit::textChanged, this, &Widget::mySlots);connect(edit2, &QLineEdit::textChanged, this, &Widget::mySlots);connect(btn7, &QPushButton::clicked, this, &Widget::clicked);
}
Widget::~Widget()
{delete ui;
}
void Widget::clicked()
{this->close();
}
void Widget::mySlots()
{if(edit1->text().size()>=6&&edit2->text().size()>=6){btn9->setStyleSheet("background-color:green;border-radius:5px");}else{btn9->setStyleSheet("background-color:red;border-radius:5px");}
}

 


http://www.ppmy.cn/devtools/40904.html

相关文章

java设计模式八 享元

享元模式(Flyweight Pattern)是一种结构型设计模式,它通过共享技术有效地支持大量细粒度的对象。这种模式通过存储对象的外部状态在外部,而将不经常变化的内部状态(称为享元)存储在内部,以此来减…

FPGA第2篇,FPGA与CPU GPU APU DSP NPU TPU 之间的关系与区别

简介:首先,FPGA与CPU GPU APU NPU TPU DSP这些不同类型的处理器,可以被统称为"处理器"或者"加速器"。它们在计算机硬件系统中承担着核心的计算和处理任务,可以说是系统的"大脑"和"加速引擎&qu…

js原生三种弹框

第一种: alert("提示内容"):提示弹框; alert("提示"); 第二种: prompt("内容","输入框默认值"):输入弹框,第一个值输入框提示内容,第二个值输入框默…

Java基础知识(六) 字符串

六 字符串 6.1 String字符串 1、String类对象创建 定义String类对象格式:** 1)String 字符串变量名“字符串常量”; 2)String 字符串变量名new String(字符串常量); 3)String 字符串变量名; 字符串变量名“字符串常…

【C#】与cpp异同总结

1.类外部调用类内的静态变量和静态成员 C#中类内定义的静态变量和静态方法,在类外访问是用类名.变量 或者 类名.方法 public class MyClass {public static int MyStaticVariable 10;public static void MyStaticMethod(){Console.WriteLine("This is a sta…

kali搭建Vulhub靶场

简单概述 Vulhub是一个面向大众的开源漏洞靶场,借助Docker简单执行两条命令即可编译、运行一个完整的漏洞靶场镜像。旨在让漏洞复现变得更加简单,让安全研究者更加专注于漏洞原理本身。 Docker是一个开源的容器引擎,它有助于更快地交付应用…

从零手写实现 tomcat-06-servlet bio/thread/nio/netty 池化处理

创作缘由 平时使用 tomcat 等 web 服务器不可谓不多,但是一直一知半解。 于是想着自己实现一个简单版本,学习一下 tomcat 的精髓。 系列教程 从零手写实现 apache Tomcat-01-入门介绍 从零手写实现 apache Tomcat-02-web.xml 入门详细介绍 从零手写…

基于springboot+vue+Mysql的音乐翻唱与分享平台

开发语言:Java框架:springbootJDK版本:JDK1.8服务器:tomcat7数据库:mysql 5.7(一定要5.7版本)数据库工具:Navicat11开发软件:eclipse/myeclipse/ideaMaven包:…