#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
this->setWindowTitle("COD");
this->setWindowIcon(QIcon("C:\\Users\\15934\\Desktop\\Qt-qq\\cod1"));
//this->setWindowFlag(Qt::FramelessWindowHint);
this->setFixedSize(800,500);
QLabel *lab1 = new QLabel(this);
lab1->resize(800,500);
lab1->setPixmap(QPixmap("C:\\Users\\15934\\Desktop\\Qt-qq\\cod2"));
lab1->setScaledContents((true));
QPushButton *btn1 = new QPushButton("登录账号",this);
btn1->resize(200,60);
btn1->move(300,400);
btn1->setIcon(QIcon("C:\\Users\\15934\\Desktop\\Qt-qq\\cod1"));
QLineEdit *edit1 = new QLineEdit(this);
edit1->resize(300,45);
edit1->move(250,280);
edit1->setPlaceholderText("输入Steam账号\\动视邮箱");
QLineEdit *edit2 = new QLineEdit(this);
edit2->resize(300,45);
edit2->move(250,340);
edit2->setPlaceholderText("输入密码");
edit2->setEchoMode(QLineEdit::Password);
QLabel *lab2 = new QLabel("注册账号",this);
lab2->move(240,415);
QLabel *lab3 = new QLabel("找回密码",this);
lab3->move(240,435);
this->setWindowFlag(Qt::FramelessWindowHint);
}
Widget::~Widget()
{
}
设置窗口标题:setWindowTitle("")
设置窗口图标:setWindowIcon(QIcon("路径"))
设置背景颜色:setStyleSheet("background: ")
设置窗口大小:resize( )
设置窗口大小固定:setFixedSize( )
设置纯净窗口:setWindFlag(Qt::FramelessWindowHint)
QPushButton *btn = new QPushButton(this);
按钮设置文本:btn->setText(" ")
btn->move( )
设置按钮是否可用:btn->setEnabled(false)
QLineEdit *edit = new QLineEdit(this)
设置显示模式:edit->setEchMode(QLineEdit::Password)
设置占位:edit:setPlaceholderText(" ")
QLabel *lab = new QLabel(this)
设置图片:lab->setpixmap(QPixmap("图片路径"))
自动适应:lab->setScaledContents(true/f)
接受动图类:QMovie *mv = new QMovie("动图路径")
将动图设置在标签中:lab->setMovie(mv)
让动图动起来:mv->start( )