右下角控制看板:每个tab都通过QDialog进行添加

This commit is contained in:
tangchao0503
2026-04-08 00:14:37 +08:00
parent fa6ce1a606
commit 87d9a7fe01
12 changed files with 1151 additions and 150 deletions

861
HPPA/HPPA - 副本 (2).ui Normal file
View File

@ -0,0 +1,861 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HPPAClass</class>
<widget class="QMainWindow" name="HPPAClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1486</width>
<height>898</height>
</rect>
</property>
<property name="windowTitle">
<string>Spectral Insight</string>
</property>
<property name="windowIcon">
<iconset resource="HPPA.qrc">
<normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1486</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QMenuBar{
background:#F0F0F0;
color:rgb(0,0,0);
font-size:14px;
padding:1px;
border:1px solid rgb(165,171,184);
}
QMenuBar::item{
background:#F0F0F0;
width:30px;
height:15px;
}
QMenuBar::item:selected{
background:rgb(185,196,221);
}
QMenu{
background:rgb(255,255,255);
color:rgb(0,0,0);
border:1px solid rgb(165,171,184);
}
QMenu::item:selected{
background:rgb(69,123,255);
color:white;
}
</string>
</property>
<widget class="QMenu" name="file">
<property name="title">
<string>文件</string>
</property>
<addaction name="mActionOpenImg"/>
<addaction name="separator"/>
<addaction name="mSetting"/>
<addaction name="action_exit"/>
</widget>
<widget class="QMenu" name="menuspectrometer">
<property name="title">
<string>光谱仪</string>
</property>
<widget class="QMenu" name="menu">
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
<property name="title">
<string>选择相机类型</string>
</property>
<addaction name="mActionPica_L"/>
<addaction name="mActionPica_NIR"/>
<addaction name="mActionPika_XC2"/>
<addaction name="separator"/>
<addaction name="mActionCorning_410"/>
</widget>
<addaction name="menu"/>
<addaction name="action_connect_imager"/>
<addaction name="separator"/>
<addaction name="action_auto_exposure"/>
<addaction name="action_focus"/>
<addaction name="action_dark"/>
<addaction name="action_reference"/>
<addaction name="separator"/>
<addaction name="action_start_recording"/>
<addaction name="separator"/>
<addaction name="actionOpenDirectory"/>
</widget>
<widget class="QMenu" name="menuhelp">
<property name="title">
<string>帮助</string>
</property>
<addaction name="action_about"/>
</widget>
<widget class="QMenu" name="mWindowsMenu">
<property name="title">
<string>窗口</string>
</property>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>扫描平台</string>
</property>
<addaction name="mAction_is_no_motor"/>
<addaction name="mAction_1AxisMotor"/>
<addaction name="mAction_2AxisMotor_new"/>
<addaction name="separator"/>
<addaction name="mAction_RobotArm"/>
</widget>
<widget class="QMenu" name="mMenuScenario">
<property name="title">
<string>应用场景</string>
</property>
<addaction name="mActionOneMotorScenario"/>
<addaction name="mActionPlantPhenotypeScenario"/>
</widget>
<widget class="QMenu" name="menu_4">
<property name="title">
<string>数据处理</string>
</property>
<addaction name="action_4"/>
<addaction name="action_5"/>
<addaction name="action_13"/>
</widget>
<addaction name="file"/>
<addaction name="menuspectrometer"/>
<addaction name="mMenuScenario"/>
<addaction name="menu_4"/>
<addaction name="menu_2"/>
<addaction name="mWindowsMenu"/>
<addaction name="menuhelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>宋体</family>
<pointsize>2</pointsize>
</font>
</property>
<property name="windowTitle">
<string>相机控制</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar{
background-color: #f5f5f5;
color:rgb(0,0,0);
}
QToolBar QToolButton {
background: #f5f5f5; /* 按钮背景颜色 */
font-size:15px;
border-radius: 3px; /* 按钮圆角 */
padding: 4px; /* 按钮内边距 */
}
QToolBar QToolButton:hover {
background: rgb(185,196,221); /* 按钮悬停背景颜色 */
color: white; /* 按钮悬停文字颜色 */
}
</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="action_connect_imager"/>
<addaction name="action_auto_exposure"/>
<addaction name="action_focus"/>
<addaction name="action_dark"/>
<addaction name="action_reference"/>
<addaction name="action_start_recording"/>
<addaction name="actionOpenDirectory"/>
<addaction name="mActionPan"/>
<addaction name="mActionSpectral"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="styleSheet">
<string notr="true">QStatusBar
{
background-color: #0D1233;
color: white;
}
QStatusBar::item
{
border: none;
}</string>
</property>
</widget>
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>3D模型</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_2">
<layout class="QGridLayout" name="gridLayout_7">
<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>
<property name="verticalSpacing">
<number>0</number>
</property>
</layout>
</widget>
</widget>
<widget class="CustomDockWidgetHideAbove" name="mDockWidgetSpectrometer">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="windowTitle">
<string>控制</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="controlContents">
<property name="styleSheet">
<string notr="true">QWidget #controlContents
{
background-color: #0E1C4C;
border-top: 1px solid #2c586b;
border-left: 1px solid #2c586b;
border-right: 1px solid #2c586b;
border-bottom: 1px solid #2c586b;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="controlTabWidget">
<property name="styleSheet">
<string notr="true">QTabBar::tab {
background: #0E1C4C;
color: white;
padding: 6px 12px;
border: none;
border-top: 1px solid #27376C;
height: 41;
}
QTabBar::tab:selected {
background: #0D1233;
color: white;
border: none;
}
/*QTabBar::tab:hover {
background: #141A45;
}*/
QTabWidget::pane {
border: none;
border-top: 1px solid #27376C;
background: #0D1233;
top: -1px;
}
</string>
</property>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<widget class="QWidget" name="rgbCameraWidget">
<property name="styleSheet">
<string notr="true">QGroupBox
{
border: 12px solid transparent;
color: #ACCDFF;
}
QPushButton
{
/*width: 172px;
height: 56px;*/
font: 19pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
stop:0 #283D86,
stop:1 #0F1A40
);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
}
QPushButton:hover
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #3A4875,
stop:1 #5F6B91
);
}
/* 按下时的效果 */
QPushButton:pressed
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #1A254F,
stop:1 #3A466B
);
/* 可选:添加下压效果 */
padding-top: 9px;
padding-bottom: 7px;
}</string>
</property>
<attribute name="title">
<string>rgb相机</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,4,2" columnstretch="1,3,1">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>174</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
<property name="spacing">
<number>20</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="take_video_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>录制视频</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="take_photo_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>拍照</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="close_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="open_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>173</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBar_2">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar_2</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBar_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar_3</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>BottomToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="action_exit">
<property name="text">
<string>退出</string>
</property>
<property name="font">
<font>
<family>Adobe Devanagari</family>
</font>
</property>
</action>
<action name="action_open">
<property name="text">
<string>open</string>
</property>
<property name="iconText">
<string>open</string>
</property>
</action>
<action name="actionpreference">
<property name="text">
<string>preference...</string>
</property>
</action>
<action name="action_start_recording">
<property name="text">
<string>采集</string>
</property>
</action>
<action name="action_focus">
<property name="text">
<string>调焦</string>
</property>
</action>
<action name="action_auto_exposure">
<property name="text">
<string>曝光</string>
</property>
</action>
<action name="action_dark">
<property name="text">
<string>暗电流</string>
</property>
</action>
<action name="action_reference">
<property name="text">
<string>白板</string>
</property>
</action>
<action name="action_connect_imager">
<property name="text">
<string>连接相机</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="actionOpenDirectory">
<property name="text">
<string>打开文件夹</string>
</property>
</action>
<action name="mActionPica_L">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika L</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="mActionCorning_410">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Corning 410</string>
</property>
</action>
<action name="mActionPika_XC2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika XC2</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="action_about">
<property name="text">
<string>关于</string>
</property>
</action>
<action name="mActionPica_NIR">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika NIR</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="actionpanel">
<property name="text">
<string>面板</string>
</property>
</action>
<action name="action">
<property name="text">
<string>工具栏</string>
</property>
</action>
<action name="action_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>马达</string>
</property>
</action>
<action name="mAction_is_no_motor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>无</string>
</property>
</action>
<action name="mAction_2AxisMotor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>2 轴线性马达</string>
</property>
</action>
<action name="mAction_RobotArm">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="text">
<string>机械臂</string>
</property>
</action>
<action name="mAction_1AxisMotor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>1 轴线性马达</string>
</property>
</action>
<action name="mActionOneMotorScenario">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>室内1轴线性平台</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>
<action name="action_6">
<property name="text">
<string>机械臂</string>
</property>
</action>
<action name="action_7">
<property name="text">
<string>显微镜</string>
</property>
</action>
<action name="action_8">
<property name="text">
<string>三脚架(旋转平台)</string>
</property>
</action>
<action name="mActionOpenImg">
<property name="text">
<string>打开影像</string>
</property>
</action>
<action name="action_10">
<property name="text">
<string>关闭影像</string>
</property>
</action>
<action name="mSetting">
<property name="text">
<string>设置</string>
</property>
</action>
<action name="action_13">
<property name="text">
<string>拼接</string>
</property>
</action>
<action name="mActionPlantPhenotypeScenario">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>植物表型</string>
</property>
</action>
<action name="action2">
<property name="text">
<string>2轴旋转平台</string>
</property>
</action>
<action name="mAction_2AxisMotor_new">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>2 轴线性马达</string>
</property>
</action>
<action name="mActionPan">
<property name="text">
<string>漫游</string>
</property>
</action>
<action name="mActionSpectral">
<property name="text">
<string>光谱</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>CustomDockWidgetBase</class>
<extends>QDockWidget</extends>
<header>customdockwidgetbase.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>CustomDockWidgetHideAbove</class>
<extends>QDockWidget</extends>
<header>CustomDockWidgetBase.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="HPPA.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -417,7 +417,7 @@ HPPA::HPPA(QWidget* parent)
//ui.mDockWidgetSpectrometer->show();
initControlTabwidget();
m_tabManager = new TabManager(ui.controlTabWidget, this);
ui.mDockWidgetSpectrometer->setWidget(tmp(ui.controlContents));
//3D模型看板
@ -739,43 +739,36 @@ QWidget* HPPA::tmp(QWidget* a)
void HPPA::initControlTabwidget()
{
ui.controlTabWidget->removeTab(0);//首先删除默认的tab
m_hic = new HyperImagerControl();
//ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪"));
ui.controlTabWidget->insertTab(0, m_hic, QString::fromLocal8Bit("光谱仪"));
m_hic->setDisabled(true);
ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪"));
ui.controlTabWidget->setCurrentIndex(0);
//rgb相机
m_RgbCameraThread = new QThread();
m_RgbCamera = new RgbCameraOperation();
m_RgbCamera->moveToThread(m_RgbCameraThread);
m_RgbCameraThread->start();
connect(ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera()));//使用信号通知主线程ui线程刷新视频 → 成功,但是界面卡顿
connect(m_RgbCamera, SIGNAL(PlotSignal()), this, SLOT(onPlotRgbImage()));
//m_RgbCamera->setCallback(onPlotRgbImage);
//connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera_callback()));//使用回调函数来刷新主线程ui线程上的视频 → 失败
connect(ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//关闭相机
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
//图像控制
m_ic = new ImageControl();
m_ic->setWindowFlags(Qt::Widget);
connect(m_ic, SIGNAL(bandSelectionChanged(double, double, double)),
this, SLOT(onBandSelectionChanged(double, double, double)));
ui.controlTabWidget->addTab(m_ic, QString::fromLocal8Bit("图像控制"));
ui.controlTabWidget->addTab(m_ic, QString::fromLocal8Bit("图像控制"));//?????????????????????????????????????????????????????????????????????????????????????????????????
//rgb相机
m_rgbCameraControlWindow = new rgbCameraWindow();
connect(m_rgbCameraControlWindow, &rgbCameraWindow::PlotRgbImageSignal, this, &HPPA::onPlotRgbImage);
connect(m_rgbCameraControlWindow, &rgbCameraWindow::CamClosedSignal, this, &HPPA::onClearLabel);
ui.controlTabWidget->addTab(m_rgbCameraControlWindow, QString::fromLocal8Bit("rgb相机"));
//升降桌dock
m_adt = new adjustTable();
m_adt->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_adt, QString::fromLocal8Bit("升降桌"));
//电源控制
m_pc = new PowerControl();
m_pc->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
//机械臂控制
m_rac = new RobotArmControl();
@ -795,7 +788,6 @@ void HPPA::initControlTabwidget()
m_tmc->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2轴控制"));
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
connect(m_ic, SIGNAL(bandSelectionChanged(double,double,double)),
this, SLOT(onBandSelectionChanged(double,double,double)));
@ -1218,7 +1210,7 @@ void HPPA::createOneMotorScenario()
ui.mAction_1AxisMotor->setChecked(true);
//右下角控制tab
m_tabManager->hideTab(ui.rgbCameraWidget);
m_tabManager->hideTab(m_rgbCameraControlWindow);
m_tabManager->hideTab(m_adt);
m_tabManager->hideTab(m_pc);
m_tabManager->hideTab(m_rac);
@ -1243,13 +1235,13 @@ void HPPA::createPlantPhenotypeScenario()
// return;
//在菜单中选择移动平台
ui.mAction_2AxisMotor_new->setChecked(true);
ui.mAction_2AxisMotor_new->setChecked(true);
//右下角控制tab
m_tabManager->hideTab(m_rac);
m_tabManager->hideTab(m_omc);
m_tabManager->showTab(ui.rgbCameraWidget);
m_tabManager->showTab(m_rgbCameraControlWindow);
m_tabManager->showTab(m_adt);
m_tabManager->showTab(m_pc);
m_tabManager->showTab(m_tmc);
@ -1753,7 +1745,7 @@ void HPPA::OnSendLogToCallClass(QString str)
void HPPA::onPlotRgbImage()
{
//std::cout << "显示视频+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
QPixmap pixmap = QPixmap::fromImage(m_RgbCamera->m_qImage);
QPixmap pixmap = QPixmap::fromImage(m_rgbCameraControlWindow->m_RgbCamera->m_qImage);
int width = m_cam_label->width();
int height = m_cam_label->height();
@ -1762,12 +1754,6 @@ void HPPA::onPlotRgbImage()
m_cam_label->setPixmap(fitpixmap);
}
void HPPA::onCloseRgbCamera()
{
//std::cout << "关闭视频+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
m_RgbCamera->CloseCamera();
}
void HPPA::onClearLabel()
{
m_cam_label->clear();

View File

@ -77,6 +77,8 @@
#include "AppSettings.h"
#include "FileNameLineEdit.h"
#include "rgbCameraWindow.h"
#define PI 3.1415926
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
@ -221,7 +223,7 @@ private:
int m_RecordState;//用来控制相机采集流程取2的余数1 → 正在采集0 → 停止采集
QThread * m_RecordThread;//影像采集线程
QThread * m_RgbCameraThread;//rgb相机获取图像线程
QThread * m_CopyFileThread;//影像文件复制线程
FileOperation * m_FileOperation;
@ -243,7 +245,7 @@ private:
//
int m_TabWidgetCurrentIndex;//当手动选择TabWidget的标签时记录变化后的tab index
RgbCameraOperation *m_RgbCamera;
void getRequest(QString str);
@ -274,6 +276,7 @@ private:
TabManager* m_tabManager;
HyperImagerControl* m_hic;
rgbCameraWindow* m_rgbCameraControlWindow;
ImageControl* m_ic;
adjustTable* m_adt;
PowerControl* m_pc;
@ -346,7 +349,7 @@ public Q_SLOTS:
void OnSendLogToCallClass(QString str);
void onPlotRgbImage();
void onCloseRgbCamera();
void onClearLabel();
void onCopyFinished();

View File

@ -383,119 +383,6 @@ QPushButton:pressed
<attribute name="title">
<string>rgb相机</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,4,2" columnstretch="1,3,1">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>174</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
<property name="spacing">
<number>20</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="take_video_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>录制视频</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="take_photo_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>拍照</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="close_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="open_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>173</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>

View File

@ -147,6 +147,7 @@
<ClCompile Include="resononImager.cpp" />
<ClCompile Include="ResononNirImager.cpp" />
<ClCompile Include="RgbCameraOperation.cpp" />
<ClCompile Include="rgbCameraWindow.cpp" />
<ClCompile Include="RobotArmControl.cpp" />
<ClCompile Include="setWindow.cpp" />
<ClCompile Include="stdafx.cpp">
@ -181,6 +182,7 @@
<QtUic Include="PowerControl.ui" />
<QtUic Include="RadianceConversion.ui" />
<QtUic Include="ReflectanceConversion.ui" />
<QtUic Include="rgbCamera.ui" />
<QtUic Include="RobotArmControl.ui" />
<QtUic Include="set.ui" />
<QtUic Include="twoMotorControl.ui" />
@ -233,6 +235,7 @@
<ClInclude Include="RasterRenderer.h" />
<QtMoc Include="recordFrameCounter.h" />
<QtMoc Include="setWindow.h" />
<QtMoc Include="rgbCameraWindow.h" />
<ClInclude Include="utility_tc.h" />
<QtMoc Include="aboutWindow.h" />
<ClInclude Include="hppaConfigFile.h" />

View File

@ -211,6 +211,9 @@
<ClCompile Include="MotorWindowBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="rgbCameraWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h">
@ -342,6 +345,9 @@
<QtMoc Include="FileNameLineEdit.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="rgbCameraWindow.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="imageProcessor.h">
@ -430,6 +436,9 @@
<QtUic Include="set.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="rgbCamera.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

View File

@ -288,7 +288,7 @@ QPushButton:pressed
}</string>
</property>
<property name="text">
<string>版本3.0.0</string>
<string>版本3.0.1</string>
</property>
</widget>
</item>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>501</width>
<height>363</height>
<height>267</height>
</rect>
</property>
<property name="sizePolicy">

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>520</width>
<height>360</height>
<height>229</height>
</rect>
</property>
<property name="windowTitle">

