2023-6-13作业补
简易功能
//头文件
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
#include<QDebug>
#include<QPushButton>
#include<QString>
#include<QLineEdit>
#include<QCheckBox>
QT_BEGIN_NAMESPACE
namespace Ui { class Window; }
QT_END_NAMESPACE
class Window : public QWidget
{
Q_OBJECT
public:
Window(QWidget *parent = nullptr);
~Window();
private:
Ui::Window *ui;
};
#endif // WINDOW_H
//源文件
#include "window.h"
#include "ui_window.h"
Window::Window(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Window)
{
this->resize(620,300); //主窗口
this->setWindowTitle("GoAshore"); //标题
this->setWindowIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/QQ.png"));
this->setWindowOpacity(.77);
this->setStyleSheet("background-color:orange;""border-radius:5px;");
QPushButton*btnW=new QPushButton; //logo框
btnW->setParent(this);
btnW->resize(620,110);
btnW->move(0,0);
btnW->setStyleSheet("background-color:cyan;""border-radius:5px;");
btnW->setIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/aichegujiabeifen6.png"));
QPushButton*btn=new QPushButton; //按钮1
btn->setParent(this);
btn->resize(140,35);
btn->setText(">Cancel<");
btn->setIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/quxiao.png"));
btn->move(390,240);
btn->setStyleSheet("background-color:grey;""border-radius:10px;");
QPushButton*btn1=new QPushButton(this); //按钮2
btn1->resize(btn->size());
btn1->setText(">Begin<");
btn1->setIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/denglu_1.png"));
btn1->move(150,240);
btn1->setStyleSheet("border-radius:10px;""background-color:grey;");
QLineEdit*edit=new QLineEdit(this); //文本1
edit->move(135,190);
edit->resize(410,40);
edit->setEchoMode(QLineEdit::Password);
edit->setPlaceholderText(" Password");
edit->setStyleSheet("border-radius:15px;""background-color:white;");
QLineEdit*edit1=new QLineEdit(this); //文本2
edit1->resize(edit->size());
edit1->move(135,140);
edit1->setPlaceholderText(" User");
edit1->setStyleSheet("border-radius:15px;""background-color:white;");
QPushButton*btn2=new QPushButton; //logo二
btn2->setParent(this);
btn2->resize(55,40);
btn2->setIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/denglu.png"));
btn2->move(60,140);
btn2->setStyleSheet("background-color:grey;""border-radius:5px;");
QPushButton*btn3=new QPushButton; //logo三
btn3->setParent(this);
btn3->resize(55,40);
btn3->setIcon(QIcon("C:/Users/choice/Desktop/Qt/file/icon_nhgbq8i4bf/icon_nhgbq8i4bf/denglumima.png"));
btn3->move(60,190);
btn3->setStyleSheet("background-color:grey;""border-radius:5px;");
}
Window::~Window()
{
delete ui;
}
窗口