赞
踩
- #include "mywidget.h"
-
- MyWidget::MyWidget(QWidget *parent)
- : QWidget(parent)
- {
- //设置窗口标题
- this->setWindowTitle("QQ");
- //设置窗口图标
- this->setWindowIcon(QIcon("C:\\Users\\张谦\\Desktop\\pictrue\\qq.png"));
- //设置背景颜色
- this->setStyleSheet("background-color:rgb(173,200,255)");
- //设置窗口大小
- this->resize(428,330);
- //设置固定大小
- this->setFixedSize(428,330);
- //创建登录按钮
- QPushButton *btn1 = new QPushButton(this);
- btn1->setText("登录");
- btn1->setStyleSheet("background-color:rgb(28,196,252)");
- //移动按钮和设置大小
- btn1->move(110,250);
- btn1->resize(236,35);
- //行编辑器
- QLineEdit *edit1 = new QLineEdit(this);
- edit1->resize(256,35);
- edit1->move(100,150);
- edit1->setPlaceholderText("手机号/QQ号/邮箱");
-
- QLineEdit *edit2 = new QLineEdit(this);
- edit2->resize(256,35);
- edit2->move(100,200);
- edit2->setPlaceholderText("密码");
- edit2->setEchoMode(QLineEdit::Password);
-
- //设置标签类
- QLabel *lab1 = new QLabel(this);
- lab1->resize(428,128);
- //设置动态图
- QMovie *mv = new QMovie("C:\\Users\\张谦\\Desktop\\pictrue\\qqbackground.gif");
- lab1->setMovie(mv);
- mv->start();
- lab1->setScaledContents(true);
-
-
- //设置小图标
- QLabel *lab2 = new QLabel(this);
- lab2->resize(35,35);
- lab2->move(65,150);
- lab2->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\qq.png"));
- lab2->setScaledContents(true);
-
- QLabel *lab3 = new QLabel(this);
- lab3->resize(35,35);
- lab3->move(65,200);
- lab3->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\passwd.jpg"));
- lab3->setScaledContents(true);
-
- //放置头像
- QLabel *lab4 = new QLabel(this);
- lab4->resize(80,80);
- lab4->move(174,60);
- lab4->setPixmap(QPixmap("C:\\Users\\张谦\\Desktop\\pictrue\\head.png"));
- lab4->setScaledContents(true);
-
-
-
-
- }
-
- MyWidget::~MyWidget()
- {
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。