QT day1

#include "mywnd.h"
#include "ui_mywnd.h"
#include<iostream>
#include<QDebug>
#include<QIcon>
#include<QPushButton>
#include<QLineEdit>
#include<QLabel>
mywnd::mywnd(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::mywnd)
{
    ui->setupUi(this);

    qDebug()<<this->size();
    qDebug()<<this->width();
    qDebug()<<this->height();
    this->resize(1000,800);
    this->resize(QSize(500,400));
    this->setMaximumSize(1000,800);
    this->setMinimumSize(200,100);
    this->setFixedSize(500,400);

    qDebug()<<this->windowTitle();
    this->setWindowTitle("Widget");
    this->setWindowIcon(QIcon("D:\\hqyj\\wodepeizhenshi"));
    //this->setStyleSheet("background-color:pink");
    //this->setWindowFlag();
    QPushButton *btn1=new QPushButton;
    btn1->setParent(this);
    btn1->setText("登录");
    btn1->resize(100,50);
    btn1->setIcon(QIcon("D:\\hqyj\\login"));
    btn1->move(200,325);

    QPushButton *btn2=new QPushButton(this);
    btn2->setText("取消");
    btn2->setIcon(QIcon("D:\\hqyj\\cancel"));
    btn2->resize(btn1->size());
    btn2->move(btn1->x()+150,btn1->y());

    QLineEdit *edit1=new QLineEdit(this);
    edit1->resize(200,50);
    edit1->move(btn1->x(),btn1->y()-150);
    edit1->setMaxLength(6);
    edit1->setPlaceholderText("输入用户名");
    edit1->setAlignment(Qt::AlignCenter);

    QLineEdit *edit2=new QLineEdit(this);
    edit2->resize(200,50);
    edit2->setEchoMode(QLineEdit::Password);
    edit2->move(btn1->x(),btn2->y()-75);
    edit2->setPlaceholderText("输入密码");
    edit2->setAlignment(Qt::AlignCenter);

    QLabel *lab1=new QLabel(this);
    lab1->resize(50,50);
    lab1->setAlignment(Qt::AlignCenter);
    lab1->setPixmap(QPixmap("D:\\hqyj\\userName"));
    lab1->setScaledContents(true);
    lab1->move(btn1->x()-80,btn2->y()-150);

    QLabel *lab2=new QLabel(this);
    lab2->resize(50,50);
    lab2->setAlignment(Qt::AlignCenter);
    lab2->setPixmap(QPixmap("D:\\hqyj\\passwd"));
    lab2->setScaledContents(true);
    lab2->move(btn1->x()-80,btn2->y()-75);

   QLabel *lab3=new QLabel(this);
    lab3->resize(500,150);
    lab3->setStyleSheet("background-color:yellow;");
    lab3->setAlignment(Qt::AlignCenter);
    lab3->setPixmap(QPixmap("D:\\hqyj\\logo"));
    lab3->setScaledContents(true);

}



mywnd::~mywnd()
{
    delete ui;
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值