赞
踩
widget.cpp
- #include "widget.h"
- #include "ui_widget.h"
-
- Widget::Widget(QWidget *parent)
- : QWidget(parent)
- , ui(new Ui::Widget)
- {
- ui->setupUi(this);
-
- this->setWindowFlag(Qt::FramelessWindowHint);
-
- this->setAttribute(Qt::WA_TranslucentBackground);//去掉空白部分
- }
-
-
- Widget::~Widget()
- {
- delete ui;
- }
-
-
- void Widget::on_pushButton_clicked()
- {
- if(ui->lineEdit->text()=="SteamId:admin"&&ui->lineEdit_2->text()=="Passwd:1")
- {
- int res = QMessageBox::information(this,"information","Log in success",QMessageBox::Ok);
- if(QMessageBox::Ok==res)
- {
- this->close();
- }
- }
- else
- {
- int res = QMessageBox::information(this,
- "information",
- "The account and password do not match,Do you want to log in again",
- QMessageBox::Yes|QMessageBox::No);
- if(res==QMessageBox::Yes)
- {
- ui->lineEdit_2->clear();
- QMessageBox::information(this,"information","continue Log in",QMessageBox::Ok);
- }
- }
- }
widget.h
- #ifndef WIDGET_H
- #define WIDGET_H
-
- #include <QWidget>
- #include <QMessageBox>
-
- QT_BEGIN_NAMESPACE
- namespace Ui { class Widget; }
- QT_END_NAMESPACE
-
- class Widget : public QWidget
- {
- Q_OBJECT
-
- public:
- Widget(QWidget *parent = nullptr);
- ~Widget();
-
- private slots:
- void on_pushButton_clicked();
-
- private:
- Ui::Widget *ui;
- };
- #endif // WIDGET_H
样式表代码
- *{
- background-color:rgb(255,255,255)
- }
-
- QFrame#frame{
- border-image: url(:/Logo/AK.png);
- }
-
- #frame_2{
- background-color: rgba(185, 184, 184, 100);
- }
- QLabel#label{
- border-radius:30px;
-
- background-color: rgba(79, 79, 79, 100);
- }
- #label_2{
- background:transparent;
-
- font: 75 16pt "华文行楷";
-
- color: rgba(255, 255, 255, 100);
- }
- #label_3{
- background:transparent;
-
- font: 75 8pt "微软雅黑";
-
- color: rgba(255, 255, 255, 100);
- }
- QLineEdit{
- background:transparent;
-
- border:none;
-
- border-bottom:1px solid rgba(255, 255, 255, 100);
-
- font: 8pt "微软雅黑";
-
- color: rgba(255, 255, 255, 100);
- }
-
- QPushButton{
- border-radius:10px;
-
- background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(90, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));
-
- font: 75 10pt "微软雅黑";
-
- color: rgba(255, 255, 255, 100);
- }
-
- QPushButton:hover{/*鼠标的移动*/
- border-radius:10px;
-
- background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(48, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));
- font: 75 10pt "微软雅黑";
- color: rgba(255, 255, 255, 100);
- }
-
- QPushButton:pressed{/*鼠标点击*/
- border-radius:10px;
-
- background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(90, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));
-
- font: 75 10pt "微软雅黑";
-
- color: rgba(255, 255, 255, 100);
-
- padding-top:5px;
- padding-left:5px;
- }
成功登录
登录失败
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。