Initial repo.

This commit is contained in:
Mentalflow 2023-06-05 20:30:41 +08:00
parent 5907821c11
commit ca4c7ebd3e
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
50 changed files with 979 additions and 0 deletions

BIN
bottom-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
bottom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

5
font.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/font">
<file>逍遥行书.ttf</file>
</qresource>
</RCC>

113
handle.cpp Normal file
View File

@ -0,0 +1,113 @@
#include "handle.h"
Handle::Handle(QWidget *parent)
: QWidget(parent)
{
setAutoFillBackground(true);
setPalette(QPalette(Qt::transparent));
resize(200,200);
setMinimumSize(100,100);
mouseX=width()/2;
mouseY=height()/2;
tim=new QTimer(this);
connect(tim,&QTimer::timeout,this,[=]{
emit keyNumchanged(getKeyNum());
});
connect(this,&Handle::keyNumchanged,this,[=](int num){
qDebug()<<num<<Qt::endl;
});
}
Handle::~Handle()
{
}
void Handle::paintEvent(QPaintEvent *){
QPainter painter(this);
int side = qMin(width(), height());
padR=side/2.0; //底盘半径
padX=padR;//底盘圆心
padY=padR;//底盘圆心
handleR=padR/4;//摇杆圆半径
int handleMaxR=padR-handleR;
QColor handleColor(Qt::gray);
//加载底盘图像
/*painter.save();
painter.scale(side / 400.0, side / 400.0);//坐标会随窗口缩放
painter.drawPixmap(0, 0, QPixmap(":/image/pad.png"));
painter.restore();*/
//自绘底盘
painter.save();
QRadialGradient RadialGradient(padR,padR,padR*3,padR,padR);//圆心2半径1焦点2
RadialGradient.setColorAt(0,QColor(90,90,90,127));//渐变
RadialGradient.setColorAt(1,QColor(255,255,255,190));//渐变
painter.setBrush(RadialGradient);
painter.setPen(Qt::NoPen);
painter.drawEllipse(QPoint(padR,padR),side/2,side/2);//大圆盘
painter.restore();
//painter.drawText(20,20,tr("%1,%2,%3").arg(mouseX).arg(mouseY).arg(handPadDis));
if(!mousePressed){//鼠标没按下则摇杆恢复到底盘中心
mouseX=padX;
mouseY=padY;
}
handPadDis=Pointdis(padR,padR,mouseX,mouseY);
if(handPadDis<=handleMaxR){
handleX=mouseX;
handleY=mouseY;
}
else {
handleX=(int)(handleMaxR*(mouseX-padX)/handPadDis+padX);
handleY=(int)(handleMaxR*(mouseY-padY)/handPadDis+padY);
}
// painter.drawText(200,200,tr("%1,%2,%3").arg(handleX).arg(handleY).arg(handPaddis));
painter.setPen(Qt::NoPen);
painter.setBrush(handleColor);
painter.drawEllipse(QPoint(handleX,handleY),handleR,handleR);//摇杆
}
void Handle::mouseMoveEvent(QMouseEvent* event){
static bool r=false;
mouseX=event->pos().x();
mouseY=event->pos().y();
if(r==true){
update();
r=false;
}
else{
r=true;
}
}
void Handle::mouseReleaseEvent(QMouseEvent* event){
mouseX=width()/2;
mouseY=height()/2;
tim->stop();
mousePressed=false;
emit keyNumchanged(Handle::stop);
update();
}
void Handle::mousePressEvent(QMouseEvent* event){
mouseX=event->pos().x();
mouseY=event->pos().y();
tim->start(100);
mousePressed=true;
update();
}
double Handle::Pointdis(int a,int b,int x,int y){
return sqrt((double)((x-a)*(x-a)+(y-b)*(y-b)));
}
int Handle::getKeyNum(){
int x,y;
int keynum;
x=(int)(handleX*3.0/(padR*2));
y=(int)(handleY*3.0/(padR*2));
keynum=3*y+x;
return keynum;
}

46
handle.h Normal file
View File

@ -0,0 +1,46 @@
#ifndef HANDLE_H
#define HANDLE_H
#include <QWidget>
#include <QPainter>
#include <QDrag>
#include <QMouseEvent>
#include <QtMath>
#include <QTimer>
#include <QDebug>
class Handle : public QWidget
{
Q_OBJECT
public:
Handle(QWidget *parent = 0);
~Handle();
enum {upleft=0,up,upright,left,stop,right,downleft,down,downright};
signals:
void keyNumchanged(int num);
protected:
void paintEvent(QPaintEvent *event)override;
void mouseMoveEvent(QMouseEvent *event)override;
void mouseReleaseEvent(QMouseEvent *event)override;
void mousePressEvent(QMouseEvent *event)override;
// void resizeEvent(QResizeEvent *event)override;
private:
int mouseX;
int mouseY;
int handleX;//摇杆
int handleY;
int handleR;
int padX;//底盘
int padY;
int padR;
double handPadDis;//两圆圆心距离
bool mousePressed;
QTimer *tim;
private:
double Pointdis(int a,int b,int x,int y);//两点距离
int getKeyNum();
};
#endif // HANDLE_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
icon.icns Normal file