186
HPPA/rgbCamera.ui Normal file
View File

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>rgbCameraClass</class>
<widget class="QDialog" name="rgbCameraClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<height>219</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>rgbCamera</string>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox
{
border: 12px solid transparent;
/*border-top: 12px solid transparent;
border-right: 0px solid transparent;
border-bottom: 0px solid transparent;
border-left: 0px solid transparent;*/
color: #ACCDFF;
}
QPushButton
{
/*width: 172px;
height: 56px;*/
font: 19pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
stop:0 #283D86,
stop:1 #0F1A40
);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
}
QPushButton:hover
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #3A4875,
stop:1 #5F6B91
);
}
/* 按下时的效果 */
QPushButton:pressed
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #1A254F,
stop:1 #3A466B
);
/* 可选:添加下压效果 */
padding-top: 9px;
padding-bottom: 7px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="open_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打 开</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="close_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关 闭</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="take_video_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>录制视频</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="take_photo_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>拍 照</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

32
HPPA/rgbCameraWindow.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "rgbCameraWindow.h"
#include <Qthread>
rgbCameraWindow::rgbCameraWindow(QWidget* parent)
: QDialog(parent)
{
ui.setupUi(this);
m_RgbCameraThread = new QThread();
m_RgbCamera = new RgbCameraOperation();
m_RgbCamera->moveToThread(m_RgbCameraThread);
m_RgbCameraThread->start();
connect(ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera()));//ʹ<><CAB9><EFBFBD>ź<EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>Ƶ <20><> <20>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><E6BFA8>
connect(m_RgbCamera, SIGNAL(PlotSignal()), this, SIGNAL(PlotRgbImageSignal()));
//m_RgbCamera->setCallback(onPlotRgbImage);
//connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera_callback()));//ʹ<>ûص<C3BB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3><CCA3>ϵ<EFBFBD><CFB5><EFBFBD>Ƶ <20><> ʧ<><CAA7>
connect(ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SIGNAL(CamClosedSignal()));
}
rgbCameraWindow::~rgbCameraWindow()
{
}
void rgbCameraWindow::onCloseRgbCamera()
{
//std::cout << "<22>ر<EFBFBD><D8B1><EFBFBD>Ƶ+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
m_RgbCamera->CloseCamera();
}

34
HPPA/rgbCameraWindow.h Normal file
View File

@ -0,0 +1,34 @@
#pragma once
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include "ui_rgbCamera.h"
#include "RgbCameraOperation.h"
class rgbCameraWindow : public QDialog
{
Q_OBJECT
public:
rgbCameraWindow(QWidget* parent = nullptr);
~rgbCameraWindow();
RgbCameraOperation* m_RgbCamera;
public Q_SLOTS:
void onCloseRgbCamera();
signals:
void PlotRgbImageSignal();
void CamClosedSignal();
private:
Ui::rgbCameraClass ui;
QThread* m_RgbCameraThread;//rgb<67><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡͼ<C8A1><CDBC><EFBFBD>߳<EFBFBD>
};