qt-4.8

复制代码
#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( )

相关推荐
q***46529 分钟前
Win10下安装 Redis
数据库·redis·缓存
p***92482 小时前
深入理解与实战SQL IFNULL()函数
数据库·sql·oracle
q***81644 小时前
MySQL:数据查询-limit
数据库·mysql
p***92484 小时前
DBeaver连接本地MySQL、创建数据库表的基础操作
数据库·mysql
JIngJaneIL5 小时前
社区互助|社区交易|基于springboot+vue的社区互助交易系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·社区互助
晚风吹人醒.6 小时前
缓存中间件Redis安装及功能演示、企业案例
linux·数据库·redis·ubuntu·缓存·中间件
Y***98516 小时前
DVWA靶场通关——SQL Injection篇
数据库·sql
Yawesh_best6 小时前
告别系统壁垒!WSL+cpolar 让跨平台开发效率翻倍
运维·服务器·数据库·笔记·web安全
蒋士峰DBA修行之路6 小时前
实验二十八 SQL PATCH调优
数据库·sql·gaussdb
I***t7167 小时前
一条sql 在MySQL中是如何执行的
数据库·sql·mysql