当前位置:网站首页>Using QT to make a beautiful login interface box
Using QT to make a beautiful login interface box
2022-06-25 17:50:00 【Autodesk_ Glodon】
/*** * ┌─┐ ┌─┐ + + * ┌──┘ ┴───────┘ ┴──┐++ * │ │ * │ ─── │++ + + + * ███████───███████ │+ * │ │+ * │ ─┴─ │ * │ │ * └───┐ ┌───┘ * │ │ * │ │ + + * │ │ * │ └──────────────┐ * │ │ * │ ├─┐ * │ ┌─┘ * │ │ * └─┐ ┐ ┌───────┬──┐ ┌──┘ + + + + * │ ─┤ ─┤ │ ─┤ ─┤ * └──┴──┘ └──┴──┘ + + + + * God bless * No code BUG! */
1、 Demonstration effect

2、 Make
2.1、 Create a new one Qwidget project

2.2、 Add interface components 
Adjust the container to the appropriate size , At the same time, adjust the whole canvas to the appropriate size .
2.3、 Add a button , label , Text components
The account password part uses Input Widgets:Line Edit
Logo And forgetting your password Display Widgets:TextLabel
Remember to select one Buttons:CheckBox
The login button uses Buttons:PushButton
modify Line Edit Default text properties , Click on two LineEdit Modify text properties placeholdertext by Username and Password.
2.4、 add to qss Style sheets
*{
background:rgb(255, 255, 255);
font-size:15px;
font-style:MingLiU-ExtB;
}
QFrame{
border:sold 10px rgba(0,0,0);
background-image:url(:/image/background.png);
}
QLineEdit{
color:#8d98a1;
background-color:#405361;
font-size:16px;
border-style:outset;
border-radius:10px;
font-style:MingLiU-ExtB;
}
QPushButton{
background:#ced1d8;
border-style:outset;
border-radius:10px;
font-style:MingLiU-ExtB;
}
QPushButton:pressed{
background-color:rgb(224,0,0);
border-style:inset;
font-style:MingLiU-ExtB;
}
QCheckBox{
background:rgba(85,170,255,0);
color:white;
font-style:MingLiU-ExtB;
}
QLabel{
background:rgba(85,170,255,0);
color:white;
font-style:MingLiU-ExtB;
font-size:14px;
}
#label_forget{
color:red;
text-decoration: underline
}

2.5、 Realize the function of minimizing window and closing window
Add a slot function to minimize the good close button :
void Widget::on_minButton_clicked()
{
showMinimized();
}
void Widget::on_closeButton_clicked()
{
close();
}
2.6、 hide widget Window border and background
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
// Go to the window border
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
// Set the window background to transparent ;
setAttribute(Qt::WA_TranslucentBackground);
}
2.7、 Realize the movable interface
void mouseMoveEvent(QMouseEvent *e);// Mouse movement
void mousePressEvent(QMouseEvent *e);// Press the mouse to move
void Widget::mouseMoveEvent(QMouseEvent* event)
{
if(event->buttons() & Qt::LeftButton)
{
// Move to the upper left corner
move(event->globalPos() - point);
}
}
void Widget::mousePressEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton)
{
// Find the coordinate difference
// Now click on the coordinates - Coordinates of the upper left corner of the window
point = event->globalPos() - this->frameGeometry().topLeft();
}
}
边栏推荐
- lock
- College Students' hot summer exchange, Rog star product phantom 16 flipped version / phantom 13 / phantom x appointment
- cgi通过odbc连接数据库
- Assembly language (5) register (memory access)
- [matlab] curve fitting
- 智能对话01-redis的安装
- [matlab] data statistical analysis
- Acy100 oil fume concentration online monitor for kitchen oil fume emission in catering industry
- 近来开发的一款简单易用的图可视化工具
- 怎么判断自己是否适合转行软件测试
猜你喜欢

HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast

有关均衡----简易版瓶颈模型

深入理解ELF文件

Three traversal methods of binary tree (recursive + non recursive) complete code

About Equilibrium - Simplified bottleneck model

ASP.NET超市便利店在线购物商城源码,针对周边配送系统
![[compilation principle] overview](/img/af/246750beb72842e83a19e42270c09e.png)
[compilation principle] overview
![Jerry's system clock setting is reset or invalid [chapter]](/img/c6/ee6b287af7d309f98abda8e11d674c.png)
Jerry's system clock setting is reset or invalid [chapter]

近来开发的一款简单易用的图可视化工具
![How Jerry used to output a clock source to the outside world [chapter]](/img/ea/161be6416726bcd80bb2823a5f6389.png)
How Jerry used to output a clock source to the outside world [chapter]
随机推荐
微博评论的计算架构
Video production material website arrangement
ACY100油烟浓度在线监控仪针对饮食业厨房油烟排放
观察者模式之通用消息发布与订阅
启牛蜻蜓点金下载是可以开户吗?开户安全吗
[efficiency] another note artifact is open source!
Use diskgenius to expand the capacity of system disk C
win10安装cuda的操作步骤(不断完美中)
[UVM practice== > episode_2] ~ VIP, VIP development, VIP release
container of()函数简介
Acy100 oil fume concentration online monitor for kitchen oil fume emission in catering industry
Swagger实现后台接口自动化文档
Assembly language (6) uses JCC instructions to construct branches and loops
Encryption trend: Fashion advances to the meta universe
About queryinterface functions
User scheduling problem
杰理之如何给外界输出一个时钟源使用【篇】
匯編語言(5)寄存器(內存訪問)
HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
Which of the top ten securities companies has the lowest commission? Is it safe to open an account