Qt / day01

1. 思维导图

2. 自由发挥应用场景实现一个登录窗口界面。

代码(mywidget.cpp):

#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //=== windows setup ===
    //setup windows size
    this->resize(600, 370);

    //set window fixed size
    this->setFixedSize(600, 370);

    //set window without frame
    this->setWindowFlag(Qt::FramelessWindowHint);

    //=== set label moive ===
    QLabel *plbl_screen = new QLabel(this);
    plbl_screen->resize(230,370);
    plbl_screen->move(0, 0);
    //setup label background color
    plbl_screen->setStyleSheet("background-color:#8EDE99  "); //#8EDDF9 , 142, 221, 249 rgb(147, 226, 254 )
    // create movie
    QMovie *pmv = new QMovie("C:/QtProjects/qt/day01/pictrue/screen.gif");
     pmv->scaledSize();
    //set lable's movie
    plbl_screen->setMovie(pmv);
    //start moive
    pmv->start();
    //set to fit label
    plbl_screen->setScaledContents(true);

    //setup lable title
     QLabel *plbl_title = new QLabel("smart screen system",this);
     plbl_title->resize(150,20);
     plbl_title->move(460, 10);


    //setup LineEdit user name input
    QLineEdit *plnedt_usr = new QLineEdit(this);
    plnedt_usr->setEchoMode(QLineEdit::Normal);
    plnedt_usr->setPlaceholderText("please input user name");
    plnedt_usr->resize(270, 30);
    plnedt_usr->move(290,180);

    //setup LineEdit password input
    QLineEdit *plnedt_psw = new QLineEdit(this);
    plnedt_psw->setEchoMode(QLineEdit::Password);
    plnedt_psw->setPlaceholderText("please input password");
    plnedt_psw->resize(270, 30);
    plnedt_psw->move(290, 230);

    //setup pushbutton
    QPushButton *pbtn_submit = new QPushButton("login", this);
    pbtn_submit->resize(270, 30);
    pbtn_submit->move(290, 290);
    pbtn_submit->setStyleSheet("background-color: rgb(147, 226, 254 )");

}

MyWidget::~MyWidget()
{
}

运行效果

相关推荐

  1. <span style='color:red;'>QTday</span>4

    QTday4

    2024-01-09 04:18:02      31 阅读
  2. <span style='color:red;'>QTday</span>3

    QTday3

    2024-01-09 04:18:02      16 阅读
  3. <span style='color:red;'>QTDay</span>3

    QTDay3

    2024-01-09 04:18:02      9 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-09 04:18:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-09 04:18:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-09 04:18:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-09 04:18:02       18 阅读

热门阅读

  1. 检查unity打包IOS包含dlopen的块

    2024-01-09 04:18:02       29 阅读
  2. 面试经典150题(72-77)

    2024-01-09 04:18:02       34 阅读
  3. React Hooks之useState、useRef

    2024-01-09 04:18:02       50 阅读
  4. Mysql 中的常用命令

    2024-01-09 04:18:02       33 阅读
  5. 了解一下InternLM2

    2024-01-09 04:18:02       36 阅读
  6. linux 设备模型之类

    2024-01-09 04:18:02       29 阅读
  7. 复杂度分析-时间复杂度和空间复杂度

    2024-01-09 04:18:02       32 阅读
  8. mysql 通过 binglog 恢复数据

    2024-01-09 04:18:02       30 阅读
  9. 器件转行验证,秋招offer25-50w上岸!

    2024-01-09 04:18:02       36 阅读