#include "mywidget.h"
Mywidget::Mywidget(QWidget *parent)
: QMainWindow(parent)
{
//===================窗口相关设置=============
//设置窗口名字
this->setWindowTitle("黑子进来讲话");
//设置窗口图标
this->setWindowIcon(QIcon("D:/ykx/c++/qttest/picture/ikun.jpg"));
//设置窗口大小
this->resize(900,400);
// //去掉窗口头
// this->setWindowFlag(Qt::FramelessWindowHint);
//固定窗口大小
this->setFixedSize(900,400);
//修改窗口颜色
this->setStyleSheet("background-color:white");
//===================标签相关设置=============
QLabel *lab1 = new QLabel(this);
//设置标签大小
lab1->resize(600,400);
//实例化一个动图
QMovie *mv = new QMovie("D:/ykx/c++/qttest/picture/640.gif");
//将动图设置到标签里
lab1->setMovie(mv);
//动图启动
mv->start();
//动图适应标签
lab1->setScaledContents(true);
QLabel *lab2 = new QLabel(this);
lab2->resize(40,40);
//移动标签2
lab2->move(620,200);
//设置图片
lab2->setPixmap(QPixmap("D:/ykx/c++/qttest/picture/640.jpg"));
//图适应标签
lab2->setScaledContents(true);
QLabel *lab3 = new QLabel(this);
lab3->resize(40,40);
lab3->move(620,260);
lab3->setPixmap(QPixmap("D:/ykx/c++/qttest/picture/640.png"));
lab3->setScaledContents(true);
QLabel *lab4 = new QLabel(this);
lab4->resize(80,80);
lab4->move(720,70);
QMovie *mv1 = new QMovie("D:/ykx/c++/qttest/picture/1.gif");
lab4->setMovie(mv1);
mv1->start();
lab4->setScaledContents(true);
//===================行编辑器相关设置=============
QLineEdit *ed1 = new QLineEdit(this);
ed1->move(670,200);
ed1->resize(200,40);
//设置占位
ed1->setPlaceholderText("小黑子速速输入账号");
QLineEdit *ed2 = new QLineEdit(this);
ed2->move(670,260);
ed2->resize(200,40);
//设置占位
ed2->setPlaceholderText("密码密码密码");
ed2->setEchoMode(QLineEdit::Password);
//===================按钮相关设置=============
QPushButton *bt1 = new QPushButton("黑子上号", this);
bt1->move(620, 320);
bt1->resize(250,50);
bt1->setStyleSheet("background-color:blue;color:white;border-radius:5px");
}
Mywidget::~Mywidget()
{
}
20240906 作业
最新推荐文章于 2024-11-03 09:30:00 发布