3 Commits

Author SHA1 Message Date
b23aedc6c7 美化ui 2026-03-18 15:56:06 +08:00
06dffddfd0 美化窗口:关于+图像控制 2026-03-18 00:03:56 +08:00
ca10848750 调焦窗口美化 2026-03-17 19:11:33 +08:00
16 changed files with 1271 additions and 382 deletions

View File

@ -126,10 +126,27 @@ void MyCarousel::contextMenuEvent(QContextMenuEvent* event)
void MyCarousel::showContextMenu(const QPoint& pos)
{
QMenu menu(this);
menu.setStyleSheet(R"(
QMenu {
background-color: #2a5dec;
color: white;
}
QMenu::item:selected {
background-color: #1a4ddc;
}
QMenu::separator {
height: 1px;
background: white;
}
)");
QAction* startAct = menu.addAction(QString::fromLocal8Bit("开始轮播"));
QAction* stopAct = menu.addAction(QString::fromLocal8Bit("停止轮播"));
menu.addSeparator();
QAction* incAct = menu.addAction("+1");
QAction* decAct = menu.addAction("-1");
if (!m_isLocked)
startAct->setEnabled(false);
@ -142,6 +159,15 @@ void MyCarousel::showContextMenu(const QPoint& pos)
startAutoPlay();
else if (act == stopAct)
stopAutoPlay();
else if (act == incAct) {
m_playInterval += 1000;
m_autoPlayerTimer->setInterval(m_playInterval);
}
else if (act == decAct) {
if (m_playInterval > 1)
m_playInterval -= 1000;
m_autoPlayerTimer->setInterval(m_playInterval);
}
}
void MyCarousel::startAutoPlay()

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>632</width>
<height>444</height>
<width>557</width>
<height>432</height>
</rect>
</property>
<property name="windowTitle">
@ -17,258 +17,609 @@
<iconset resource="HPPA.qrc">
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" rowspan="2">
<widget class="QGroupBox" name="connectFocusModule_groupBox">
<property name="title">
<string>连接调焦模块</string>
<property name="styleSheet">
<string notr="true">QLineEdit {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 4px 8px;
min-width: 70px;
min-height: 20px;
font-size: 13px;
}
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: 10pt &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 8px;
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;
}
QLabel {
color: rgb(255, 255, 255);
}
QSlider::groove:horizontal {
height: 10px;
background: #1e2a44;
border-radius: 3px;
}
/* 已滑过:渐变蓝 */
QSlider::sub-page:horizontal {
background: qlineargradient(
x1:0, y1:0, x2:1, y2:0,
stop:0 #1f4fff,
stop:0.5 #2f6bff,
stop:1 #5fa0ff
);
border-radius: 3px;
}
/* 未滑过 */
QSlider::add-page:horizontal {
height: 10px;
background: #2a3550;
border-radius: 3px;
}
/* ===== 滑块按钮 ===== */
QSlider::handle:horizontal {
width: 15px;
height: 10px;
/* 蓝色实心 */
background: #2f6bff;
/* 白色外圈 */
border: 2px solid #ffffff;
border-radius: 5px;
/* 垂直居中 */
margin: -5px 0;
}
/* 悬停 */
QSlider::handle:horizontal:hover {
background: #4d8dff;
}
/* 按下 */
QSlider::handle:horizontal:pressed {
background: #1f4fff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<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="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="contentWidget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #contentWidget
{
background: #040125;
/*border-radius: 8px 8px 8px 8px;*/
border: 1px solid #2f6bff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<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="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="connectMotor_btn">
<property name="text">
<string>连接线性平台</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="controlFocus_groupBox">
<property name="title">
<string>调焦</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="autoFocus_btn">
<property name="text">
<string>自动调焦</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="manualFocus_btn">
<property name="text">
<string>手动调焦</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="controlMotor_groupBox">
<property name="title">
<string>调整线性平台</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="updateCurrentLocation_btn">
<widget class="QWidget" name="titlebarWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="currentLocation_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>43</height>
</size>
</property>
<property name="text">
<string>null</string>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>43</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="styleSheet">
<string notr="true">QWidget #titlebarWidget
{
background: #0E1C4C;
border: 1px solid #2f6bff;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>调焦</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>505</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="closeBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icon/all/close.svg</normaloff>icon/all/close.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="move2_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="addStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="subtract_btn">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="logicZero_btn">
<property name="text">
<string>LogicZero</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="max_btn">
<property name="text">
<string>max</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="rangeMeasurement_btn">
<property name="text">
<string>量程测量</string>
</property>
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QWidget" name="connectFocusModule_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #connectFocusModule_widget
{
background: #121945;
border-radius: 5px 5px 5px 5px;
}
QRadioButton
{
color: #E2EDFF;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>连接调焦模块</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>线性平台</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="motorPort_comboBox"/>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="ultrasound_radioButton">
<property name="text">
<string>超声</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="ultrasoundPort_comboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="is_new_version_radioButton">
<property name="text">
<string>新版</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>107</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="connectMotor_btn">
<property name="text">
<string>连接线性平台</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="controlMotor_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #controlMotor_widget
{
background: #121945;
border-radius: 5px 5px 5px 5px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QPushButton" name="moveto_btn">
<property name="text">
<string>移动至</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="logicZero_btn">
<property name="text">
<string>LogicZero</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="move2_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="add_btn">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="subtractStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="updateCurrentLocation_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>34</height>
</size>
</property>
<property name="text">
<string>更新实时位置</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="addStepSize_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>10</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="rangeMeasurement_btn">
<property name="text">
<string>量程测量</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="currentLocation_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>null</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="subtract_btn">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="max_btn">
<property name="text">
<string>max</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>调整线性平台</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="controlFocus_widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #controlFocus_widget
{
background: #121945;
border-radius: 5px 5px 5px 5px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>调焦</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>采样率</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="sample_ratio_lineEdit">
<property name="minimumSize">
<size>
<width>88</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="autoFocusProgress_progressBar">
<property name="styleSheet">
<string notr="true">QProgressBar {
border: 2px solid #08FACE; /* 边框颜色和宽度 */
border-radius: 8px; /* 圆角 */
background-color: #eee; /* 未完成部分颜色 */
text-align: center; /* 百分比文本居中 */
height: 13px; /* 高度 */
}
QProgressBar::chunk {
background-color: #08FACE; /* 渐变色进度块 */
border-radius: 8px; /* 保持和整体圆角一致 */
}</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="autoFocus_btn">
<property name="text">
<string>自动调焦</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="manualFocus_btn">
<property name="text">
<string>手动调焦</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

View File

@ -276,8 +276,9 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
connect(m_layerTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(onLayerTreeSelectionChanged(QItemSelection,QItemSelection)));
dock_layers->setWidget(dock_layersWidgetContents);
dock_layersWidgetContents->setStyleSheet(qss_DockWidget_contentWidget);
dock_layers->setWidget(tmp(dock_layersWidgetContents));
//dock_layers->setMinimumWidth(449);
//dock_layers->setMaximumWidth(450);
@ -403,11 +404,12 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
}
)");
dock_hyperimgViewer->setWidget(dock_hyperimgViewerWidgetContents);
mPanelMenu->addAction(dock_hyperimgViewer->toggleViewAction());
QWidget* tmp6 = new QWidget();
dock_hyperimgViewer->setTitleBarWidget(tmp6);
dock_hyperimgViewer->setWidget(tmp(dock_hyperimgViewerWidgetContents));
//轮播看板
m_dock_carousel = new CustomDockWidgetBase(QString::fromLocal8Bit("轮播"), this);
m_dock_carousel->setObjectName("mDockCarousel");
@ -429,8 +431,8 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
)");
QGridLayout* gridLayout_carouselContainer = new QGridLayout(carouselContainer);
@ -476,7 +478,7 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
gridLayout_carouselContainer->addWidget(m_carousel);
m_dock_carousel->setWidget(carouselContainer);
m_dock_carousel->setWidget(tmp(carouselContainer));
//控制看板
ui.mDockWidgetSpectrometer->setTile(QString::fromLocal8Bit("控制"));
@ -484,6 +486,8 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
initControlTabwidget();
m_tabManager = new TabManager(ui.controlTabWidget, this);
ui.mDockWidgetSpectrometer->setWidget(tmp(ui.dockWidgetContents_4));
//3D模型看板
ui.mDockWidgetSimulator->setTile(QString::fromLocal8Bit("3D模型"));
//ui.mDockWidgetSimulator->show();
@ -519,7 +523,7 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
connect(m_view3DModelManager, SIGNAL(created3DModelPlantPhenotype()), this, SLOT(onCreated3DModelPlantPhenotype()));
connect(m_view3DModelManager, SIGNAL(created3DModelOneMotor()), this, SLOT(onCreated3DModelOneMotor()));
ui.mDockWidgetSimulator->setWidget(modelWidgetContainer);
ui.mDockWidgetSimulator->setWidget(tmp(modelWidgetContainer));
//看板排版
splitDockWidget(dock_layers, dock_hyperimgViewer, Qt::Horizontal);
@ -750,7 +754,7 @@ void HPPA::initMenubarToolbar()
if (checked)
ui.mActionSpectral->setIcon(QIcon(".//icon//all//spectral_done.svg"));
else
ui.mActionSpectral->setIcon(QIcon(".//icon//all//spectral.svg"));
ui.mActionSpectral->setIcon(QIcon(".//icon//all//spectral.svg"));
});
// 使用样式表设置透明背景
@ -779,6 +783,22 @@ void HPPA::initMenubarToolbar()
setMenuWidget(topWidget);
}
QWidget* HPPA::tmp(QWidget* a)
{
QWidget* Background = new QWidget(this);
Background->setObjectName("Background");
QGridLayout* layout_Background = new QGridLayout(Background);
layout_Background->setContentsMargins(0, 0, 0, 0);
Background->setStyleSheet(R"(
QWidget #Background{
background: #040125;
}
)");
layout_Background->addWidget(a);
return Background;
}
void HPPA::initControlTabwidget()
{
//rgb相机
@ -900,6 +920,7 @@ void HPPA::createActionGroups()
ui.mActionCorning_410->setChecked(true);
}
updateImagerPicture(lastSelectedAction);
}
void HPPA::selectingImager(QAction* selectedAction)
@ -907,6 +928,30 @@ void HPPA::selectingImager(QAction* selectedAction)
QSettings settings;
settings.setValue("LastSelectedImagerAction", selectedAction->objectName());
settings.sync();
updateImagerPicture(selectedAction->objectName());
}
void HPPA::updateImagerPicture(const QString& actionName)
{
QString picPath;
if (actionName == "mActionPica_L")
picPath = ".//icon//imagerPicture//L.png";
else if (actionName == "mActionPica_NIR")
picPath = ".//icon//imagerPicture//IR.png";
else if (actionName == "mActionPika_XC2")
picPath = ".//icon//imagerPicture//XC2.png";
else if (actionName == "mActionCorning_410")
picPath = ".//icon//imagerPicture//corning410.png";
if (!picPath.isEmpty())
{
QPixmap pixmap(picPath);
if (!pixmap.isNull())
{
ui.imagerPictureLabel->setPixmap(pixmap);
}
}
}
void HPPA::createMoveplatformActionGroup()
@ -1077,6 +1122,29 @@ void HPPA::initPanelToolbar()
ui.mWindowsMenu->addMenu(mPanelMenu);
ui.mWindowsMenu->addMenu(mToolbarMenu);
mPanelMenu->setStyleSheet(R"(
QMenu {
background-color: #0A1245; /* 菜单背景色 */
border: 1px solid gray; /* 可选,边框样式 */
color: white; /* 根据你的背景调整文字颜色 */
}
QMenu::item:selected {
background-color: rgba(255, 255, 255, 50); /* 选中时的背景色 */
color: white; /* 选中项字体颜色,可选 */
}
)");
mToolbarMenu->setStyleSheet(R"(
QMenu {
background-color: #0A1245; /* 菜单背景色 */
border: 1px solid gray; /* 可选,边框样式 */
color: white; /* 根据你的背景调整文字颜色 */
}
QMenu::item:selected {
background-color: rgba(255, 255, 255, 50); /* 选中时的背景色 */
color: white; /* 选中项字体颜色,可选 */
}
)");
mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction());
@ -1315,7 +1383,7 @@ void HPPA::onStartRecordStep1()
removeAllLayersInRasterGroup();
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
ui.action_start_recording->setIcon(QIcon(".//icon//all//record_ing.svg"));
ui.action_start_recording->setIcon(QIcon(".//icon//all//record_ing.svg"));
//ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
//应该先控制马达运动,当马达运动后,再开始光谱仪采集(发射开始采集信号)
@ -1673,14 +1741,38 @@ void HPPA::onExit()
void HPPA::closeEvent(QCloseEvent* event)
{
QMessageBox::StandardButton ret;
QMessageBox msgBox(this);
msgBox.setWindowTitle(QString::fromLocal8Bit("退出确认"));
msgBox.setText(QString::fromLocal8Bit("确定要退出程序吗?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setStyleSheet(R"(
QMessageBox {
background-color: #0D1233;
}
QMessageBox QLabel {
color: #ACCDFF;
font-size: 14px;
}
QPushButton {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 6px 20px;
min-width: 60px;
font-size: 13px;
}
QPushButton:hover {
border: 1px solid #4d8dff;
background-color: red;
}
QPushButton:pressed {
background-color: #23345c;
}
)");
ret = QMessageBox::question(
this,
QString::fromLocal8Bit("退出确认"),
QString::fromLocal8Bit("确定要退出程序吗?"),
QMessageBox::Yes | QMessageBox::No
);
QMessageBox::StandardButton ret = static_cast<QMessageBox::StandardButton>(msgBox.exec());
if (ret == QMessageBox::Yes)
{
@ -1747,9 +1839,9 @@ void HPPA::onconnect()
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请选择相机!"));
msgBox.exec();
msgBox.exec();
return;
return;
}
ui.action_connect_imager->setIcon(QIcon(".//icon//all//connect_imager_ing.svg"));
@ -1882,8 +1974,9 @@ void HPPA::onFocus1()
{
focusWindow* w = new focusWindow(this, m_Imager);
connect(w, SIGNAL(StartManualFocusSignal(int)), this, SLOT(onFocus2(int)));
connect(w, SIGNAL(closeSignal()), this, SLOT(onFocusWindowClosed()));
//w->setModal(true);//设置窗口为模态:只能操作当前窗口
w->setModal(true);//设置窗口为模态:只能操作当前窗口
w->show();
w->exec();
@ -1894,18 +1987,23 @@ void HPPA::onFocus2(int command)
{
if (command == 1)
{
if (m_focusTab)
{
emit StartFocusSignal();
return;
}
//创建影像显示窗口
QWidget* tabTmp = new QWidget();
m_focusTab = new QWidget();
QGridLayout* GridLayout = new QGridLayout();
GridLayout->addWidget(new Mapcavas(tabTmp));
GridLayout->addWidget(new Mapcavas(m_focusTab));
tabTmp->setLayout(GridLayout);
m_focusTab->setLayout(GridLayout);
m_imageViewerTabWidget->addTab(tabTmp, QString::fromLocal8Bit("调焦"));
m_imageViewerTabWidget->addTab(m_focusTab, QString::fromLocal8Bit("调焦"));
//m_imageViewerTabWidget->setCurrentIndex(trackNumber);
m_imageViewerTabWidget->setCurrentWidget(tabTmp);
m_imageViewerTabWidget->setCurrentWidget(m_focusTab);
//开始调焦
@ -1917,6 +2015,19 @@ void HPPA::onFocus2(int command)
}
}
void HPPA::onFocusWindowClosed()
{
//关闭调焦窗口时,停止调焦功能
m_Imager->setFocusControlState(false);
//关闭调焦窗口tab
int index = m_imageViewerTabWidget->indexOf(m_focusTab);
if (index != -1)
{
m_imageViewerTabWidget->removeTab(index);
}
m_focusTab = nullptr;
}
void HPPA::onAbout()
{
aboutWindow about;
@ -2062,13 +2173,16 @@ void HPPA::PlotSpectral(int state)
series->append(i, m_Imager->buffer[1368 * 150 + i]);
}
QChart* chart = new QChart();
chart->legend()->hide();
chart->addSeries(series);
chart->createDefaultAxes();
//chart->setTitle("Simple line chart example");
series->setPen(QPen(QColor("#FF928A"), 2));
m_chartView->setChart(chart);
m_chart->removeAllSeries();
m_chart->addSeries(series);
m_chart->createDefaultAxes();
QValueAxis* axisX = qobject_cast<QValueAxis*>(m_chart->axisX());
QValueAxis* axisY = qobject_cast<QValueAxis*>(m_chart->axisY());
setAxis(axisX, axisY);
}
else
{

View File

@ -199,6 +199,7 @@ private:
void initMenubarToolbar();
void initPanelToolbar();
void initControlTabwidget();
QWidget* tmp(QWidget* a);
QLineEdit * frame_number;
QLineEdit * m_FilenameLineEdit;
@ -241,6 +242,7 @@ private:
QActionGroup* mImagerGroup = nullptr;
void createActionGroups();
void selectingImager(QAction* selectedAction);
void updateImagerPicture(const QString& actionName);
QActionGroup* moveplatformActionGroup = nullptr;
void createMoveplatformActionGroup();
@ -285,6 +287,8 @@ private:
void initMapTools();
void setMapTool();
QWidget* m_focusTab=nullptr;
public Q_SLOTS:
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
void PlotSpectral(int state);
@ -300,6 +304,7 @@ public Q_SLOTS:
void onAutoExposure();
void onFocus1();
void onFocus2(int command);
void onFocusWindowClosed();
void onAbout();
void onDark();
void recordDarkFinish();

View File

@ -11,11 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Hyper Plant Phenotypic Analysis</string>
<string>Spectral Insight</string>
</property>
<property name="windowIcon">
<iconset resource="HPPA.qrc">
<normaloff>:/HPPA/HPPA.ico</normaloff>:/HPPA/HPPA.ico</iconset>
<iconset>
<normaloff>icon/all/png/Group 356_slices/22.png</normaloff>icon/all/png/Group 356_slices/22.png</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
@ -322,7 +322,7 @@ QTabWidget::pane {
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
@ -412,7 +412,7 @@ QSlider::handle:horizontal:pressed {
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
@ -421,15 +421,21 @@ QSlider::handle:horizontal:pressed {
<number>10</number>
</property>
<property name="spacing">
<number>0</number>
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="imagerPictureLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="HPPA.qrc">:/HPPA/HPPA.ico</pixmap>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -457,11 +463,8 @@ QSlider::handle:horizontal:pressed {
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>6</number>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">

View File

@ -32,7 +32,7 @@
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>5.13.2_msvc2017_64</QtInstall>
<QtModules>core;network;gui;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
<QtModules>core;network;gui;svg;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">

View File

@ -68,8 +68,8 @@ QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
}
}
case Qt::CheckStateRole:
return static_cast<int>(n->visible());
//case Qt::CheckStateRole:
// return static_cast<int>(n->visible());
case Qt::ToolTipRole:
return (n->type() == LayerTreeNode::Type::Group) ? "Group" : "Layer";

View File

@ -30,6 +30,19 @@ void LayerTreeView::contextMenuEvent(QContextMenuEvent* event)
setCurrentIndex(QModelIndex());
QMenu* menu = m_menuProvider->createContextMenu();
menu->setStyleSheet(R"(
QMenu {
background-color: #2a5dec;
color: white;
}
QMenu::item:selected {
background-color: #1a4ddc;
}
QMenu::separator {
height: 1px;
background: white;
}
)");
if (menu)
{
menu->exec(event->globalPos());

View File

@ -232,20 +232,44 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
if (connectivity[0])
{
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: #08FACE;
border-radius: 4px;
}
)");
}
else
{
this->ui.xMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: red;
border-radius: 4px;
}
)");
}
if (connectivity[1])
{
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: #08FACE;
border-radius: 4px;
}
)");
}
else
{
this->ui.yMotorStateLabel->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
background-color: red;
border-radius: 4px;
}
)");
}
}
@ -440,7 +464,7 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("保存成功!"));
}
void TwoMotorControl::onReadRecordLineFile_btn()
@ -499,5 +523,5 @@ void TwoMotorControl::onReadRecordLineFile_btn()
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
//QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("读取成功!"));
}

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>463</height>
<width>486</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
@ -18,93 +18,292 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff>HPPA.ico</normaloff>HPPA.ico</iconset>
<normaloff>C:/Users/73505/.designer/backup/HPPA.ico</normaloff>C:/Users/73505/.designer/backup/HPPA.ico</iconset>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>90</x>
<y>250</y>
<width>434</width>
<height>134</height>
</rect>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="companylname_label">
<property name="text">
<string>公司:北京依锐思遥感技术有限公司</string>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="contentWidget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #contentWidget
{
background: #040125;
/*border-radius: 8px 8px 8px 8px;*/
border: 1px solid #2f6bff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>地址北京市海淀区清河安宁庄东路18号5号楼二层205</string>
<property name="topMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>电话010-51292601</string>
<property name="rightMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>邮箱hanshanlong@iris-rs.cn</string>
<property name="bottomMargin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>270</x>
<y>150</y>
<width>141</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>版本2.0</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>270</x>
<y>70</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Hyper Plant Phenotypic Analysis</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>141</width>
<height>141</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>HPPA.ico</pixmap>
</property>
</widget>
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="titlebarWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>43</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>43</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QWidget #titlebarWidget
{
background: #0E1C4C;
border: 1px solid #2f6bff;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>icon/all/png/Group 356_slices/22.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_9">
<property name="styleSheet">
<string notr="true">QLabel
{
color:#E2EDFF;
}</string>
</property>
<property name="text">
<string>关于</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>505</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="closeBtn">
<property name="styleSheet">
<string notr="true">QPushButton
{
/*width: 172px;
height: 56px;*/
font: 10pt &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 8px;
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>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>icon/all/close.svg</normaloff>icon/all/close.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget" native="true">
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>70</x>
<y>20</y>
<width>171</width>
<height>171</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>C:/Users/73505/.designer/backup/icon/all/png/Group 356_slices/Group 356.png</pixmap>
</property>
</widget>
<widget class="QWidget" name="widget_2" native="true">
<property name="geometry">
<rect>
<x>70</x>
<y>210</y>
<width>306</width>
<height>111</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QLabel
{
color: #E2EDFF;
font: 10pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>10</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>地址北京市海淀区清河安宁庄东路18号5号楼二层205</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>电话010-51292601</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>邮箱hanshanlong@iris-rs.cn</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="companylname_label">
<property name="text">
<string>公司:北京依锐思遥感技术有限公司</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="widget_3" native="true">
<property name="geometry">
<rect>
<x>260</x>
<y>50</y>
<width>171</width>
<height>101</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="verticalSpacing">
<number>30</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="styleSheet">
<string notr="true">QLabel
{
color:#E2EDFF;
font: italic 18pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="text">
<string>Spectral Insight</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="versionLabel">
<property name="styleSheet">
<string notr="true">QLabel
{
color:#E2EDFF;
font: 10pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="text">
<string>版本3.0</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>

View File

@ -1,5 +1,6 @@
#include "aboutWindow.h"
#include <QSvgRenderer>
#include <QPainter>
aboutWindow::aboutWindow(QWidget* parent)
{
@ -9,14 +10,22 @@ aboutWindow::aboutWindow(QWidget* parent)
QString text = ui.companylname_label->text();
ui.companylname_label->setText("<a style='color: green; text-decoration: none' href = http://www.iris-rs.cn/pr.jsp?_jcp=3_10>" + text);
Qt::WindowFlags flags = 0;
//flags |= Qt::WindowMinimizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
flags |= Qt::MSWindowsFixedSizeDialogHint;
setWindowFlags(flags);
//Qt::WindowFlags flags = 0;
////flags |= Qt::WindowMinimizeButtonHint;
//flags |= Qt::WindowCloseButtonHint;
//flags |= Qt::MSWindowsFixedSizeDialogHint;
//setWindowFlags(flags);
setWindowFlags(Qt::FramelessWindowHint);
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
}
aboutWindow::~aboutWindow()
{
}
void aboutWindow::onExit()
{
this->close();
}

View File

@ -2,6 +2,7 @@
#include <QtWidgets/qdialog.h>
#include <qstring.h>
#include "ui_about.h"
class aboutWindow :public QDialog
@ -19,6 +20,7 @@ private:
Ui::aboutDialog ui;
public Q_SLOTS:
void onExit();
signals:

View File

@ -1,10 +1,22 @@
#include "stdafx.h"
#include "focusWindow.h"
#include <QSvgRenderer>
#include <QMouseEvent>
focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
{
ui.setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
ui.titlebarWidget->installEventFilter(this);
QSvgRenderer svgRenderer(QString(".//icon//all//focus.svg"));
QPixmap pixmap(24, 24);
pixmap.fill(Qt::transparent); // 背景透明
QPainter painter(&pixmap);
svgRenderer.render(&painter);
ui.iconLabel->setPixmap(pixmap);
//读取配置文件
string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
Configfile configfile;
@ -39,6 +51,7 @@ focusWindow::focusWindow(QWidget *parent, ImagerOperationBase* imager)
connect(this->ui.moveto_btn, SIGNAL(clicked()), this, SLOT(onMoveto()));
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
connect(this->ui.closeBtn, SIGNAL(released()), this, SLOT(onExit()));
//查找可用串口,并显示
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
@ -67,6 +80,7 @@ focusWindow::~focusWindow()
printf("destroy focusWindow-------------------------\n");
emit StartManualFocusSignal(0);//当用户没有点击停止调焦就关闭窗口
emit closeSignal();
delete m_ctrlFocusMotor;
//delete thread1, progressThread;
@ -78,9 +92,50 @@ focusWindow::~focusWindow()
m_MotionCaptureCoordinatorThread.wait();
}
void focusWindow::onExit()
{
this->close();
}
bool focusWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui.titlebarWidget)
{
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton)
{
m_bDrag = true;
m_dragPosition = mouseEvent->globalPos() - frameGeometry().topLeft();
return true;
}
}
else if (event->type() == QEvent::MouseMove)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (m_bDrag && (mouseEvent->buttons() & Qt::LeftButton))
{
move(mouseEvent->globalPos() - m_dragPosition);
return true;
}
}
else if (event->type() == QEvent::MouseButtonRelease)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton)
{
m_bDrag = false;
return true;
}
}
}
return QDialog::eventFilter(obj, event);
}
void focusWindow::disableBeforeConnect(bool disable)
{
ui.controlMotor_groupBox->setDisabled(disable);
ui.controlMotor_widget->setDisabled(disable);
ui.autoFocus_btn->setDisabled(disable);
}

