qq登录界面

弄了弄qt,就知道为什么产品和程序员关系不好了。。

仿qq做的,感觉和qq差局还是很大,上图*.*

 

首先肯定是要把图片分成几部分,我分了4个框来处理这些(顺便吐槽一下Linux的画图软件,太难收了)

下一个就是要对每一部分进行相应的处理,写相应代码

    //创建用户名,动图,等等
    buttonfindpasswd = new QPushButton("找回密码");    
    buttonnewusr = new QPushButton("注册帐号");
    buttonlogin = new QPushButton("登录");
    texteditusername = new QLineEdit();
    textedituserpasswd = new QLineEdit();
    checkboxlogin = new QCheckBox("自动登录");
    checkboxspass = new QCheckBox("记住密码");
    texteditusername->setPlaceholderText("QQ号码/手机/邮箱");
    textedituserpasswd->setPlaceholderText("密码");
    //这个是第二部分
    QVBoxLayout *highlayout = new QVBoxLayout();
    highlayout->addWidget(texteditusername);
    highlayout->addWidget(textedituserpasswd);
    //这个是第四部分
    QHBoxLayout *threelayout = new QHBoxLayout();
    threelayout->addWidget(checkboxlogin);
    threelayout->addWidget(checkboxspass);
    threelayout->addWidget(buttonfindpasswd);
    //第一部分,这个是把动图通过label放入(下面有头文件,直接复制就可使用)
    QLabel *label = new QLabel();
    QMovie *movie = new QMovie("/home/ma/图片/124.gif");
    label->resize(500,500);
    label->setMovie(movie);
    movie->start();
    //这个是把第二部分和第四部分包起来的大layout
    QGridLayout *thatlayout = new QGridLayout();
    thatlayout->addLayout(highlayout,1,0,1,1);
    thatlayout->addLayout(threelayout,2,0,1,1);
    //这个是第三部分
    QVBoxLayout *qliftlayout = new QVBoxLayout();
    qliftlayout->addStretch();
    qliftlayout->addWidget(buttonnewusr);
    QHBoxLayout *downlayout = new QHBoxLayout();
    downlayout->addLayout(qliftlayout);
    downlayout->addLayout(thatlayout);
    //这个是所有的总部分
    QGridLayout *main_layout = new QGridLayout(this);
    main_layout->addWidget(label,0,0,1,1);
    main_layout->addLayout(downlayout,1,0,1,1);
    //设置每个部分的间距离
    main_layout->setHorizontalSpacing(10);
    main_layout->setVerticalSpacing(10);
    //设置和边框的间距
    main_layout->setContentsMargins(10,10,10,10);
    //让大小不能改变
    main_layout->setSizeConstraint(QLayout::SetFixedSize);




#include <QPushButton>
#include <QPropertyAnimation>
#include <QLabel>
#include <QMovie>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>

class Dialog : public QDialog
{
    Q_OBJECT

public:
    Dialog(QWidget *parent = 0);
    ~Dialog();
private:
    QPushButton *buttonfindpasswd,*buttonnewusr,*buttonlogin;
    //QTextEdit *texteditusername,*textedituserpasswd;
    QCheckBox *checkboxspass,*checkboxlogin;
    QLineEdit *texteditusername,*textedituserpasswd;

private slots:
    void buttonss();
};

 

顺便附上那个樱花的.gif,供模仿使用(此动图来自网络,如有侵权,请联系我删除)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值