Binary file not shown.

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

10
image.qrc Normal file
View File

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/image">
<file>pad.png</file>
<file>bottom.png</file>
<file>logo.png</file>
<file>wallpaper.JPG</file>
<file>icon.icns</file>
<file>bottom-1.png</file>
</qresource>
</RCC>

BIN
launch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
launchicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

12
main.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

201
mainwindow.cpp Normal file
View File

@ -0,0 +1,201 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "handle.h"
#include <QFontDatabase>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
QFontDatabase::addApplicationFont(":/font/逍遥行书.ttf");
client = new QMQTT::Client(QHostAddress::LocalHost, 1883);
connect(client, &QMQTT::Client::disconnected, this, &MainWindow::disconnected_handler);
connect(client, &QMQTT::Client::received, this, &MainWindow::received_handler);
connect(client, &QMQTT::Client::pingresp, this, &MainWindow::pingresp_handler);
connect(client, &QMQTT::Client::connected, this, &MainWindow::connected_handler);
connect(client, &QMQTT::Client::subscribed, this, &MainWindow::subscribed_handler);
right_r = new QTimer(this);
left_r = new QTimer(this);
connect(right_r,&QTimer::timeout,this,[=]{
if (key != '9')
{
QMQTT::Message message;
QByteArray payload;
message.setQos(1);
payload.append('9');
message.setPayload(payload);
message.setTopic("/Car");
client->publish(message);
key = '9';
}
});
connect(left_r,&QTimer::timeout,this,[=]{
if (key != 'A')
{
QMQTT::Message message;
QByteArray payload;
message.setQos(1);
payload.append('A');
message.setPayload(payload);
message.setTopic("/Car");
client->publish(message);
key = 'A';
}
});
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_connectButton_clicked()
{
client->setHostName(ui->addressEdit->text());
client->setPort(ui->portEdit->text().toInt());
client->setClientId("ios");
client->setUsername("iPhone");
client->setPassword("iPhone");
client->connectToHost();
}
void MainWindow::connected_handler()
{
const QString content = QDateTime::currentDateTime().toString()
+"\n"
+"MQTT服务器已连接上\n";
ui->log->insertPlainText(content);
client->subscribe(ui->ctrlTopicEdit->text(),1);
ui->addressEdit->setEnabled(false);
ui->portEdit->setEnabled(false);
ui->ctrlTopicEdit->setEnabled(false);
ui->connectButton->setEnabled(false);
ui->disconnectButton->setEnabled(true);
ui->rocker->setEnabled(true);
ui->left_r->setEnabled(true);
ui->right_r->setEnabled(true);
client->setAutoReconnect(true);
connect(ui->rocker,&Handle::keyNumchanged,ui->rocker,[=](int num){
if (num != key)
{
QMQTT::Message message;
QByteArray payload;
message.setQos(1);
payload.append(num+'0');
message.setPayload(payload);
message.setTopic("/Car");
client->publish(message);
key = num;
}
});
}
void MainWindow::disconnected_handler()
{
const QString content = QDateTime::currentDateTime().toString()
+"\n"
+"MQTT服务器已断开\n";
ui->log->insertPlainText(content);
ui->addressEdit->setEnabled(true);
ui->portEdit->setEnabled(true);
ui->ctrlTopicEdit->setEnabled(true);
ui->connectButton->setEnabled(true);
ui->disconnectButton->setEnabled(false);
ui->rocker->setEnabled(false);
ui->left_r->setEnabled(false);
ui->right_r->setEnabled(false);
disconnect(ui->rocker);
}
void MainWindow::received_handler(const QMQTT::Message& message)
{
const QString content = QDateTime::currentDateTime().toString()
+"\n"
+"Topic: "+message.topic()+ QLatin1Char('\n')
+"Message: "+message.payload()+ QLatin1Char('\n')
+"Qos: "+QLatin1Char(message.qos()+'0')+'\n';
ui->log->insertPlainText(content);
}
void MainWindow::pingresp_handler()
{
const QString content = QDateTime::currentDateTime().toString()
+ QLatin1Char('\n')
+ QLatin1String("MQTT Pong!")
+ QLatin1Char('\n');
ui->log->insertPlainText(content);
}
void MainWindow::subscribed_handler(const QString& topic, const quint8 qos)
{
const QString content = QDateTime::currentDateTime().toString()
+"\n"
+"Topic: "+topic+ QLatin1Char('\n')
+"Qos: "+QLatin1Char(qos+'0')+QLatin1Char('\n')+
"已订阅\n";
ui->log->insertPlainText(content);
}
void MainWindow::error_handler(const QMQTT::ClientError error)
{
const QString content = QDateTime::currentDateTime().toString()
+"\n"
+"Error: "+ error;
ui->log->insertPlainText(content);
}
void MainWindow::on_disconnectButton_clicked()
{
client->disconnectFromHost();
client->setAutoReconnect(false);
}
void MainWindow::on_log_textChanged()
{
ui->log->moveCursor(QTextCursor::End);
}
void MainWindow::on_right_r_pressed()
{
right_r->start(100);
}
void MainWindow::on_right_r_released()
{
right_r->stop();
if ('4' != key)
{
QMQTT::Message message;
QByteArray payload;
message.setQos(1);
payload.append('4');
message.setPayload(payload);
message.setTopic("/Car");
client->publish(message);
key = '4';
}
}
void MainWindow::on_left_r_pressed()
{
left_r->start(100);
}
void MainWindow::on_left_r_released()
{
left_r->stop();
if ('4' != key)
{
QMQTT::Message message;
QByteArray payload;
message.setQos(1);
payload.append('4');
message.setPayload(payload);
message.setTopic("/Car");
client->publish(message);
key = '4';
}
}

