Merge pull request '设计模型和设计文档' (#4) from yangyizhe_branch into master

pull/6/head
m6wf5oeyl 10 months ago
commit b456e18465

@ -0,0 +1,31 @@
QT += core gui
QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# 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 += \
main.cpp \
guidingui.cpp \
robotlistdialog.cpp
HEADERS += \
guidingui.h \
robotlistdialog.h
FORMS += \
guidingui.ui \
robotlistdialog.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
res.qrc

@ -0,0 +1,29 @@
#include "guidingui.h"
#include "ui_guidingui.h"
#include <QWebEngineView>
GuidingUI::GuidingUI(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::GuidingUI)
{
ui->setupUi(this);
// QWebEngineView *view = new QWebEngineView(ui->map_api);
// view->setGeometry(ui->map_api->geometry()); // 设置与frame相同的大小和位置
// view->setUrl(QUrl(QStringLiteral("file:///C:/Users/11/Desktop/map.html")));
// view->show();
}
GuidingUI::~GuidingUI()
{
delete ui;
}
void GuidingUI::on_robottab_clicked()
{
RobotListDialog *robotListDialog = new RobotListDialog(this);
robotListDialog->addRobotInfo("机器人1", "类型A", "运行", "位置A");
robotListDialog->addRobotInfo("机器人2", "类型B", "停止", "位置B");
// 添加更多机器人信息...
robotListDialog->exec();
}

@ -0,0 +1,27 @@
#ifndef GUIDINGUI_H
#define GUIDINGUI_H
#include <QMainWindow>
#include "robotlistdialog.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class GuidingUI;
}
QT_END_NAMESPACE
class GuidingUI : public QMainWindow
{
Q_OBJECT
public:
GuidingUI(QWidget *parent = nullptr);
~GuidingUI();
private slots:
void on_robottab_clicked();
private:
Ui::GuidingUI *ui;
};
#endif // GUIDINGUI_H

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GuidingUI</class>
<widget class="QMainWindow" name="GuidingUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1271</width>
<height>750</height>
</rect>
</property>
<property name="windowTitle">
<string>伤情态势感知分析系统</string>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
border: none;
padding: 10px 20px; /* 设置内边距 */
border-radius: 5px; /* 设置按钮圆角 */
font-size: 16px; /* 设置文字大小 */
}
QPushButton:hover {
background-color: #45a049; /* 设置鼠标悬停时按钮背景色 */
}
QPushButton:pressed {
background-color: #398439; /* 设置按钮被按下时背景色 */
}</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true">#centralwidget{background-image: url(:/image/res/image/1.png);
background-position:center;
background-repeat:no-repeat;}</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>1110</x>
<y>30</y>
<width>126</width>
<height>251</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="mapbutton">
<property name="text">
<string>显示地图</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="displaybutton">
<property name="text">
<string>显示伤情</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addrobot">
<property name="styleSheet">
<string notr="true">#QPushButton{
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
border: none;
}</string>
</property>
<property name="text">
<string>添加机器人</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="robottab">
<property name="text">
<string>机器人列表</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="recombutton">
<property name="text">
<string>提供建议</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1271</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="action">
<property name="text">
<string>添加机器人</string>
</property>
</action>
<action name="action_3">
<property name="text">
<string>显示机器人</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;显示机器人&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</action>
<action name="action_4">
<property name="text">
<string>伤员</string>
</property>
</action>
<action name="action_5">
<property name="text">
<string>加载地图</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,11 @@
#include "guidingui.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GuidingUI w;
w.show();
return a.exec();
}

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/image">
<file>res/image/1.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 KiB

@ -0,0 +1,37 @@
#include "robotlistdialog.h"
#include "ui_robotlistdialog.h"
#include <QPushButton>
#include <QVBoxLayout>
#include <QLabel>
RobotListDialog::RobotListDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::RobotListDialog)
{
ui->setupUi(this);
setWindowTitle("机器人列表");
setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
setStyleSheet("background-color: rgba(255, 255, 255, 150);"); // 设置透明度为 150 的白色背景
}
RobotListDialog::~RobotListDialog()
{
delete ui;
}
void RobotListDialog::addRobotInfo(QString name, QString type, QString status, QString position)
{
// 创建一个新的机器人信息部件
QWidget *widget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout(widget);
layout->addWidget(new QLabel("机器人名称:" + name));
layout->addWidget(new QLabel("机器人类型:" + type));
layout->addWidget(new QLabel("机器人状态:" + status));
layout->addWidget(new QLabel("机器人位置:" + position));
layout->addStretch();
widget->setLayout(layout);
// 将机器人信息部件添加到布局中
layout->addWidget(widget);
}

@ -0,0 +1,25 @@
#ifndef ROBOTLISTDIALOG_H
#define ROBOTLISTDIALOG_H
#include <QDialog>
#include <QVBoxLayout>
namespace Ui {
class RobotListDialog;
}
class RobotListDialog : public QDialog
{
Q_OBJECT
public:
explicit RobotListDialog(QWidget *parent = nullptr);
~RobotListDialog();
void addRobotInfo(QString name, QString type, QString status, QString position);
private:
QVBoxLayout *layout; // 布局来容纳机器人信息
Ui::RobotListDialog *ui;
};
#endif // ROBOTLISTDIALOG_H

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RobotListDialog</class>
<widget class="QDialog" name="RobotListDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1184</width>
<height>734</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1 @@
Subproject commit 067772792c4b6255e8b47049fd5d8c606e60dab4
Loading…
Cancel
Save