View File

@ -105,8 +105,13 @@ public:
ImagerOperationBase* m_Imager;
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
QPoint m_dragPosition;
bool m_bDrag = false;
Ui::focusDialog ui;
QThread *m_AutoFocusThread;
int m_FocusState;
@ -151,6 +156,8 @@ public Q_SLOTS:
void moveAfterAutoFocus(int motorID, double location);
void onExit();
signals:
void StartManualFocusSignal(int);//1<><31><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -161,6 +168,7 @@ signals:
void zeroStartSignal(int);
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);
void closeSignal();
};
class WorkerThread2 : public QThread

View File

@ -37,6 +37,54 @@ ImageControl::ImageControl(QWidget* parent)
ui.spinRed->setKeyboardTracking(false);
ui.spinGreen->setKeyboardTracking(false);
ui.spinBlue->setKeyboardTracking(false);
ui.groupAdjustments->setStyleSheet(R"(
QDoubleSpinBox {
border: 1px solid #999;
border-radius: 4px;
padding: 2px 20px 2px 6px; /* <20>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>ť */
background: #0e1c4c;
selection-background-color: #0078d7;
font-size: 12px;
color:#ACCDFF ;
}
QDoubleSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right;
width: 16px;
border-left: 1px solid #ccc;
}
QDoubleSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right;
width: 16px;
border-left: 1px solid #ccc;
}
QDoubleSpinBox::up-arrow {
image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_up.svg);
width: 10px;
height: 10px;
}
QDoubleSpinBox::down-arrow {
image: url(D:/cpp_project_vs2022/HPPA/HPPA/icon/all/arrow_down.svg);
width: 10px;
height: 10px;
}
QDoubleSpinBox::up-button:hover,
QDoubleSpinBox::down-button:hover {
background: #e6f2ff;
}
QDoubleSpinBox::up-button:pressed,
QDoubleSpinBox::down-button:pressed {
background: #cce4ff;
}
)");
}
ImageControl::~ImageControl()

View File

@ -28,7 +28,7 @@ QPushButton
{
/*width: 172px;
height: 56px;*/
font: 19pt &quot;新宋体&quot;;
font: 10pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
@ -37,7 +37,7 @@ QPushButton
);
color: white;
border: none;
padding: 8px 16px;
padding: 8px 8px;
border-radius: 4px;
}
QPushButton:hover
@ -120,6 +120,14 @@ QSlider::handle:horizontal:pressed {
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupAdjustments">
<property name="styleSheet">
<string notr="true">QLabel
{
color: #ACCDFF;
font-size: 14px;
font: 9pt &quot;Adobe Devanagari&quot;;
}</string>
</property>
<property name="title">
<string>调整</string>
</property>
@ -237,6 +245,24 @@ QSlider::handle:horizontal:pressed {
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="btnTrueColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>43</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>43</height>
</size>
</property>
<property name="text">
<string>真彩色</string>
</property>
@ -244,6 +270,12 @@ QSlider::handle:horizontal:pressed {
</item>
<item row="0" column="1">
<widget class="QPushButton" name="btnColorInfrared">
<property name="minimumSize">
<size>
<width>0</width>
<height>43</height>
</size>
</property>
<property name="text">
<string>假彩色</string>
</property>