48
mainwindow.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "qmqtt.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_connectButton_clicked();
void connected_handler();
void disconnected_handler();
void received_handler(const QMQTT::Message& message);
void pingresp_handler();
void subscribed_handler(const QString& topic, const quint8 qos);
void error_handler(const QMQTT::ClientError error);
void on_disconnectButton_clicked();
void on_log_textChanged();
void on_right_r_pressed();
void on_right_r_released();
void on_left_r_pressed();
void on_left_r_released();
private:
Ui::MainWindow *ui;
QMQTT::Client *client;
QTimer *left_r,*right_r;
uint8_t key = -1;
};
#endif // MAINWINDOW_H

507
mainwindow.ui Normal file
View File

@ -0,0 +1,507 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>485</width>
<height>795</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>物联网小车控制器</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="documentMode">
<bool>true</bool>
</property>
<property name="tabShape">
<enum>QTabWidget::Triangular</enum>
</property>
<property name="dockNestingEnabled">
<bool>true</bool>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout" rowstretch="5,1,1,1,10,10,1,1" columnstretch="1,5,5,5,5,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="3" colspan="6">
<widget class="QLabel" name="logoLabel">
<property name="font">
<font>
<family>字魂49号-逍遥行书</family>
<pointsize>44</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>物联网小车控制器</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="6">
<widget class="QLabel" name="Button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>2000</width>
<height>2000</height>
</size>
</property>
<property name="font">
<font>
<pointsize>1</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="image.qrc">:/image/bottom-1.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" rowspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="5" rowspan="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1" rowspan="3" colspan="4">
<widget class="QTabWidget" name="tabWidget">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Triangular</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
</property>
<property name="documentMode">
<bool>false</bool>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
</property>
<widget class="QWidget" name="rockerTab">
<attribute name="title">
<string>控制器</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="8,1,1,8" rowminimumheight="1,200,1,1">
<item row="3" column="1">
<widget class="QPushButton" name="right_r">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>顺时针转🔃</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="Handle" name="rocker" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="left_r">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>逆时针转🔄</string>
</property>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="4">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="MQTTTab">
<attribute name="title">
<string>MQTT服务器</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="5,5,5,1" columnstretch="1,5,5,5,1">
<item row="0" column="1">
<widget class="QLabel" name="addressLabel">
<property name="text">
<string>服务器地址:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="disconnectButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>断开</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>服务器端口:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLabel" name="ctrlTopiLlabel">
<property name="text">
<string>控制Topic</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="portEdit">
<property name="text">
<string>11883</string>
</property>
</widget>
</item>
<item row="3" column="4">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLineEdit" name="addressEdit">
<property name="text">
<string>mqtt.ourdocs.cn</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="ctrlTopicEdit">
<property name="text">
<string>/Car</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="connectButton">
<property name="text">
<string> 连接</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="logTab">
<attribute name="title">
<string>日志</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
<property name="bottomMargin">
<number>20</number>
</property>
<item row="0" column="0">
<widget class="QTextBrowser" name="log"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="infoTab">
<attribute name="title">
<string>关于</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3" rowstretch="1,5,5,1">
<item row="2" column="0">
<widget class="QLabel" name="copyrightLabel">
<property name="font">
<font>
<family>Comic Sans MS</family>
<pointsize>19</pointsize>
<italic>false</italic>
</font>
</property>
<property name="text">
<string>©2021
Made By Mentalflow.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="sloganLabel">
<property name="font">
<font>
<family>字魂49号-逍遥行书</family>
<pointsize>27</pointsize>
</font>
</property>
<property name="text">
<string>为电子设计综合实验设计</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QLabel" name="Logo">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="image.qrc">:/image/logo.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="4" colspan="2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<action name="action">
<property name="text">
<string>关于</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>Handle</class>
<extends>QWidget</extends>
<header>handle.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="image.qrc"/>
</resources>
<connections/>
</ui>

BIN
pad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

34
test.pro Normal file
View File

@ -0,0 +1,34 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets qmqtt
CONFIG += c++11
ICON = icon.icns
TARGET = IoTCar
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
handle.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
handle.h \
mainwindow.h
FORMS += \
mainwindow.ui
TRANSLATIONS += \
test_zh_CN.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
font.qrc \
image.qrc

3
test_zh_CN.ts Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN"></TS>

BIN
wallpaper.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 KiB

BIN
逍遥行书.ttf Normal file

Binary file not shown.