寒假作业-day7

简易QQ界面

寒假作业-day7_第1张图片

#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon(":/tu/qq.png"));
    this->setWindowTitle("登录");
    this->setWindowFlag(Qt::FramelessWindowHint);

}

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

void Widget::on_lginBtn_clicked()
{
    QMessageBox::question(this,"","登陆成功");
}

void Widget::on_getBtn_clicked()
{
    QMessageBox::question(this,"","注册成功");
}

void Widget::on_pushButton_clicked()
{
    this->close();
}

void Widget::mouseMoveEvent(QMouseEvent *event)
{
    if(event->buttons()==Qt::LeftButton)
    {
        this->move(event->globalPos()-p);
    }
}
void Widget::mousePressEvent(QMouseEvent *event)
{
    p=event->pos();
}

你可能感兴趣的:(c++)