优化主界面UI布局,删除冗余功能按钮

- 移除人脸识别、人脸跟随等冗余UI元素
- 删除智能导航、情报传达等功能按钮
- 清理无人机视角、机器狗视角、机器狗建图按钮
- 优化情报传输模块布局,修复按钮重叠问题
- 实现界面极简化设计,功能由RightFunctionPanel统一管理
pull/8/head
123 6 days ago
parent 50fef2e166
commit 76cd4c9aa6

@ -577,293 +577,7 @@ border-radius: 1px;</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="controlButtonsLayout">
<property name="spacing">
<number>12</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="UAVview">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>无人机视角</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/location.svg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="robotView">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>机器狗视角</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/health.svg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="robotMapping">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>机器狗建图</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/soldier.svg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_controls">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="smartNavigation">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>🧭 智能导航</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="intelligence">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>🔊 情报传达</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QPushButton" name="faceRecognition">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>人脸识别</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/infomation.svg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QPushButton" name="faceTracking">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>人脸跟随</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/res/image/infomation.svg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">

@ -170,25 +170,9 @@ private slots:
*/
void onRobotLocationClicked();
/**
* @brief
*/
void onUAVViewClicked();
/**
* @brief
*/
void onRobotViewClicked();
/**
* @brief
*/
void onRobotMappingClicked();
/**
* @brief
*/
void onSmartNavigationClicked();
/**
* @brief

@ -290,81 +290,66 @@ void RightFunctionPanel::setupIntelligenceModule()
m_intelligenceCard = new ModuleCard("📡 情报传输", "📡", this);
m_intelligenceCard->setObjectName("ModuleCard");
m_intelligenceCard->setProperty("data-module", "intelligence");
// 情报传达说明 - 统一样式
QLabel *descLabel = new QLabel("🎯 远程控制系统");
descLabel->setObjectName("intelligence-description");
descLabel->setAlignment(Qt::AlignCenter);
descLabel->setStyleSheet(
"color: #2196F3; "
"font-size: 14px; "
"font-weight: bold; "
"padding: 10px; "
"margin-bottom: 8px;"
);
m_intelligenceCard->addContent(descLabel);
// 按钮布局容器 - 增加间距
// 按钮布局容器 - 优化间距和布局
QWidget *buttonWidget = new QWidget();
QVBoxLayout *buttonLayout = new QVBoxLayout(buttonWidget);
buttonLayout->setSpacing(20); // 12px → 20px 增强分离感
buttonLayout->setContentsMargins(8, 12, 8, 12); // 增加容器边距
buttonLayout->setSpacing(16); // 设置合理的按钮间距
buttonLayout->setContentsMargins(12, 16, 12, 16); // 优化容器边距
// 主要功能:音频控制按钮 - 提升优先级
// 音频控制按钮 - 优化尺寸
m_voiceCallBtn = new QPushButton("🔊 音频控制模块");
m_voiceCallBtn->setObjectName("FunctionBtn");
m_voiceCallBtn->setProperty("class", "primary-large");
m_voiceCallBtn->setMinimumHeight(65); // 55px → 65px 突出主要功能
m_voiceCallBtn->setMinimumHeight(55); // 统一按钮高度
m_voiceCallBtn->setMaximumHeight(55); // 限制最大高度,防止拉伸
m_voiceCallBtn->setStyleSheet(
"QPushButton {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #2196F3, stop:1 #1976D2);" // 统一蓝色主题
" color: white;"
" font-size: 17px;" // 16px → 17px 提升可读性
" font-size: 16px;"
" font-weight: bold;"
" border: 2px solid #2196F3;"
" border-radius: 8px;"
" padding: 16px;" // 12px → 16px 统一内边距
" padding: 12px 16px;"
"}"
"QPushButton:hover {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #1976D2, stop:1 #1565C0);"
" border-color: #1976D2;"
" transform: translateY(-1px);" // 添加微妙的悬停效果
"}"
"QPushButton:pressed {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #1565C0, stop:1 #0D47A1);"
" transform: translateY(0px);"
"}"
);
// 辅助功能:面部灯光控制按钮 - 降低优先级
// 灯光控制按钮 - 优化尺寸
m_faceLightBtn = new QPushButton("💡 灯光控制模块");
m_faceLightBtn->setObjectName("FunctionBtn");
m_faceLightBtn->setProperty("class", "secondary-medium"); // primary-large → secondary-medium
m_faceLightBtn->setMinimumHeight(50); // 55px → 50px 体现次要地位
m_faceLightBtn->setProperty("class", "secondary-medium");
m_faceLightBtn->setMinimumHeight(55); // 统一按钮高度
m_faceLightBtn->setMaximumHeight(55); // 限制最大高度,防止拉伸
m_faceLightBtn->setStyleSheet(
"QPushButton {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #607D8B, stop:1 #455A64);" // 橙红色 → 中性灰蓝色
" color: white;"
" font-size: 15px;" // 16px → 15px 体现层次差异
" font-size: 16px;"
" font-weight: bold;"
" border: 2px solid #607D8B;"
" border-radius: 8px;"
" padding: 16px;" // 统一内边距
" padding: 12px 16px;"
"}"
"QPushButton:hover {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #546E7A, stop:1 #37474F);"
" border-color: #546E7A;"
" transform: translateY(-1px);"
"}"
"QPushButton:pressed {"
" background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 #37474F, stop:1 #263238);"
" transform: translateY(0px);"
"}"
);
@ -374,19 +359,6 @@ void RightFunctionPanel::setupIntelligenceModule()
buttonLayout->addWidget(m_voiceCallBtn);
buttonLayout->addWidget(m_faceLightBtn);
m_intelligenceCard->addContent(buttonWidget);
// 功能介绍 - 统一样式和间距
QLabel *featureLabel = new QLabel("• SSH双跳连接\n• 音频播放控制\n• 面部灯光控制\n• 实时状态监控");
featureLabel->setObjectName("feature-list");
featureLabel->setAlignment(Qt::AlignLeft);
featureLabel->setStyleSheet(
"color: #90A4AE; " // #b0b0b0 → #90A4AE 与主题更协调
"font-size: 12px; "
"padding: 12px 10px; " // 增加上下边距
"line-height: 1.5; " // 提升行高可读性
"margin-top: 8px;"
);
m_intelligenceCard->addContent(featureLabel);
m_mainLayout->addWidget(m_intelligenceCard);
}

@ -312,11 +312,8 @@ void MainWindow::connectSignals()
{
// 连接按钮信号
// 注意:原有的重复设备管理按钮信号已被移除
connect(m_ui->UAVview, &QPushButton::clicked, this, &MainWindow::onUAVViewClicked);
connect(m_ui->robotView, &QPushButton::clicked, this, &MainWindow::onRobotViewClicked);
connect(m_ui->robotMapping, &QPushButton::clicked, this, &MainWindow::onRobotMappingClicked);
connect(m_ui->smartNavigation, &QPushButton::clicked, this, &MainWindow::onSmartNavigationClicked);
connect(m_ui->intelligence, &QPushButton::clicked, this, &MainWindow::onIntelligenceClicked);
// DeviceListPanel信号已在setupDeviceListPanel中连接
@ -791,28 +788,9 @@ void MainWindow::onRobotLocationClicked()
QMessageBox::information(this, "机器人定位", "机器人定位功能正在开发中,暂时无法使用");
}
void MainWindow::onUAVViewClicked()
{
SystemLogger::getInstance()->logInfo("无人机视角请求");
// 启动视觉识别系统Web服务
startVisionWebService();
}
void MainWindow::onRobotViewClicked()
{
QMessageBox::information(this, "机器人视图", "机器人视图功能正在开发中,暂时无法使用");
}
void MainWindow::onRobotMappingClicked()
{
QMessageBox::information(this, "机器人建图", "机器人建图功能正在开发中,暂时无法使用");
}
void MainWindow::onSmartNavigationClicked()
{
QMessageBox::information(this, "智能导航", "智能导航功能正在开发中,暂时无法使用");
}
void MainWindow::onIntelligenceClicked()
{
@ -1276,47 +1254,9 @@ void MainWindow::onExportReport()
void MainWindow::fixMainButtonLayout()
{
// 修复主要功能按钮的布局问题
if (!m_ui->UAVview || !m_ui->robotView || !m_ui->robotMapping || !m_ui->smartNavigation) {
qWarning() << "某些主要功能按钮未找到,跳过布局修复";
return;
}
// 设置按钮属性的通用函数
auto setupButton = [](QPushButton* button, const QString& text, const QString& tooltip, int fontSize = 12) {
if (!button) return;
// 设置尺寸
button->setMinimumSize(140, 45);
button->setMaximumHeight(45);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// 设置文本和提示
button->setText(text);
button->setToolTip(tooltip);
// 设置字体
QFont font = button->font();
font.setPointSize(fontSize);
font.setBold(true);
button->setFont(font);
};
// 设置四个主要按钮的属性
setupButton(m_ui->UAVview, "🚁 无人机视角", "查看无人机实时视频流和飞行状态");
setupButton(m_ui->robotView, "🐕 机器狗视角", "查看机器狗实时视频流和运动状态");
setupButton(m_ui->robotMapping, "🗺️ 机器狗建图", "启动机器狗SLAM建图功能");
setupButton(m_ui->smartNavigation, "🧭 智能导航", "启动智能路径规划和自主导航");
// 设置情报传达按钮
if (m_ui->intelligence) {
setupButton(m_ui->intelligence, "🔊 情报传达", "语音情报传达和通信功能", 11);
m_ui->intelligence->setMinimumHeight(40);
m_ui->intelligence->setMaximumHeight(40);
}
qDebug() << "主要功能按钮布局修复完成";
SystemLogger::getInstance()->logInfo("主要功能按钮布局修复完成");
// 主要功能按钮已移除,布局修复不再需要
qDebug() << "主要功能按钮已移除,跳过布局修复";
SystemLogger::getInstance()->logInfo("主要功能按钮已移除,跳过布局修复");
}
void MainWindow::initializeModernStyles()
@ -1327,26 +1267,9 @@ void MainWindow::initializeModernStyles()
// 应用现代军事主题
styleManager->applyTheme(ModernStyleManager::ThemeType::ModernMilitary);
// 应用主要按钮样式
if (m_ui->UAVview) {
styleManager->applyButtonStyle(m_ui->UAVview, ModernStyleManager::ButtonStyle::Primary);
}
if (m_ui->robotView) {
styleManager->applyButtonStyle(m_ui->robotView, ModernStyleManager::ButtonStyle::Primary);
}
if (m_ui->robotMapping) {
styleManager->applyButtonStyle(m_ui->robotMapping, ModernStyleManager::ButtonStyle::Info);
}
if (m_ui->smartNavigation) {
styleManager->applyButtonStyle(m_ui->smartNavigation, ModernStyleManager::ButtonStyle::Success);
}
if (m_ui->intelligence) {
styleManager->applyButtonStyle(m_ui->intelligence, ModernStyleManager::ButtonStyle::Warning);
}
// 应用设备面板样式
if (m_deviceListPanel) {

Loading…
Cancel
Save