QT day1

#include "mywnd.h"
 
  
Mywnd::Mywnd(QWidget *parent)
    : QWidget(parent)
{
    qDebug()<< this->size();    //获取界面的尺寸
    this->setFixedSize(380,600);  //固定界面尺寸
    this->setWindowTitle("小黑子app");     //设置窗口标题
    this->setWindowIcon(QIcon("C:\\Users\\Administrator\\Desktop\\QQ20230915190020.png"));
 
  
    QPushButton *btn1 = new QPushButton(this);  //构造一个按钮并直接指定父组件
    btn1->setText("登录");    //设置按钮文本内容
    btn1->move(80,500);
    btn1->resize(100, 40);
 
  
    //构建按钮2
    QPushButton *btn2 = new QPushButton(this);
    btn2->setText("取消");
    btn2->move(btn1->x()+150, btn1->y());
    btn2->resize(100, 40);
 
  
    //构建一个行编辑器并指定父组件
    QLineEdit *edit1 = new QLineEdit(this);
    edit1->resize(250, 50);
    edit1->move(120, 350);
 
  
    QLineEdit *edit2 = new QLineEdit(this);
    edit2->resize(250, 50);
    edit2->move(edit1->x(),edit1->y()+70);
    edit1->setPlaceholderText("树脂666");
    edit2->setEchoMode(QLineEdit::Password);    //设置回显
 
  
    //标签
    QLabel *lab1 = new QLabel(this);
    lab1->resize(50,50);
    lab1->setStyleSheet("background-color:yellow;");
    lab1->move(40, 350);
    lab1->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\QQ20230915211012.png"));
    lab1->setScaledContents(true);
 
  
    QLabel *lab2 = new QLabel(this);
    lab2->resize(50, 50);
    lab2->setStyleSheet("background-color:yellow;");
    lab2->move(lab1->x(), lab1->y()+70);
    lab2->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\QQ20230915211447.png"));
    lab2->setScaledContents(true);
 
  
    QMovie *movie = new QMovie("C:\\Users\\Administrator\\Desktop\\QQ20230915200707.gif");
    movie->start();
 
  
    QLabel *lab3 = new QLabel(this);
 
  
 
  
    lab3->setGeometry(0,0,600,340);
    lab3->setMovie(movie);
 
  
 
  
 
  
     lab3->setStyleSheet("background-color:yellow;");
    /*lab3->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\QQ20230915200707.gif"));
    lab3->setScaledContents(true);
    lab3->resize(600,340);*/
 
  
 
  
 
  
 
  
 
  
 
  
}
 
  
Mywnd::~Mywnd()
{
}
 
  

QT day1_第1张图片

QT day1_第2张图片

你可能感兴趣的:(qt,数据库,java)