Qt(9.28)

widget.cpp

#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
 QPushButton *btn1 =new QPushButton("登录",this);
 this->setFixedSize(640,480);
 btn1->resize(80,40);
 btn1->move(200,300);
 btn1->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\中国结\\picture"));
 btn1->setStyleSheet("color :white; background-color:skyblue;border-radius:10px");

 QPushButton *btn2 =new QPushButton("取消",this);
 btn2->resize(btn1->size());
 btn2->move(btn1->x()+btn1->width()+50,btn1->y());
 btn2->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\中国结\\picture"));
 btn2->setStyleSheet("color :white; background-color:skyblue;border-radius:10px");


 QLineEdit *edit1=new QLineEdit(this);
 edit1->resize(300,30);
 edit1->move(180,220);
 edit1->setStyleSheet("color :black;");
 edit1->setAlignment(Qt::AlignCenter);
 edit1->setEchoMode(QLineEdit::Password);
 edit1->setPlaceholderText("输入QQ密码");


 QLineEdit *edit2=new QLineEdit(this);
 edit2->resize(300,30);
 edit2->move(edit1->x(),edit1->y()-edit1->height()-10);
 edit2->setStyleSheet("color :black;");
 edit2->setAlignment(Qt::AlignCenter);
 edit2->setPlaceholderText("输入QQ账号");

    QLabel *lab1 = new QLabel;

    lab1->setParent(this);
    lab1->setText("密码:");
    lab1->move(edit1->x()-40, edit1->y()+10);

    QLabel *lab2 = new QLabel;
    lab2->setParent(this);
    lab2->setText("账号:");
    lab2->move(edit1->x()-40, edit1->y()-30);

}

Widget::~Widget()
{
}

main.cpp

#include "widget.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();
    return a.exec();
}

 widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include<QPushButton>
#include<QLineEdit>
#include<QLabel>
class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
};
#endif // WIDGET_H

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值