1. 思维导图
2. 自由发挥应用场景实现一个登录窗口界面。
代码(mywidget.cpp):
#include "mywidget.h"MyWidget::MyWidget(QWidget *parent): QWidget(parent)
{//=== windows setup ===//setup windows sizethis->resize(600, 370);//set window fixed sizethis->setFixedSize(600, 370);//set window without framethis->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 colorplbl_screen->setStyleSheet("background-color:#8EDE99 "); //#8EDDF9 , 142, 221, 249 rgb(147, 226, 254 )// create movieQMovie *pmv = new QMovie("C:/QtProjects/qt/day01/pictrue/screen.gif");pmv->scaledSize();//set lable's movieplbl_screen->setMovie(pmv);//start moivepmv->start();//set to fit labelplbl_screen->setScaledContents(true);//setup lable titleQLabel *plbl_title = new QLabel("smart screen system",this);plbl_title->resize(150,20);plbl_title->move(460, 10);//setup LineEdit user name inputQLineEdit *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 inputQLineEdit *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 pushbuttonQPushButton *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()
{
}
运行效果