QT--2

news/2024/10/18 8:20: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/news/1457006.html

相关文章

免收隔夜费的外汇平台特点与选择

外汇交易是一种全球范围内的投资活动,参与者包括银行、机构投资者、交易商和个人交易者。在外汇交易中,隔夜费(也称为掉期费或展期费)是当持仓过夜时,因货币对利率差异而产生的费用。这种费用对一些交易者,…

【无标题】程序设计和c语言-谭浩强配套(适合专升本)

一晃大半年没更新了,一直在备考,想着这几天把前段时间学的c语言给大家分享一下,在此做了一个专栏,有需要的小伙伴可私信获取。 说明:本专栏所有内容皆适合专升本复习资料,本人手上也有日常刷题整理的错题以…

C语言—控制语句

控制语句就是用来实现对流程的选择、循环、转向和返回等控制行为。 分支语句 if语句 基本结构 if(表达式) { 语句块1; } else { 语句块2; } 执行顺序: 如果表达式判断成立(即表达式为真),则执行语句块…

JAVA面试常见面试问题01

1、队列系列 1.1、选型 ActiveMq ⼩规模场景,有较低概率丢失消息,官方社区维护少 RabbitMq ⼩规模场景,吞吐量⽐较低,消息积累会严重影响性能 RocketMQ ⼩规模场景,官⽅⽂档和周边⽣态还不够成熟 Kafka 大规模场景…

leetcode 547.省份数量

思路:dfs 或者这道题用bfs也是可以的。 这道题有点迷惑性,这里的数组给的是无向图的数组,而并不是地图,这里需要着重注意一下。 而后,这里的状态数组st没必要是二维的,我们并不会去遍历所给的数组&#…

latex参考文献引用网址,不显示网址问题

以引用UCI数据集为例 1、加入宏包 \usepackage{url} 2、在参考文献bib文件中加入网址文献 misc{UCI, author {{D. Dua, E. Karra Taniskidou}}, year {2024}, title {UCI Machine Learning Repository}, howpublished {\url{http://archive.ics.uci.edu/ml}} } 完成&#x…

大厂Java面试题:MyBatis中有几种加载映射器(Mapper.xml)的方式?

大家好,我是王有志。 今天给大家带来的是一道来自京东的 MyBatis 面试题:MyBatis 中有几种加载映射器(Mapper.xml)的方式? 常见加载 MyBatis 映射器的方式有 5 种,可以根据不同的使用方式来进行具体区分&…

学QT的第二天~

小黑子鉴别界面 #include "mywidget.h" void MyWidget::bth1() { if(edit3 ->text()"520cxk"&&edit4 ->text()"1314520") { qDebug()<< "你好&#xff0c;真爱粉"; this->close(); } else { speecher->sa…