Compare commits
13 Commits
T2.1
...
631216dc66
| Author | SHA1 | Date | |
|---|---|---|---|
| 631216dc66 | |||
| 7d123ca11c | |||
| 8595f7cad7 | |||
| 30e63899a8 | |||
| 30306e9396 | |||
| f0f41f9a17 | |||
| f999d87da6 | |||
| 36ad438608 | |||
| bb1a01f402 | |||
| 797ff77f5f | |||
| 83ef26a1e2 | |||
| e7a73430d0 | |||
| fd5571712a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@ gdal202.dll
|
|||||||
HPPA类图.drawio
|
HPPA类图.drawio
|
||||||
HPPA - 副本.ui
|
HPPA - 副本.ui
|
||||||
icon
|
icon
|
||||||
|
ignore_*
|
||||||
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|||||||
259
HPPA/Carousel.cpp
Normal file
259
HPPA/Carousel.cpp
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
#include "Carousel.h"
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
MyCarousel::MyCarousel(QWidget* parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
m_stackedWidget(new QStackedWidget(this)),
|
||||||
|
m_bottomButtonOverlay(nullptr),
|
||||||
|
m_bottomButtonLayout(nullptr),
|
||||||
|
m_bottomButtonGroup(nullptr),
|
||||||
|
m_currentIndex(0),
|
||||||
|
m_isPlaying(false),
|
||||||
|
m_isLocked(false),
|
||||||
|
m_lockedIndex(-1),
|
||||||
|
m_playInterval(2000),
|
||||||
|
m_intervalButtonSize(40)
|
||||||
|
{
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
layout->addWidget(m_stackedWidget);
|
||||||
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
m_autoPlayerTimer = new QTimer(this);
|
||||||
|
connect(m_autoPlayerTimer, &QTimer::timeout,
|
||||||
|
this, &MyCarousel::slideRight);
|
||||||
|
|
||||||
|
m_nomalQSS= R"(
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #FFFFFF;
|
||||||
|
}
|
||||||
|
QPushButton:checked
|
||||||
|
{
|
||||||
|
background-color: #08F8E8;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #08F8E8;
|
||||||
|
}
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: red;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
/*QPushButton:!checked {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #FFFFFF;
|
||||||
|
}*/
|
||||||
|
)";
|
||||||
|
|
||||||
|
m_lockedQSS = R"(
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #FFFFFF;
|
||||||
|
}
|
||||||
|
QPushButton:checked
|
||||||
|
{
|
||||||
|
background-color: #08F8E8;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid #08F8E8;
|
||||||
|
}
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: red;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::addWidget(QWidget* w)
|
||||||
|
{
|
||||||
|
m_widgets.append(w);
|
||||||
|
m_stackedWidget->addWidget(w);
|
||||||
|
updateStackedWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::play()
|
||||||
|
{
|
||||||
|
if (m_widgets.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_isPlaying = true;
|
||||||
|
|
||||||
|
// 创建底部按钮
|
||||||
|
m_bottomButtonLayout = new QHBoxLayout();
|
||||||
|
m_bottomButtonGroup = new QButtonGroup(this);
|
||||||
|
m_bottomButtons.clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < m_widgets.size(); ++i) {
|
||||||
|
QPushButton* btn = new QPushButton(this);
|
||||||
|
btn->setCheckable(true);
|
||||||
|
btn->setFixedSize(m_intervalButtonSize, 3);
|
||||||
|
btn->setStyleSheet(m_nomalQSS);
|
||||||
|
btn->setFixedHeight(10);
|
||||||
|
btn->setFixedWidth(10);
|
||||||
|
|
||||||
|
m_bottomButtonLayout->addWidget(btn);
|
||||||
|
m_bottomButtonGroup->addButton(btn, i);
|
||||||
|
m_bottomButtons.append(btn);
|
||||||
|
|
||||||
|
connect(btn, &QPushButton::clicked, this, [this, i]() {
|
||||||
|
onButtonClicked(i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bottomButtonOverlay = new QWidget(this);
|
||||||
|
m_bottomButtonOverlay->setLayout(m_bottomButtonLayout);
|
||||||
|
m_bottomButtonOverlay->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
m_bottomButtonOverlay->show();
|
||||||
|
|
||||||
|
m_autoPlayerTimer->setInterval(m_playInterval);
|
||||||
|
m_autoPlayerTimer->start();
|
||||||
|
|
||||||
|
updateStackedWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::contextMenuEvent(QContextMenuEvent* event)
|
||||||
|
{
|
||||||
|
showContextMenu(event->globalPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::showContextMenu(const QPoint& pos)
|
||||||
|
{
|
||||||
|
QMenu menu(this);
|
||||||
|
|
||||||
|
QAction* startAct = menu.addAction(QString::fromLocal8Bit("开始轮播"));
|
||||||
|
QAction* stopAct = menu.addAction(QString::fromLocal8Bit("停止轮播"));
|
||||||
|
|
||||||
|
if (!m_isLocked)
|
||||||
|
startAct->setEnabled(false);
|
||||||
|
|
||||||
|
if (m_isLocked)
|
||||||
|
stopAct->setEnabled(false);
|
||||||
|
|
||||||
|
QAction* act = menu.exec(pos);
|
||||||
|
|
||||||
|
if (act == startAct)
|
||||||
|
startAutoPlay();
|
||||||
|
else if (act == stopAct)
|
||||||
|
stopAutoPlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::startAutoPlay()
|
||||||
|
{
|
||||||
|
updateButtonState(m_currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::stopAutoPlay()
|
||||||
|
{
|
||||||
|
updateButtonState(m_currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::onButtonClicked(int index)
|
||||||
|
{
|
||||||
|
updateButtonState(index);
|
||||||
|
gotoWidget(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::updateButtonState(int index)
|
||||||
|
{
|
||||||
|
if (m_isLocked)
|
||||||
|
{
|
||||||
|
if (index == m_lockedIndex) {
|
||||||
|
// 解锁
|
||||||
|
m_isLocked = false;
|
||||||
|
m_lockedIndex = -1;
|
||||||
|
|
||||||
|
if (m_isPlaying)
|
||||||
|
m_autoPlayerTimer->start();
|
||||||
|
|
||||||
|
restoreButtonStyle(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 切换锁定
|
||||||
|
restoreButtonStyle(m_lockedIndex);
|
||||||
|
setButtonLocked(index);
|
||||||
|
m_lockedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 初次锁定
|
||||||
|
m_isLocked = true;
|
||||||
|
m_lockedIndex = index;
|
||||||
|
m_autoPlayerTimer->stop();
|
||||||
|
setButtonLocked(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::setButtonLocked(int index)
|
||||||
|
{
|
||||||
|
QPushButton* btn = m_bottomButtons[index];
|
||||||
|
btn->setText("");
|
||||||
|
btn->setStyleSheet(m_lockedQSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::restoreButtonStyle(int index)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QPushButton* btn = m_bottomButtons[index];
|
||||||
|
btn->setText("");
|
||||||
|
btn->setStyleSheet(m_nomalQSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::slideLeft()
|
||||||
|
{
|
||||||
|
if (m_widgets.isEmpty() || m_isLocked || !m_isPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_currentIndex = (m_currentIndex - 1 + m_widgets.size()) % m_widgets.size();
|
||||||
|
updateStackedWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::slideRight()
|
||||||
|
{
|
||||||
|
if (m_widgets.isEmpty() || m_isLocked || !m_isPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_currentIndex = (m_currentIndex + 1) % m_widgets.size();
|
||||||
|
updateStackedWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::gotoWidget(int index)
|
||||||
|
{
|
||||||
|
m_currentIndex = index;
|
||||||
|
updateStackedWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::updateStackedWidgetVisibility()
|
||||||
|
{
|
||||||
|
if (m_widgets.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_stackedWidget->setCurrentIndex(m_currentIndex);
|
||||||
|
|
||||||
|
if (!m_isLocked) {
|
||||||
|
for (int i = 0; i < m_bottomButtons.size(); ++i)
|
||||||
|
m_bottomButtons[i]->setChecked(i == m_currentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCarousel::resizeEvent(QResizeEvent*)
|
||||||
|
{
|
||||||
|
if (!m_bottomButtonOverlay)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int count = m_widgets.size();
|
||||||
|
int totalWidth = m_intervalButtonSize * count + 10 * (count - 1);
|
||||||
|
|
||||||
|
int x = (width() - totalWidth) / 2;
|
||||||
|
int y = height() - m_intervalButtonSize;
|
||||||
|
|
||||||
|
m_bottomButtonOverlay->setGeometry(x, y, totalWidth, m_intervalButtonSize);
|
||||||
|
}
|
||||||
66
HPPA/Carousel.h
Normal file
66
HPPA/Carousel.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
class MyCarousel : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MyCarousel(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void addWidget(QWidget* w);
|
||||||
|
void play();
|
||||||
|
void gotoWidget(int index);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||||
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slideLeft();
|
||||||
|
void slideRight();
|
||||||
|
void onButtonClicked(int index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// UI
|
||||||
|
QStackedWidget* m_stackedWidget;
|
||||||
|
QWidget* m_bottomButtonOverlay;
|
||||||
|
QHBoxLayout* m_bottomButtonLayout;
|
||||||
|
QButtonGroup* m_bottomButtonGroup;
|
||||||
|
|
||||||
|
QVector<QWidget*> m_widgets;
|
||||||
|
QVector<QPushButton*> m_bottomButtons;
|
||||||
|
QString m_nomalQSS;
|
||||||
|
QString m_lockedQSS;
|
||||||
|
|
||||||
|
// ״ֵ̬
|
||||||
|
int m_currentIndex;
|
||||||
|
bool m_isPlaying;
|
||||||
|
bool m_isLocked;
|
||||||
|
int m_lockedIndex;
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD>
|
||||||
|
int m_playInterval;
|
||||||
|
int m_intervalButtonSize;
|
||||||
|
|
||||||
|
QTimer* m_autoPlayerTimer;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateStackedWidgetVisibility();
|
||||||
|
void updateButtonState(int index);
|
||||||
|
|
||||||
|
void setButtonLocked(int index);
|
||||||
|
void restoreButtonStyle(int index);
|
||||||
|
|
||||||
|
void showContextMenu(const QPoint& pos);
|
||||||
|
|
||||||
|
void startAutoPlay();
|
||||||
|
void stopAutoPlay();
|
||||||
|
};
|
||||||
204
HPPA/CustomDockWidgetBase.cpp
Normal file
204
HPPA/CustomDockWidgetBase.cpp
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
#include "CustomDockWidgetBase.h"
|
||||||
|
|
||||||
|
CustomDockWidgetBase::CustomDockWidgetBase(QMainWindow* parent)
|
||||||
|
: QDockWidget(parent),
|
||||||
|
m_mainWindow(parent),
|
||||||
|
m_isMaximized(false)
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomDockWidgetBase::CustomDockWidgetBase(QString title, QMainWindow* parent)
|
||||||
|
: QDockWidget(title, parent),
|
||||||
|
m_mainWindow(parent),
|
||||||
|
m_isMaximized(false)
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
setTile(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomDockWidgetBase::initialize()
|
||||||
|
{
|
||||||
|
QWidget* titleBar_Background = new QWidget(this);
|
||||||
|
titleBar_Background->setObjectName("titleBar_Background");
|
||||||
|
QGridLayout* layout_titleBar_Background = new QGridLayout(titleBar_Background);
|
||||||
|
layout_titleBar_Background->setContentsMargins(0, 0, 0, 0);
|
||||||
|
titleBar_Background->setStyleSheet(R"(
|
||||||
|
QWidget #titleBar_Background{
|
||||||
|
background: #040125;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
|
||||||
|
QWidget* titleBar = new QWidget(titleBar_Background);
|
||||||
|
titleBar->setObjectName("titleBar");
|
||||||
|
QHBoxLayout* layout = new QHBoxLayout(titleBar);
|
||||||
|
titleBar->setFixedHeight(30);
|
||||||
|
|
||||||
|
title_label = new QLabel(titleBar);
|
||||||
|
|
||||||
|
layout->setContentsMargins(10, 0, 10, 0);
|
||||||
|
layout->addWidget(title_label);
|
||||||
|
layout->addStretch();
|
||||||
|
|
||||||
|
m_maxButton = new QToolButton(titleBar);
|
||||||
|
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
||||||
|
|
||||||
|
layout->addWidget(m_maxButton);
|
||||||
|
|
||||||
|
titleBar->setStyleSheet(R"(
|
||||||
|
QWidget #titleBar{
|
||||||
|
background: #0E1C4C;
|
||||||
|
/*border: 4px solid #2c586b;*/
|
||||||
|
/*padding-top: 10px;
|
||||||
|
padding-bottom: 10px;*/
|
||||||
|
|
||||||
|
border-top: 1px solid #2c586b;
|
||||||
|
border-left: 1px solid #2c586b;
|
||||||
|
border-right: 1px solid #2c586b;
|
||||||
|
border-bottom: none; /* ȡ<><C8A1><EFBFBD>ײ<EFBFBD><D7B2>߿<EFBFBD> */
|
||||||
|
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
title_label->setStyleSheet("color: white;");
|
||||||
|
m_maxButton->setStyleSheet("");
|
||||||
|
|
||||||
|
layout_titleBar_Background->addWidget(titleBar);
|
||||||
|
|
||||||
|
setTitleBarWidget(titleBar_Background);
|
||||||
|
setFeatures(QDockWidget::DockWidgetClosable);
|
||||||
|
connect(m_maxButton, &QToolButton::clicked, this, &CustomDockWidgetBase::toggleMaximize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomDockWidgetBase::setTile(QString title)
|
||||||
|
{
|
||||||
|
title_label->setText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomDockWidgetBase::hideMaxButton()
|
||||||
|
{
|
||||||
|
m_maxButton->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomDockWidgetBase::toggleMaximize()
|
||||||
|
{
|
||||||
|
if (!m_isMaximized)
|
||||||
|
{
|
||||||
|
m_hiddenDocks.clear();
|
||||||
|
m_originalSizes.clear();
|
||||||
|
|
||||||
|
m_savedState = m_mainWindow->saveState();
|
||||||
|
|
||||||
|
const QList<QDockWidget*> docks = m_mainWindow->findChildren<QDockWidget*>();
|
||||||
|
for (QDockWidget* dock : docks)
|
||||||
|
{
|
||||||
|
m_originalSizes[dock] = dock->size();
|
||||||
|
if (dock != this && dock->isVisible())
|
||||||
|
{
|
||||||
|
dock->hide();
|
||||||
|
m_hiddenDocks.append(dock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isMaximized = true;
|
||||||
|
emit maximizeStateChanged(m_isMaximized);
|
||||||
|
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (QDockWidget* dock : m_hiddenDocks)
|
||||||
|
{
|
||||||
|
dock->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_savedState.isEmpty())
|
||||||
|
{
|
||||||
|
m_mainWindow->restoreState(m_savedState);
|
||||||
|
m_savedState.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QDockWidget*> docks;
|
||||||
|
QList<int> widths, heights;
|
||||||
|
for (auto it = m_originalSizes.begin(); it != m_originalSizes.end(); ++it)
|
||||||
|
{
|
||||||
|
docks.append(it.key());
|
||||||
|
widths.append(it.value().width());
|
||||||
|
heights.append(it.value().height());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mainWindow->resizeDocks(docks, widths, Qt::Horizontal);
|
||||||
|
m_mainWindow->resizeDocks(docks, heights, Qt::Vertical);
|
||||||
|
|
||||||
|
m_isMaximized = false;
|
||||||
|
emit maximizeStateChanged(m_isMaximized);
|
||||||
|
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CustomDockWidgetHideAbove::CustomDockWidgetHideAbove(QString title, QMainWindow* parent)
|
||||||
|
:CustomDockWidgetBase(title, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
CustomDockWidgetHideAbove::CustomDockWidgetHideAbove(QMainWindow* parent)
|
||||||
|
:CustomDockWidgetBase(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomDockWidgetHideAbove::toggleMaximize()
|
||||||
|
{
|
||||||
|
if (!m_isMaximized)
|
||||||
|
{
|
||||||
|
m_hiddenDocks.clear();
|
||||||
|
m_originalSizes.clear();
|
||||||
|
|
||||||
|
m_savedState = m_mainWindow->saveState();
|
||||||
|
|
||||||
|
const QList<QDockWidget*> docks = m_mainWindow->findChildren<QDockWidget*>();
|
||||||
|
for (QDockWidget* dock : docks)
|
||||||
|
{
|
||||||
|
m_originalSizes[dock] = dock->size();
|
||||||
|
if (dock->objectName().contains("mDockCarousel") && dock->isVisible())
|
||||||
|
{
|
||||||
|
dock->hide();
|
||||||
|
m_hiddenDocks.append(dock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isMaximized = true;
|
||||||
|
emit maximizeStateChanged(m_isMaximized);
|
||||||
|
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (QDockWidget* dock : m_hiddenDocks)
|
||||||
|
{
|
||||||
|
dock->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_savedState.isEmpty())
|
||||||
|
{
|
||||||
|
m_mainWindow->restoreState(m_savedState);
|
||||||
|
m_savedState.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//QList<QDockWidget*> docks;
|
||||||
|
//QList<int> widths, heights;
|
||||||
|
//for (auto it = m_originalSizes.begin(); it != m_originalSizes.end(); ++it)
|
||||||
|
//{
|
||||||
|
// docks.append(it.key());
|
||||||
|
// widths.append(it.value().width());
|
||||||
|
// heights.append(it.value().height());
|
||||||
|
//}
|
||||||
|
|
||||||
|
//m_mainWindow->resizeDocks(docks, widths, Qt::Horizontal);
|
||||||
|
//m_mainWindow->resizeDocks(docks, heights, Qt::Vertical);
|
||||||
|
|
||||||
|
m_isMaximized = false;
|
||||||
|
emit maximizeStateChanged(m_isMaximized);
|
||||||
|
m_maxButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
|
||||||
|
}
|
||||||
|
}
|
||||||
53
HPPA/CustomDockWidgetBase.h
Normal file
53
HPPA/CustomDockWidgetBase.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QSize>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
class CustomDockWidgetBase :
|
||||||
|
public QDockWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CustomDockWidgetBase(QString title, QMainWindow* parent = nullptr);
|
||||||
|
explicit CustomDockWidgetBase(QMainWindow* parent = nullptr);
|
||||||
|
void setTile(QString title);
|
||||||
|
void hideMaxButton();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void toggleMaximize();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void maximizeStateChanged(bool isMaximized);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QMainWindow* m_mainWindow = nullptr;
|
||||||
|
QToolButton* m_maxButton = nullptr;
|
||||||
|
bool m_isMaximized = false;
|
||||||
|
|
||||||
|
QList<QDockWidget*> m_hiddenDocks;
|
||||||
|
QByteArray m_savedState;
|
||||||
|
QMap<QDockWidget*, QSize> m_originalSizes;
|
||||||
|
|
||||||
|
QLabel* title_label;
|
||||||
|
void initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
class CustomDockWidgetHideAbove :
|
||||||
|
public CustomDockWidgetBase
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CustomDockWidgetHideAbove(QString title, QMainWindow* parent = nullptr);
|
||||||
|
explicit CustomDockWidgetHideAbove(QMainWindow* parent = nullptr);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void toggleMaximize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
1131
HPPA/HPPA.cpp
1131
HPPA/HPPA.cpp
File diff suppressed because it is too large
Load Diff
73
HPPA/HPPA.h
73
HPPA/HPPA.h
@ -12,6 +12,7 @@
|
|||||||
#include <QLineSeries>
|
#include <QLineSeries>
|
||||||
#include <QChart>
|
#include <QChart>
|
||||||
#include <QChartView>
|
#include <QChartView>
|
||||||
|
#include <QValueAxis>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
@ -42,6 +43,17 @@
|
|||||||
#include "ResononNirImager.h"
|
#include "ResononNirImager.h"
|
||||||
#include "Corning410Imager.h"
|
#include "Corning410Imager.h"
|
||||||
|
|
||||||
|
#include "CustomDockWidgetBase.h"
|
||||||
|
#include "Carousel.h"
|
||||||
|
|
||||||
|
#include "View3D.h"
|
||||||
|
#include "TabManager.h"
|
||||||
|
|
||||||
|
#include "View3DModelManager.h"
|
||||||
|
|
||||||
|
#include "LayerTreeModel.h"
|
||||||
|
#include "LayerTree.h"
|
||||||
|
|
||||||
#define PI 3.1415926
|
#define PI 3.1415926
|
||||||
|
|
||||||
QT_CHARTS_USE_NAMESPACE//QChartView ʹ<><CAB9> <20><>Ҫ<EFBFBD>Ӻ꣬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
QT_CHARTS_USE_NAMESPACE//QChartView ʹ<><CAB9> <20><>Ҫ<EFBFBD>Ӻ꣬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||||
@ -123,6 +135,31 @@ signals:
|
|||||||
void threadSignal(QString s);
|
void threadSignal(QString s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WidgetWithBackgroundPicture : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit WidgetWithBackgroundPicture(QWidget* parent = nullptr)
|
||||||
|
: QWidget(parent),
|
||||||
|
m_pixmap(".//icon//titile_bar_bgp.png") // ʹ<><CAB9><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||||
|
{
|
||||||
|
// <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC>С
|
||||||
|
resize(800, 600);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent* event) override
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
QPixmap scaled = m_pixmap.scaled(size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||||
|
painter.drawPixmap(rect(), scaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPixmap m_pixmap;
|
||||||
|
};
|
||||||
|
|
||||||
class HPPA : public QMainWindow
|
class HPPA : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -137,11 +174,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::HPPAClass ui;
|
Ui::HPPAClass ui;
|
||||||
|
QTabWidget* m_imageViewerTabWidget;
|
||||||
|
|
||||||
QMenu* mPanelMenu = nullptr;
|
QMenu* mPanelMenu = nullptr;
|
||||||
QMenu* mToolbarMenu = nullptr;
|
QMenu* mToolbarMenu = nullptr;
|
||||||
|
|
||||||
|
void initMenubarToolbar();
|
||||||
void initPanelToolbar();
|
void initPanelToolbar();
|
||||||
|
void initControlTabwidget();
|
||||||
|
|
||||||
QLineEdit * frame_number;
|
QLineEdit * frame_number;
|
||||||
QLineEdit * m_FilenameLineEdit;
|
QLineEdit * m_FilenameLineEdit;
|
||||||
@ -160,6 +200,7 @@ private:
|
|||||||
FileOperation * m_FileOperation;
|
FileOperation * m_FileOperation;
|
||||||
|
|
||||||
QChartView * m_chartView;
|
QChartView * m_chartView;
|
||||||
|
QChart* m_chart;
|
||||||
|
|
||||||
//QLineSeries *series;
|
//QLineSeries *series;
|
||||||
//QChart *chart;
|
//QChart *chart;
|
||||||
@ -183,19 +224,37 @@ private:
|
|||||||
QActionGroup* mImagerGroup = nullptr;
|
QActionGroup* mImagerGroup = nullptr;
|
||||||
void createActionGroups();
|
void createActionGroups();
|
||||||
void selectingImager(QAction* selectedAction);
|
void selectingImager(QAction* selectedAction);
|
||||||
|
|
||||||
QActionGroup* moveplatformActionGroup = nullptr;
|
QActionGroup* moveplatformActionGroup = nullptr;
|
||||||
void createMoveplatformActionGroup();
|
void createMoveplatformActionGroup();
|
||||||
void selectingMoveplatform(QAction* selectedAction);
|
void selectingMoveplatform(QAction* selectedAction);
|
||||||
RobotArmControl* rac;
|
|
||||||
|
|
||||||
OneMotorControl* omc;
|
QActionGroup* m_ScenarioActionGroup = nullptr;
|
||||||
QDockWidget* dock_omc;
|
void createScenarioActionGroup();
|
||||||
|
void selectScenario(QAction* selectedAction);
|
||||||
|
|
||||||
|
|
||||||
TwoMotorControl* tmc;
|
|
||||||
QDockWidget* dock_tmc;
|
|
||||||
|
|
||||||
FILE* m_hTimesFile;
|
FILE* m_hTimesFile;
|
||||||
|
|
||||||
|
CustomDockWidgetBase* m_dock_carousel;
|
||||||
|
|
||||||
|
MyCarousel* m_carousel;
|
||||||
|
QLabel* m_cam_label;
|
||||||
|
QPushButton* m_open_rgb_camera_btn;
|
||||||
|
QPushButton* m_close_rgb_camera_btn;
|
||||||
|
|
||||||
|
TabManager* m_tabManager;
|
||||||
|
|
||||||
|
adjustTable* m_adt;
|
||||||
|
PowerControl* m_pc;
|
||||||
|
RobotArmControl* m_rac;
|
||||||
|
OneMotorControl* m_omc;
|
||||||
|
TwoMotorControl* m_tmc;
|
||||||
|
|
||||||
|
View3DModelManager* m_view3DModelManager;
|
||||||
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
||||||
void PlotSpectral(int state);
|
void PlotSpectral(int state);
|
||||||
@ -228,6 +287,7 @@ public Q_SLOTS:
|
|||||||
void OnGainSliderChanged(double Gain);//
|
void OnGainSliderChanged(double Gain);//
|
||||||
|
|
||||||
void onLeftMouseButtonPressed(int x, int y);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
void onLeftMouseButtonPressed(int x, int y);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||||
|
void setAxis(QValueAxis* axisX, QValueAxis* axisY);
|
||||||
|
|
||||||
|
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
@ -246,6 +306,9 @@ public Q_SLOTS:
|
|||||||
void recordFromRobotArm(int fileCounter);
|
void recordFromRobotArm(int fileCounter);
|
||||||
|
|
||||||
void createOneMotorScenario();
|
void createOneMotorScenario();
|
||||||
|
void createPlantPhenotypeScenario();
|
||||||
|
void onCreated3DModelPlantPhenotype();
|
||||||
|
void onCreated3DModelOneMotor();
|
||||||
signals:
|
signals:
|
||||||
void StartFocusSignal();
|
void StartFocusSignal();
|
||||||
void StartRecordSignal();
|
void StartRecordSignal();
|
||||||
|
|||||||
771
HPPA/HPPA.ui
771
HPPA/HPPA.ui
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1194</width>
|
<width>1486</width>
|
||||||
<height>834</height>
|
<height>898</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -20,71 +20,13 @@
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget"/>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<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>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTabWidget" name="ImageViewerTabWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>5</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab_4">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 1</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<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>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_5">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 2</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1194</width>
|
<width>1486</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -191,11 +133,7 @@ color:white;
|
|||||||
<string>应用场景</string>
|
<string>应用场景</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="mActionOneMotorScenario"/>
|
<addaction name="mActionOneMotorScenario"/>
|
||||||
<addaction name="action_8"/>
|
<addaction name="mActionPlantPhenotypeScenario"/>
|
||||||
<addaction name="action2"/>
|
|
||||||
<addaction name="action_7"/>
|
|
||||||
<addaction name="action_3"/>
|
|
||||||
<addaction name="action_6"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_4">
|
<widget class="QMenu" name="menu_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -273,125 +211,15 @@ QToolBar QToolButton:hover {
|
|||||||
</string>
|
</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QDockWidget" name="mDockWidgetRGBCamera">
|
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">/* 标题设置 */
|
<string notr="true"/>
|
||||||
QDockWidget::title {
|
|
||||||
text-align: left;
|
|
||||||
background-color: rgb(240, 240, 240);
|
|
||||||
/*padding-left: 35px;*/
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>RGB 相机</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="dockWidgetArea">
|
|
||||||
<number>1</number>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<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>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
|
||||||
<property name="mouseTracking">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QGroupBox {
|
|
||||||
/* border: 2px solid #3498db; 边框颜色 */
|
|
||||||
border-radius: 5px; /* 圆角 */
|
|
||||||
padding: 10px; /* 内边距 */
|
|
||||||
background-color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
QGroupBox:title {
|
|
||||||
subcontrol-position: top left; /* 标题位置 */
|
|
||||||
padding: 0 10px; /* 标题内边距 */
|
|
||||||
font-weight: bold; /* 标题字体加粗 */
|
|
||||||
color: #3498db; /* 标题文字颜色 */
|
|
||||||
}
|
|
||||||
</string>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="close_rgb_camera_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>关闭</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="open_rgb_camera_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>打开</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="cam_label">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>摄像头关闭!</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QDockWidget" name="mDockWidgetSimulator">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">/* 标题设置 */
|
|
||||||
QDockWidget::title {
|
|
||||||
text-align: left;
|
|
||||||
background-color: rgb(240, 240, 240);
|
|
||||||
/*padding-left: 35px;*/
|
|
||||||
}</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="features">
|
<property name="features">
|
||||||
<set>QDockWidget::AllDockWidgetFeatures</set>
|
<set>QDockWidget::AllDockWidgetFeatures</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>线性平台位置模拟</string>
|
<string>3D模型</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -413,125 +241,235 @@ QDockWidget::title {
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="ImagerPositionSimulation" name="graphicsView">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QDockWidget" name="mDockWidgetSpectralViewer">
|
<widget class="CustomDockWidgetHideAbove" name="mDockWidgetSpectrometer">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">/* 标题设置 */
|
<string notr="true"/>
|
||||||
QDockWidget::title {
|
|
||||||
text-align: left;
|
|
||||||
background-color: rgb(240, 240, 240);
|
|
||||||
/*padding-left: 35px;*/
|
|
||||||
}</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>光谱曲线</string>
|
<string>控制</string>
|
||||||
</property>
|
|
||||||
<attribute name="dockWidgetArea">
|
|
||||||
<number>2</number>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents_3">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_10">
|
|
||||||
<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>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QDockWidget" name="mDockWidgetSpectrometer">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">/* 标题设置 */
|
|
||||||
QDockWidget::title {
|
|
||||||
text-align: left;
|
|
||||||
background-color: rgb(240, 240, 240);
|
|
||||||
/*padding-left: 35px;*/
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>光谱仪</string>
|
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="dockWidgetContents_4">
|
<widget class="QWidget" name="dockWidgetContents_4">
|
||||||
<layout class="QGridLayout" name="gridLayout_13">
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QWidget #dockWidgetContents_4
|
||||||
|
{
|
||||||
|
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">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>9</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>9</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>9</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
<widget class="QTabWidget" name="controlTabWidget">
|
||||||
<item>
|
<property name="styleSheet">
|
||||||
<spacer name="horizontalSpacer_16">
|
<string notr="true">QTabBar::tab {
|
||||||
<property name="orientation">
|
background: #0E1C4C;
|
||||||
<enum>Qt::Horizontal</enum>
|
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>
|
||||||
<property name="sizeType">
|
<property name="tabPosition">
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<enum>QTabWidget::South</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="tabShape">
|
||||||
<size>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
<width>100</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="currentIndex">
|
||||||
</item>
|
<number>1</number>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QDoubleSlider" name="FramerateSlider">
|
<property name="elideMode">
|
||||||
<property name="orientation">
|
<enum>Qt::ElideNone</enum>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<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;
|
||||||
|
}
|
||||||
|
QLineEdit:hover {
|
||||||
|
border: 1px solid #4d8dff;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit:focus {
|
||||||
|
border: 1px solid #6aa2ff;
|
||||||
|
background-color: #23345c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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>
|
||||||
|
<attribute name="title">
|
||||||
|
<string>光谱仪</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="HPPA.qrc">:/HPPA/HPPA.ico</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="1" column="0">
|
||||||
</item>
|
<widget class="QWidget" name="widget_3" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<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="horizontalSpacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -544,10 +482,13 @@ QDockWidget::title {
|
|||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>16777215</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>帧率</string>
|
<string>帧率</string>
|
||||||
</property>
|
</property>
|
||||||
@ -556,31 +497,53 @@ QDockWidget::title {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="framerate_lineEdit">
|
<widget class="QLineEdit" name="framerate_lineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSlider" name="FramerateSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>16777215</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>积分时间</string>
|
<string>积分时间</string>
|
||||||
</property>
|
</property>
|
||||||
@ -589,41 +552,29 @@ QDockWidget::title {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="integratioin_time_lineEdit">
|
<widget class="QLineEdit" name="integratioin_time_lineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_17">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
|
<widget class="QDoubleSlider" name="IntegratioinTimeSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -631,28 +582,29 @@ QDockWidget::title {
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>16777215</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>gain</string>
|
<string>gain</string>
|
||||||
</property>
|
</property>
|
||||||
@ -661,43 +613,25 @@ QDockWidget::title {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="gain_lineEdit">
|
<widget class="QLineEdit" name="gain_lineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_18">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSlider" name="GainSlider">
|
<widget class="QDoubleSlider" name="GainSlider">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -709,7 +643,161 @@ QDockWidget::title {
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<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 "新宋体";
|
||||||
|
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">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -717,7 +805,7 @@ QDockWidget::title {
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>123</height>
|
<height>173</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -725,6 +813,10 @@ QDockWidget::title {
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<action name="action_exit">
|
<action name="action_exit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>退出</string>
|
<string>退出</string>
|
||||||
@ -900,6 +992,9 @@ QDockWidget::title {
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionOneMotorScenario">
|
<action name="mActionOneMotorScenario">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>室内1轴线性平台</string>
|
<string>室内1轴线性平台</string>
|
||||||
</property>
|
</property>
|
||||||
@ -949,7 +1044,10 @@ QDockWidget::title {
|
|||||||
<string>拼接</string>
|
<string>拼接</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_3">
|
<action name="mActionPlantPhenotypeScenario">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>植物表型</string>
|
<string>植物表型</string>
|
||||||
</property>
|
</property>
|
||||||
@ -976,9 +1074,16 @@ QDockWidget::title {
|
|||||||
<header>qdoubleslider.h</header>
|
<header>qdoubleslider.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ImagerPositionSimulation</class>
|
<class>CustomDockWidgetBase</class>
|
||||||
<extends>QGraphicsView</extends>
|
<extends>QDockWidget</extends>
|
||||||
<header location="global">imagerpositionsimulation.h</header>
|
<header>customdockwidgetbase.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CustomDockWidgetHideAbove</class>
|
||||||
|
<extends>QDockWidget</extends>
|
||||||
|
<header>CustomDockWidgetBase.h</header>
|
||||||
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||||
<QtInstall>5.13.2_msvc2017_64</QtInstall>
|
<QtInstall>5.13.2_msvc2017_64</QtInstall>
|
||||||
<QtModules>core;network;gui;widgets;serialport;websockets;charts</QtModules>
|
<QtModules>core;network;gui;widgets;serialport;websockets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;3dquick;charts</QtModules>
|
||||||
<QtBuildConfig>debug</QtBuildConfig>
|
<QtBuildConfig>debug</QtBuildConfig>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||||
@ -107,11 +107,18 @@
|
|||||||
<ClCompile Include="aboutWindow.cpp" />
|
<ClCompile Include="aboutWindow.cpp" />
|
||||||
<ClCompile Include="adjustTable.cpp" />
|
<ClCompile Include="adjustTable.cpp" />
|
||||||
<ClCompile Include="CaptureCoordinator.cpp" />
|
<ClCompile Include="CaptureCoordinator.cpp" />
|
||||||
|
<ClCompile Include="Carousel.cpp" />
|
||||||
<ClCompile Include="Corning410Imager.cpp" />
|
<ClCompile Include="Corning410Imager.cpp" />
|
||||||
|
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
||||||
<ClCompile Include="hppaConfigFile.cpp" />
|
<ClCompile Include="hppaConfigFile.cpp" />
|
||||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||||
<ClCompile Include="imager_base.cpp" />
|
<ClCompile Include="imager_base.cpp" />
|
||||||
<ClCompile Include="irisximeaimager.cpp" />
|
<ClCompile Include="irisximeaimager.cpp" />
|
||||||
|
<ClCompile Include="LayerTree.cpp" />
|
||||||
|
<ClCompile Include="LayerTreeGroupNode.cpp" />
|
||||||
|
<ClCompile Include="LayerTreeLayerNode.cpp" />
|
||||||
|
<ClCompile Include="LayerTreeModel.cpp" />
|
||||||
|
<ClCompile Include="LayerTreeNode.cpp" />
|
||||||
<ClCompile Include="OneMotorControl.cpp" />
|
<ClCompile Include="OneMotorControl.cpp" />
|
||||||
<ClCompile Include="path_tc.cpp" />
|
<ClCompile Include="path_tc.cpp" />
|
||||||
<ClCompile Include="PowerControl.cpp" />
|
<ClCompile Include="PowerControl.cpp" />
|
||||||
@ -125,8 +132,11 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="TabManager.cpp" />
|
||||||
<ClCompile Include="TwoMotorControl.cpp" />
|
<ClCompile Include="TwoMotorControl.cpp" />
|
||||||
<ClCompile Include="utility_tc.cpp" />
|
<ClCompile Include="utility_tc.cpp" />
|
||||||
|
<ClCompile Include="View3D.cpp" />
|
||||||
|
<ClCompile Include="View3DModelManager.cpp" />
|
||||||
<QtRcc Include="HPPA.qrc" />
|
<QtRcc Include="HPPA.qrc" />
|
||||||
<QtUic Include="about.ui" />
|
<QtUic Include="about.ui" />
|
||||||
<QtUic Include="adjustTable.ui" />
|
<QtUic Include="adjustTable.ui" />
|
||||||
@ -161,15 +171,25 @@
|
|||||||
<QtMoc Include="image2display.h" />
|
<QtMoc Include="image2display.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<QtMoc Include="View3DModelManager.h" />
|
||||||
|
<QtMoc Include="View3D.h" />
|
||||||
<QtMoc Include="adjustTable.h" />
|
<QtMoc Include="adjustTable.h" />
|
||||||
<QtMoc Include="PowerControl.h" />
|
<QtMoc Include="PowerControl.h" />
|
||||||
<QtMoc Include="RobotArmControl.h" />
|
<QtMoc Include="RobotArmControl.h" />
|
||||||
<QtMoc Include="Corning410Imager.h" />
|
<QtMoc Include="Corning410Imager.h" />
|
||||||
<QtMoc Include="CaptureCoordinator.h" />
|
<QtMoc Include="CaptureCoordinator.h" />
|
||||||
|
<QtMoc Include="CustomDockWidgetBase.h" />
|
||||||
|
<QtMoc Include="Carousel.h" />
|
||||||
<ClInclude Include="imager_base.h" />
|
<ClInclude Include="imager_base.h" />
|
||||||
<ClInclude Include="irisximeaimager.h" />
|
<ClInclude Include="irisximeaimager.h" />
|
||||||
<QtMoc Include="OneMotorControl.h" />
|
<QtMoc Include="OneMotorControl.h" />
|
||||||
<QtMoc Include="TwoMotorControl.h" />
|
<QtMoc Include="TwoMotorControl.h" />
|
||||||
|
<QtMoc Include="TabManager.h" />
|
||||||
|
<QtMoc Include="LayerTreeModel.h" />
|
||||||
|
<QtMoc Include="LayerTreeNode.h" />
|
||||||
|
<QtMoc Include="LayerTree.h" />
|
||||||
|
<QtMoc Include="LayerTreeGroupNode.h" />
|
||||||
|
<QtMoc Include="LayerTreeLayerNode.h" />
|
||||||
<ClInclude Include="utility_tc.h" />
|
<ClInclude Include="utility_tc.h" />
|
||||||
<QtMoc Include="aboutWindow.h" />
|
<QtMoc Include="aboutWindow.h" />
|
||||||
<ClInclude Include="hppaConfigFile.h" />
|
<ClInclude Include="hppaConfigFile.h" />
|
||||||
|
|||||||
@ -21,15 +21,6 @@
|
|||||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||||
<Extensions>ts</Extensions>
|
<Extensions>ts</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\motor">
|
|
||||||
<UniqueIdentifier>{eadfac5f-f4f9-49e2-9f99-0849bf074cf8}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\motor">
|
|
||||||
<UniqueIdentifier>{4672856c-86fb-46e3-94ff-0a296dcc6111}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files\focus">
|
|
||||||
<UniqueIdentifier>{f2bfb93e-9ef8-4fdd-a776-db93b81af553}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="HPPA.qrc">
|
<QtRcc Include="HPPA.qrc">
|
||||||
@ -133,6 +124,36 @@
|
|||||||
<ClCompile Include="TwoMotorControl.cpp">
|
<ClCompile Include="TwoMotorControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CustomDockWidgetBase.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Carousel.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="View3D.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="TabManager.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="View3DModelManager.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LayerTreeNode.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LayerTreeModel.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LayerTree.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LayerTreeGroupNode.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LayerTreeLayerNode.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -192,6 +213,36 @@
|
|||||||
<QtMoc Include="CaptureCoordinator.h">
|
<QtMoc Include="CaptureCoordinator.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="CustomDockWidgetBase.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="Carousel.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="View3D.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="TabManager.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="View3DModelManager.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="LayerTreeModel.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="LayerTreeNode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="LayerTree.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="LayerTreeGroupNode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="LayerTreeLayerNode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
|
|||||||
73
HPPA/LayerTree.cpp
Normal file
73
HPPA/LayerTree.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#include "LayerTree.h"
|
||||||
|
#include "LayerTreeGroupNode.h"
|
||||||
|
|
||||||
|
LayerTree::LayerTree(QObject* parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
// root <20><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> view <20><><EFBFBD><EFBFBD>ʾ
|
||||||
|
m_root = new LayerTreeGroupNode("__root__", this);
|
||||||
|
m_root->setVisible(Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTree::~LayerTree()
|
||||||
|
{
|
||||||
|
delete m_root;
|
||||||
|
m_root = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTree::root() const
|
||||||
|
{
|
||||||
|
return m_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTree::insertNode(LayerTreeNode* parent, int row, LayerTreeNode* node)
|
||||||
|
{
|
||||||
|
if (!node) return nullptr;
|
||||||
|
if (!parent) parent = m_root;
|
||||||
|
|
||||||
|
if (row < 0) row = parent->childCount();
|
||||||
|
parent->insertChild(row, node);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTree::removeNode(LayerTreeNode* parent, int row)
|
||||||
|
{
|
||||||
|
if (!parent) parent = m_root;
|
||||||
|
return parent->takeChild(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTree::setChildrenVisible(LayerTreeNode* n, Qt::CheckState state)
|
||||||
|
{
|
||||||
|
if (!n) return;
|
||||||
|
const auto& cs = n->children();
|
||||||
|
for (LayerTreeNode* c : cs) {
|
||||||
|
c->setVisible(state);
|
||||||
|
setChildrenVisible(c, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTree::updateParentVisibleFromChildren(LayerTreeNode* p)
|
||||||
|
{
|
||||||
|
if (!p) return;
|
||||||
|
if (p->childCount() == 0) return;
|
||||||
|
|
||||||
|
int checked = 0, unchecked = 0, partial = 0;
|
||||||
|
const auto& cs = p->children();
|
||||||
|
for (LayerTreeNode* c : cs) {
|
||||||
|
auto s = c->visible();
|
||||||
|
if (s == Qt::Checked) checked++;
|
||||||
|
else if (s == Qt::Unchecked) unchecked++;
|
||||||
|
else partial++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::CheckState newState;
|
||||||
|
if (partial > 0) newState = Qt::PartiallyChecked;
|
||||||
|
else if (checked > 0 && unchecked == 0) newState = Qt::Checked;
|
||||||
|
else if (unchecked > 0 && checked == 0) newState = Qt::Unchecked;
|
||||||
|
else newState = Qt::PartiallyChecked;
|
||||||
|
|
||||||
|
if (p->visible() != newState) {
|
||||||
|
p->setVisible(newState);
|
||||||
|
updateParentVisibleFromChildren(p->parentNode());
|
||||||
|
}
|
||||||
|
}
|
||||||
49
HPPA/LayerTree.h
Normal file
49
HPPA/LayerTree.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "LayerTreeNode.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayerTree<65><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
* - <20><><EFBFBD><EFBFBD> root
|
||||||
|
* - <20>ṩ<EFBFBD><E1B9A9><EFBFBD><EFBFBD>/<2F>Ƴ<EFBFBD><C6B3>ڵ<EFBFBD><DAB5><EFBFBD> API
|
||||||
|
* - <20>ṩ<EFBFBD>ɼ<EFBFBD><C9BC>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>븸<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>µľ<C2B5>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
||||||
|
*
|
||||||
|
* ע<>⣺beginInsertRows/endInsertRows <20><> Qt Model <20><><EFBFBD><EFBFBD>֪ͨӦ<D6AA><D3A6> Model <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
||||||
|
* LayerTree ֻ<><D6BB><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9>ȷ<EFBFBD>ԡ<EFBFBD>
|
||||||
|
*/
|
||||||
|
class LayerTree : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LayerTree(QObject* parent = nullptr);
|
||||||
|
~LayerTree() override;
|
||||||
|
|
||||||
|
LayerTree(const LayerTree&) = delete;
|
||||||
|
LayerTree& operator=(const LayerTree&) = delete;
|
||||||
|
|
||||||
|
LayerTreeNode* root() const;
|
||||||
|
|
||||||
|
// <20><><EFBFBD>룺parent Ϊ nullptr <20><>ʾ root<6F><74>row=-1 <20><>ʾ append
|
||||||
|
LayerTreeNode* insertNode(LayerTreeNode* parent, int row, LayerTreeNode* node);
|
||||||
|
|
||||||
|
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD> delete<74><65><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>Ƴ<EFBFBD><C6B3>ڵ㣨<DAB5><E3A3A8><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD> delete <20><><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2>룩
|
||||||
|
LayerTreeNode* removeNode(LayerTreeNode* parent, int row);
|
||||||
|
|
||||||
|
// <20>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> Model <20><><EFBFBD>ã<EFBFBD>
|
||||||
|
static void setChildrenVisible(LayerTreeNode* n, Qt::CheckState state);
|
||||||
|
static void updateParentVisibleFromChildren(LayerTreeNode* parent);
|
||||||
|
|
||||||
|
static inline bool isLayer(LayerTreeNode* node)
|
||||||
|
{
|
||||||
|
return node && node->type() == LayerTreeNode::Type::Layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool isGroup(LayerTreeNode* node)
|
||||||
|
{
|
||||||
|
return node && node->type() == LayerTreeNode::Type::Group;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
LayerTreeNode* m_root = nullptr; // owned
|
||||||
|
};
|
||||||
6
HPPA/LayerTreeGroupNode.cpp
Normal file
6
HPPA/LayerTreeGroupNode.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "LayerTreeGroupNode.h"
|
||||||
|
|
||||||
|
LayerTreeGroupNode::LayerTreeGroupNode(const QString& name, QObject* parent)
|
||||||
|
: LayerTreeNode(name, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
15
HPPA/LayerTreeGroupNode.h
Normal file
15
HPPA/LayerTreeGroupNode.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "LayerTreeNode.h"
|
||||||
|
|
||||||
|
/** Group <20>ڵ<EFBFBD> */
|
||||||
|
class LayerTreeGroupNode : public LayerTreeNode
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LayerTreeGroupNode(const QString& name,
|
||||||
|
QObject* parent = nullptr);
|
||||||
|
|
||||||
|
Type type() const override { return Type::Group; }
|
||||||
|
|
||||||
|
// <20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>collapsed / groupOpacity <20><>
|
||||||
|
};
|
||||||
6
HPPA/LayerTreeLayerNode.cpp
Normal file
6
HPPA/LayerTreeLayerNode.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "LayerTreeLayerNode.h"
|
||||||
|
|
||||||
|
LayerTreeLayerNode::LayerTreeLayerNode(const QString& name, QObject* parent)
|
||||||
|
: LayerTreeNode(name, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
15
HPPA/LayerTreeLayerNode.h
Normal file
15
HPPA/LayerTreeLayerNode.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "LayerTreeNode.h"
|
||||||
|
|
||||||
|
/** Layer <20>ڵ<EFBFBD> */
|
||||||
|
class LayerTreeLayerNode : public LayerTreeNode
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LayerTreeLayerNode(const QString& name,
|
||||||
|
QObject* parent = nullptr);
|
||||||
|
|
||||||
|
Type type() const override { return Type::Layer; }
|
||||||
|
|
||||||
|
// <20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>layerId / pointer / legendItems <20><>
|
||||||
|
};
|
||||||
168
HPPA/LayerTreeModel.cpp
Normal file
168
HPPA/LayerTreeModel.cpp
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
#include "LayerTreeModel.h"
|
||||||
|
#include "LayerTreeGroupNode.h"
|
||||||
|
#include "LayerTreeLayerNode.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
LayerTreeModel::LayerTreeModel(LayerTree* tree, QObject* parent, bool cascadeCheck)
|
||||||
|
: QAbstractItemModel(parent),
|
||||||
|
m_tree(tree),
|
||||||
|
m_cascadeCheck(cascadeCheck)
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_tree && "LayerTreeModel requires a valid LayerTree*");
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex LayerTreeModel::index(int row, int column, const QModelIndex& parent) const
|
||||||
|
{
|
||||||
|
if (column != 0 || row < 0) return {};
|
||||||
|
|
||||||
|
LayerTreeNode* parentNode = nodeFromIndex(parent);
|
||||||
|
if (!parentNode) return {};
|
||||||
|
|
||||||
|
LayerTreeNode* child = parentNode->childAt(row);
|
||||||
|
if (!child) return {};
|
||||||
|
|
||||||
|
return createIndex(row, column, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex LayerTreeModel::parent(const QModelIndex& child) const
|
||||||
|
{
|
||||||
|
LayerTreeNode* node = nodeFromIndex(child);
|
||||||
|
if (!node || node == m_tree->root()) return {};
|
||||||
|
|
||||||
|
LayerTreeNode* p = node->parentNode();
|
||||||
|
if (!p || p == m_tree->root()) return {};
|
||||||
|
|
||||||
|
return createIndex(p->rowInParent(), 0, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LayerTreeModel::rowCount(const QModelIndex& parent) const
|
||||||
|
{
|
||||||
|
LayerTreeNode* p = nodeFromIndex(parent);
|
||||||
|
return p ? p->childCount() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LayerTreeModel::columnCount(const QModelIndex&) const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant LayerTreeModel::data(const QModelIndex& index, int role) const
|
||||||
|
{
|
||||||
|
LayerTreeNode* n = nodeFromIndex(index);
|
||||||
|
if (!n || n == m_tree->root()) return {};
|
||||||
|
|
||||||
|
switch (role) {
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
return n->name();
|
||||||
|
|
||||||
|
case Qt::DecorationRole:
|
||||||
|
{
|
||||||
|
auto* tmp = nodeFromIndex(index);
|
||||||
|
if (LayerTree::isGroup(tmp))
|
||||||
|
return QIcon();
|
||||||
|
else if (LayerTree::isLayer(tmp))
|
||||||
|
{
|
||||||
|
QString basePath = QCoreApplication::applicationDirPath();
|
||||||
|
return QIcon(basePath + "/icons/mIconRaster.svg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case Qt::CheckStateRole:
|
||||||
|
return static_cast<int>(n->visible());
|
||||||
|
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
return (n->type() == LayerTreeNode::Type::Group) ? "Group" : "Layer";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
||||||
|
{
|
||||||
|
LayerTreeNode* n = nodeFromIndex(index);
|
||||||
|
if (!n || n == m_tree->root()) return false;
|
||||||
|
|
||||||
|
if (role == Qt::CheckStateRole) {
|
||||||
|
auto newState = static_cast<Qt::CheckState>(value.toInt());
|
||||||
|
if (n->visible() == newState) return true;
|
||||||
|
|
||||||
|
n->setVisible(newState);
|
||||||
|
|
||||||
|
// 1) <20><> -> <20><> <20><><EFBFBD><EFBFBD>
|
||||||
|
if (m_cascadeCheck) {
|
||||||
|
LayerTree::setChildrenVisible(n, newState);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) <20><> -> <20><> <20><><EFBFBD><EFBFBD> PartiallyChecked
|
||||||
|
LayerTree::updateParentVisibleFromChildren(n->parentNode());
|
||||||
|
|
||||||
|
// <20><EFBFBD><F2BBAFA3><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻Ϊ<E6BBBB><CEAA> dataChanged<65><64>
|
||||||
|
emit layoutChanged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::ItemFlags LayerTreeModel::flags(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if (!index.isValid()) return Qt::NoItemFlags;
|
||||||
|
|
||||||
|
LayerTreeNode* n = nodeFromIndex(index);
|
||||||
|
if (!n || n == m_tree->root()) return Qt::NoItemFlags;
|
||||||
|
|
||||||
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeModel::root() const
|
||||||
|
{
|
||||||
|
return m_tree->root();
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeModel::addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon)
|
||||||
|
{
|
||||||
|
if (!parent) parent = m_tree->root();
|
||||||
|
|
||||||
|
const int row = parent->childCount();
|
||||||
|
beginInsertRows(indexFromNode(parent), row, row);
|
||||||
|
LayerTreeNode* g = m_tree->insertNode(parent, row, new LayerTreeGroupNode(name));
|
||||||
|
endInsertRows();
|
||||||
|
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeModel::addLayer(LayerTreeNode* parent, const QString& name, const QIcon& icon)
|
||||||
|
{
|
||||||
|
if (!parent) parent = m_tree->root();
|
||||||
|
|
||||||
|
const int row = parent->childCount();
|
||||||
|
beginInsertRows(indexFromNode(parent), row, row);
|
||||||
|
LayerTreeNode* l = m_tree->insertNode(parent, row, new LayerTreeLayerNode(name));
|
||||||
|
endInsertRows();
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeModel::setCascadeCheckEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
m_cascadeCheck = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerTreeModel::cascadeCheckEnabled() const
|
||||||
|
{
|
||||||
|
return m_cascadeCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeModel::nodeFromIndex(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if (!index.isValid()) return m_tree->root();
|
||||||
|
return static_cast<LayerTreeNode*>(index.internalPointer());
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex LayerTreeModel::indexFromNode(LayerTreeNode* n) const
|
||||||
|
{
|
||||||
|
if (!n || n == m_tree->root()) return {};
|
||||||
|
return createIndex(n->rowInParent(), 0, n);
|
||||||
|
}
|
||||||
47
HPPA/LayerTreeModel.h
Normal file
47
HPPA/LayerTreeModel.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
#include "LayerTree.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayerTreeModel<65><6C>Qt <20><><EFBFBD><EFBFBD><EFBFBD>㣨<EFBFBD><E3A3A8><EFBFBD>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
* - 1 <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͼ<EFBFBD>꣩+ checkbox
|
||||||
|
* - <20><>ѡ<EFBFBD>ɼ<EFBFBD><C9BC>ԣ<EFBFBD><D4A3><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||||
|
*/
|
||||||
|
class LayerTreeModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LayerTreeModel(LayerTree* tree,
|
||||||
|
QObject* parent = nullptr,
|
||||||
|
bool cascadeCheck = true);
|
||||||
|
~LayerTreeModel() override = default;
|
||||||
|
|
||||||
|
// QAbstractItemModel <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
||||||
|
QModelIndex index(int row, int column,
|
||||||
|
const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
QModelIndex parent(const QModelIndex& child) const override;
|
||||||
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex& index, int role) const override;
|
||||||
|
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
||||||
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD> API<50><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD> begin/endInsertRows<77><73>
|
||||||
|
LayerTreeNode* root() const;
|
||||||
|
|
||||||
|
LayerTreeNode* addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
|
||||||
|
LayerTreeNode* addLayer(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
|
||||||
|
|
||||||
|
void setCascadeCheckEnabled(bool enabled);
|
||||||
|
bool cascadeCheckEnabled() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LayerTree* m_tree = nullptr; // not owned
|
||||||
|
bool m_cascadeCheck = true;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LayerTreeNode* nodeFromIndex(const QModelIndex& index) const;
|
||||||
|
QModelIndex indexFromNode(LayerTreeNode* n) const;
|
||||||
|
};
|
||||||
110
HPPA/LayerTreeNode.cpp
Normal file
110
HPPA/LayerTreeNode.cpp
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#include "LayerTreeNode.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
LayerTreeNode::LayerTreeNode(const QString& name, QObject* parent)
|
||||||
|
: QObject(parent), m_name(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode::~LayerTreeNode()
|
||||||
|
{
|
||||||
|
qDeleteAll(m_children);
|
||||||
|
m_children.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LayerTreeNode::name() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::setName(const QString& name)
|
||||||
|
{
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon LayerTreeNode::icon() const
|
||||||
|
{
|
||||||
|
return m_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::setIcon(const QIcon& icon)
|
||||||
|
{
|
||||||
|
m_icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::CheckState LayerTreeNode::visible() const
|
||||||
|
{
|
||||||
|
return m_visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::setVisible(Qt::CheckState s)
|
||||||
|
{
|
||||||
|
m_visible = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeNode::parentNode() const
|
||||||
|
{
|
||||||
|
return m_parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::setParentNode(LayerTreeNode* p)
|
||||||
|
{
|
||||||
|
m_parentNode = p;
|
||||||
|
// <20><> QObject <20><> parent Ҳ<><D2B2><EFBFBD>棨<EFBFBD><E6A3A8><EFBFBD><EFBFBD> Qt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι<EFBFBD><CEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> delete children<65><6E>
|
||||||
|
if (p) this->setParent(p);
|
||||||
|
else this->setParent(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LayerTreeNode::rowInParent() const
|
||||||
|
{
|
||||||
|
if (!m_parentNode) return 0;
|
||||||
|
|
||||||
|
const auto& siblings = m_parentNode->m_children;
|
||||||
|
for (int i = 0; i < siblings.size(); ++i)
|
||||||
|
{
|
||||||
|
if (siblings[i] == this) return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LayerTreeNode::childCount() const
|
||||||
|
{
|
||||||
|
return m_children.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeNode::childAt(int row) const
|
||||||
|
{
|
||||||
|
if (row < 0 || row >= m_children.size()) return nullptr;
|
||||||
|
return m_children[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<LayerTreeNode*>& LayerTreeNode::children() const
|
||||||
|
{
|
||||||
|
return m_children;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::appendChild(LayerTreeNode* child)
|
||||||
|
{
|
||||||
|
insertChild(m_children.size(), child);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerTreeNode::insertChild(int row, LayerTreeNode* child)
|
||||||
|
{
|
||||||
|
if (!child) return;
|
||||||
|
|
||||||
|
if (row < 0 || row > m_children.size())
|
||||||
|
row = m_children.size();
|
||||||
|
|
||||||
|
child->setParentNode(this);
|
||||||
|
m_children.insert(row, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* LayerTreeNode::takeChild(int row)
|
||||||
|
{
|
||||||
|
if (row < 0 || row >= m_children.size()) return nullptr;
|
||||||
|
LayerTreeNode* taken = m_children.takeAt(row);
|
||||||
|
if (taken) taken->setParentNode(nullptr);
|
||||||
|
return taken;
|
||||||
|
}
|
||||||
65
HPPA/LayerTreeNode.h
Normal file
65
HPPA/LayerTreeNode.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayerTreeNode<64><65><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
* - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>/ͼ<><CDBC>/<2F>ɼ<EFBFBD><C9BC><EFBFBD>/<2F><><EFBFBD>ӹ<EFBFBD>ϵ
|
||||||
|
* - Group / Layer <20>ڵ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>̳<EFBFBD>ʵ<EFBFBD><CAB5>
|
||||||
|
*
|
||||||
|
* ˵<><CBB5><EFBFBD><EFBFBD>
|
||||||
|
* - <20><><EFBFBD><EFBFBD>ͬʱά<CAB1><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>롱<EFBFBD><EBA1B1>m_parentNode<64><65><EFBFBD><EFBFBD> QObject parent<6E><74><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||||
|
* - children <20>ɽڵ<C9BD><DAB5>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷţ<CDB7><C5A3><EFBFBD><EFBFBD><EFBFBD>ʱ delete children<65><6E>
|
||||||
|
*/
|
||||||
|
class LayerTreeNode : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
enum class Type { Group, Layer };
|
||||||
|
|
||||||
|
explicit LayerTreeNode(const QString& name,
|
||||||
|
QObject* parent = nullptr);
|
||||||
|
~LayerTreeNode() override;
|
||||||
|
|
||||||
|
LayerTreeNode(const LayerTreeNode&) = delete;
|
||||||
|
LayerTreeNode& operator=(const LayerTreeNode&) = delete;
|
||||||
|
|
||||||
|
virtual Type type() const = 0;
|
||||||
|
|
||||||
|
// ---- properties ----
|
||||||
|
QString name() const;
|
||||||
|
void setName(const QString& name);
|
||||||
|
|
||||||
|
QIcon icon() const;
|
||||||
|
void setIcon(const QIcon& icon);
|
||||||
|
|
||||||
|
Qt::CheckState visible() const;
|
||||||
|
void setVisible(Qt::CheckState s);
|
||||||
|
|
||||||
|
// ---- tree relations ----
|
||||||
|
LayerTreeNode* parentNode() const;
|
||||||
|
int rowInParent() const;
|
||||||
|
|
||||||
|
int childCount() const;
|
||||||
|
LayerTreeNode* childAt(int row) const;
|
||||||
|
const QVector<LayerTreeNode*>& children() const;
|
||||||
|
|
||||||
|
// ---- structure mutation (used by LayerTree / Model) ----
|
||||||
|
void appendChild(LayerTreeNode* child);
|
||||||
|
void insertChild(int row, LayerTreeNode* child);
|
||||||
|
LayerTreeNode* takeChild(int row); // remove but not delete
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setParentNode(LayerTreeNode* p);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_name;
|
||||||
|
QIcon m_icon;
|
||||||
|
Qt::CheckState m_visible = Qt::Checked;
|
||||||
|
|
||||||
|
LayerTreeNode* m_parentNode = nullptr;
|
||||||
|
QVector<LayerTreeNode*> m_children;
|
||||||
|
};
|
||||||
@ -64,6 +64,8 @@ void OneMotorControl::display_x_loc(std::vector<double> loc)
|
|||||||
{
|
{
|
||||||
double tmp = round(loc[0] * 100) / 100;
|
double tmp = round(loc[0] * 100) / 100;
|
||||||
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||||
|
|
||||||
|
emit broadcastLocationSignal(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
||||||
|
|||||||
@ -55,6 +55,8 @@ signals:
|
|||||||
|
|
||||||
void sequenceComplete();
|
void sequenceComplete();
|
||||||
|
|
||||||
|
void broadcastLocationSignal(std::vector<double>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OneMotorControl_UI ui;
|
Ui::OneMotorControl_UI ui;
|
||||||
|
|
||||||
|
|||||||
@ -6,19 +6,103 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>294</width>
|
<width>432</width>
|
||||||
<height>119</height>
|
<height>346</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>PowerControl</string>
|
<string>PowerControl</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QGroupBox
|
||||||
|
{
|
||||||
|
border: 12px solid transparent;
|
||||||
|
color: #ACCDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
/*width: 172px;
|
||||||
|
height: 56px;*/
|
||||||
|
font: 19pt "新宋体";
|
||||||
|
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_3" rowstretch="1,1,1,1" 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>145</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>151</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>卤素灯</string>
|
||||||
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -26,94 +110,142 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="horizontalSpacing">
|
||||||
<number>0</number>
|
<number>20</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_17">
|
|
||||||
<property name="text">
|
|
||||||
<string>卤素灯</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="lamp_power_open_btn">
|
<widget class="QPushButton" name="lamp_power_open_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开</string>
|
<string>打开</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="lamp_power_close_btn">
|
<widget class="QPushButton" name="lamp_power_close_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关闭</string>
|
<string>关闭</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<spacer name="horizontalSpacer_19">
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>151</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_18">
|
|
||||||
<property name="text">
|
|
||||||
<string>马 达</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="motor_power_open_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>打开</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="motor_power_close_btn">
|
|
||||||
<property name="text">
|
|
||||||
<string>关闭</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_20">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>151</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>马 达</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="motor_power_open_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="motor_power_close_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>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>151</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>42</height>
|
<height>144</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|||||||
62
HPPA/TabManager.cpp
Normal file
62
HPPA/TabManager.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include "TabManager.h"
|
||||||
|
|
||||||
|
TabManager::TabManager(QTabWidget* tabWidget, QObject* parent)
|
||||||
|
: QObject(parent),
|
||||||
|
m_tabWidget(tabWidget)
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_tabWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManager::hideTab(QWidget* page)
|
||||||
|
{
|
||||||
|
if (!page || !m_tabWidget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int index = m_tabWidget->indexOf(page);
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_hiddenTabs.contains(page))
|
||||||
|
return;
|
||||||
|
|
||||||
|
TabInfo info;
|
||||||
|
info.index = index;
|
||||||
|
info.text = m_tabWidget->tabText(index);
|
||||||
|
info.icon = m_tabWidget->tabIcon(index);
|
||||||
|
info.toolTip = m_tabWidget->tabToolTip(index);
|
||||||
|
|
||||||
|
m_hiddenTabs.insert(page, info);
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ǵ<EFBFBD>ǰҳ<C7B0><D2B3><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>
|
||||||
|
if (m_tabWidget->currentIndex() == index)
|
||||||
|
{
|
||||||
|
int next = (index > 0) ? index - 1 : 0;
|
||||||
|
m_tabWidget->setCurrentIndex(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tabWidget->removeTab(index);
|
||||||
|
emit tabHidden(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabManager::showTab(QWidget* page)
|
||||||
|
{
|
||||||
|
if (!page || !m_tabWidget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_hiddenTabs.contains(page))
|
||||||
|
return;
|
||||||
|
|
||||||
|
TabInfo info = m_hiddenTabs.take(page);
|
||||||
|
|
||||||
|
//int insertIndex = qMin(info.index, m_tabWidget->count());
|
||||||
|
int insertIndex = m_tabWidget->count();
|
||||||
|
m_tabWidget->insertTab(insertIndex, page, info.icon, info.text);
|
||||||
|
m_tabWidget->setTabToolTip(insertIndex, info.toolTip);
|
||||||
|
|
||||||
|
emit tabShown(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TabManager::isHidden(QWidget* page) const
|
||||||
|
{
|
||||||
|
return m_hiddenTabs.contains(page);
|
||||||
|
}
|
||||||
32
HPPA/TabManager.h
Normal file
32
HPPA/TabManager.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
class TabManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TabManager(QTabWidget* tabWidget, QObject* parent = nullptr);
|
||||||
|
|
||||||
|
void hideTab(QWidget* page);
|
||||||
|
void showTab(QWidget* page);
|
||||||
|
bool isHidden(QWidget* page) const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void tabHidden(QWidget* page);
|
||||||
|
void tabShown(QWidget* page);
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct TabInfo
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
QString text;
|
||||||
|
QIcon icon;
|
||||||
|
QString toolTip;
|
||||||
|
};
|
||||||
|
|
||||||
|
QTabWidget* m_tabWidget = nullptr;
|
||||||
|
QHash<QWidget*, TabInfo> m_hiddenTabs;
|
||||||
|
};
|
||||||
@ -5,7 +5,6 @@ TwoMotorControl::TwoMotorControl(QWidget* parent) : QDialog(parent)
|
|||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
|
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
|
||||||
ui.recordLine_tableWidget->setStyleSheet("selection-background-color:rgb(255,209,128)");//设置选择的行高亮
|
|
||||||
|
|
||||||
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选择行为,以行为单位
|
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选择行为,以行为单位
|
||||||
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//设置选择模式,选择单行
|
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//设置选择模式,选择单行
|
||||||
@ -16,13 +15,9 @@ TwoMotorControl::TwoMotorControl(QWidget* parent) : QDialog(parent)
|
|||||||
|
|
||||||
connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn()));
|
connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn()));
|
||||||
connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn()));
|
connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn()));
|
||||||
connect(ui.generateRecordLine_btn, SIGNAL(clicked()), this, SLOT(onGenerateRecordLine_btn()));
|
|
||||||
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
|
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
|
||||||
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
|
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
|
||||||
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
|
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
|
||||||
|
|
||||||
connect(ui.run_btn, SIGNAL(clicked()), this, SLOT(run()));
|
|
||||||
connect(ui.stop_btn, SIGNAL(clicked()), this, SLOT(stop()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::setImager(ImagerOperationBase* imager)
|
void TwoMotorControl::setImager(ImagerOperationBase* imager)
|
||||||
@ -320,6 +315,8 @@ void TwoMotorControl::displayRealTimeLoc(std::vector<double> loc)
|
|||||||
|
|
||||||
tmp = round(loc[1] * 100) / 100;
|
tmp = round(loc[1] * 100) / 100;
|
||||||
this->ui.ymotor_realTimeLoc_lineEdit->setText(QString::number(tmp));
|
this->ui.ymotor_realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||||
|
|
||||||
|
emit broadcastLocationSignal(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::zeroStart()
|
void TwoMotorControl::zeroStart()
|
||||||
@ -393,93 +390,6 @@ void TwoMotorControl::onRemoveRecordLine_btn()
|
|||||||
ui.recordLine_tableWidget->removeRow(rowIndex);
|
ui.recordLine_tableWidget->removeRow(rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwoMotorControl::onGenerateRecordLine_btn()
|
|
||||||
{
|
|
||||||
//求幅宽
|
|
||||||
double height = ui.height_lineEdit->text().toDouble();
|
|
||||||
double fov = ui.fov_lineEdit->text().toDouble();
|
|
||||||
double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tan输入是弧度
|
|
||||||
ui.swath_lineEdit->setText(QString::number(swath));
|
|
||||||
|
|
||||||
|
|
||||||
//读取马达测量范围
|
|
||||||
double xMotorRange = 50;
|
|
||||||
double yMotorRange = 500;
|
|
||||||
|
|
||||||
|
|
||||||
//确定有多少条采集线,公式:numberOfRecordLine_tmp * swath - repetitiveLength(numberOfRecordLine_tmp - 1) = overallLength
|
|
||||||
double overallLength = yMotorRange + swath;
|
|
||||||
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble() / 100;
|
|
||||||
double repetitiveLength = repetitiveRate * swath;
|
|
||||||
double offset = ui.offset_lineEdit->text().toDouble();
|
|
||||||
|
|
||||||
double numberOfRecordLine_tmp = (overallLength - repetitiveLength - offset) / (swath - repetitiveLength);
|
|
||||||
double tmp = numberOfRecordLine_tmp - (int)numberOfRecordLine_tmp;
|
|
||||||
int numberOfRecordLine;
|
|
||||||
double threshold = ui.LastLineThreshold_lineEdit->text().toDouble();//当numberOfRecordLine_tmp为小数时,判断是否多加一条采集线
|
|
||||||
if (tmp > threshold)
|
|
||||||
{
|
|
||||||
numberOfRecordLine = (int)numberOfRecordLine_tmp + 1;
|
|
||||||
//std::cout << "大于:" << threshold << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
numberOfRecordLine = (int)numberOfRecordLine_tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//去掉tableWidget中所有的行
|
|
||||||
int rowCount = ui.recordLine_tableWidget->rowCount();
|
|
||||||
for (size_t i = 0; i < rowCount; i++)
|
|
||||||
{
|
|
||||||
ui.recordLine_tableWidget->removeRow(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//向tableWidget添加行(采集线)
|
|
||||||
QTableWidgetItem* tmpItem;
|
|
||||||
for (size_t i = 0; i < numberOfRecordLine; i++)
|
|
||||||
{
|
|
||||||
//增加一行
|
|
||||||
int RowCount = ui.recordLine_tableWidget->rowCount();
|
|
||||||
ui.recordLine_tableWidget->insertRow(RowCount);
|
|
||||||
|
|
||||||
//设置yPosition
|
|
||||||
if (tmp > threshold && i == numberOfRecordLine - 1)//设置最后一行的yPosition
|
|
||||||
{
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double x = swath * i - i * repetitiveLength + offset;
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(x, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
|
||||||
}
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 1, tmpItem);
|
|
||||||
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(0, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 2, tmpItem);
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 3, tmpItem);
|
|
||||||
|
|
||||||
//设置x马达最大运动位置 → 值设置为x马达量程
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 4, tmpItem);
|
|
||||||
tmpItem = new QTableWidgetItem(QString::number(1, 10, 2));
|
|
||||||
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
||||||
ui.recordLine_tableWidget->setItem(i, 5, tmpItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TwoMotorControl::onDeleteRecordLine_btn()
|
void TwoMotorControl::onDeleteRecordLine_btn()
|
||||||
{
|
{
|
||||||
int rowCount = ui.recordLine_tableWidget->rowCount();
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
@ -498,19 +408,12 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double height = ui.height_lineEdit->text().toDouble();
|
|
||||||
double fov = ui.fov_lineEdit->text().toDouble();
|
|
||||||
double swath = ui.swath_lineEdit->text().toDouble();
|
|
||||||
double offset = ui.offset_lineEdit->text().toDouble();
|
|
||||||
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble();
|
|
||||||
double LastLineThreshold = ui.LastLineThreshold_lineEdit->text().toDouble();
|
|
||||||
|
|
||||||
FileOperation* fileOperation = new FileOperation();
|
FileOperation* fileOperation = new FileOperation();
|
||||||
string directory = fileOperation->getDirectoryOfExe();
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine2 File"),
|
QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine3 File"),
|
||||||
QString::fromStdString(directory),
|
QString::fromStdString(directory),
|
||||||
tr("RecordLineFile2 (*.RecordLine2)"));
|
tr("RecordLineFile3 (*.RecordLine3)"));
|
||||||
|
|
||||||
if (RecordLineFilePath.isEmpty())
|
if (RecordLineFilePath.isEmpty())
|
||||||
{
|
{
|
||||||
@ -519,13 +422,6 @@ void TwoMotorControl::onSaveRecordLine2File_btn()
|
|||||||
|
|
||||||
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+");
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+");
|
||||||
|
|
||||||
fwrite(&height, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fwrite(&fov, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fwrite(&swath, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fwrite(&offset, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fwrite(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fwrite(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
|
|
||||||
double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount();
|
double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount();
|
||||||
fwrite(&number, sizeof(double), 1, RecordLineFileHandle);
|
fwrite(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
@ -553,9 +449,9 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
FileOperation* fileOperation = new FileOperation();
|
FileOperation* fileOperation = new FileOperation();
|
||||||
string directory = fileOperation->getDirectoryOfExe();
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine2 File"),
|
QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine3 File"),
|
||||||
QString::fromStdString(directory),
|
QString::fromStdString(directory),
|
||||||
tr("RecordLineFile (*.RecordLine2)"));
|
tr("RecordLineFile (*.RecordLine3)"));
|
||||||
|
|
||||||
if (RecordLineFilePath.isEmpty())
|
if (RecordLineFilePath.isEmpty())
|
||||||
{
|
{
|
||||||
@ -563,15 +459,9 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb");
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb");
|
||||||
double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number;
|
double number;
|
||||||
|
|
||||||
//读取数据
|
//读取数据
|
||||||
fread(&height, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&fov, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&swath, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&offset, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
|
||||||
fread(&number, sizeof(double), 1, RecordLineFileHandle);
|
fread(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
double* data = new double[number];
|
double* data = new double[number];
|
||||||
@ -581,15 +471,6 @@ void TwoMotorControl::onReadRecordLineFile_btn()
|
|||||||
//std::cout << *(data + i) << std::endl;
|
//std::cout << *(data + i) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//向界面中填写
|
|
||||||
ui.height_lineEdit->setText(QString::number(height));
|
|
||||||
ui.fov_lineEdit->setText(QString::number(fov));
|
|
||||||
ui.swath_lineEdit->setText(QString::number(swath));
|
|
||||||
ui.offset_lineEdit->setText(QString::number(offset));
|
|
||||||
ui.repetitiveRate_lineEdit->setText(QString::number(repetitiveRate));
|
|
||||||
ui.LastLineThreshold_lineEdit->setText(QString::number(LastLineThreshold));
|
|
||||||
|
|
||||||
|
|
||||||
//向tableWidget添加采集线
|
//向tableWidget添加采集线
|
||||||
//(1)去掉tableWidget中所有的行
|
//(1)去掉tableWidget中所有的行
|
||||||
int rowCount = ui.recordLine_tableWidget->rowCount();
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
|||||||
@ -57,7 +57,6 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void onAddRecordLine_btn();
|
void onAddRecordLine_btn();
|
||||||
void onRemoveRecordLine_btn();
|
void onRemoveRecordLine_btn();
|
||||||
void onGenerateRecordLine_btn();
|
|
||||||
void onDeleteRecordLine_btn();
|
void onDeleteRecordLine_btn();
|
||||||
void onSaveRecordLine2File_btn();
|
void onSaveRecordLine2File_btn();
|
||||||
void onReadRecordLineFile_btn();
|
void onReadRecordLineFile_btn();
|
||||||
@ -84,6 +83,8 @@ signals:
|
|||||||
void startLineNumSignal(int lineNum);
|
void startLineNumSignal(int lineNum);
|
||||||
void sequenceComplete();//所有采集线正常运行完成
|
void sequenceComplete();//所有采集线正常运行完成
|
||||||
|
|
||||||
|
void broadcastLocationSignal(std::vector<double>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::twoMotorControl_UI ui;
|
Ui::twoMotorControl_UI ui;
|
||||||
QThread m_coordinatorThread;
|
QThread m_coordinatorThread;
|
||||||
|
|||||||
375
HPPA/View3D.cpp
Normal file
375
HPPA/View3D.cpp
Normal file
@ -0,0 +1,375 @@
|
|||||||
|
#include "View3D.h"
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
#include <Qt3DExtras/QForwardRenderer>
|
||||||
|
#include <QtMath>
|
||||||
|
#include <Qt3DRender/QAttribute>
|
||||||
|
#include <QGeometryRenderer>
|
||||||
|
|
||||||
|
View3DBase::View3DBase(const QString& baseModelPath,
|
||||||
|
const QString& armModelPath,
|
||||||
|
QWidget* parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
m_container(nullptr),
|
||||||
|
m_baseModelPath(baseModelPath),
|
||||||
|
m_armModelPath(armModelPath)
|
||||||
|
{
|
||||||
|
m_view = new Qt3DExtras::Qt3DWindow();
|
||||||
|
// 部分 Qt5.9 构建可能需要强转 frame graph,但 defaultFrameGraph() 通常可用
|
||||||
|
QColor c1("#0D1233");
|
||||||
|
m_view->defaultFrameGraph()->setClearColor(c1);
|
||||||
|
|
||||||
|
m_rootEntity = new Qt3DCore::QEntity();
|
||||||
|
|
||||||
|
initScene();
|
||||||
|
initCamera();
|
||||||
|
|
||||||
|
// 自动旋转臂(如果不需要可注释掉 timer/connect)
|
||||||
|
//connect(&m_timer, &QTimer::timeout, this, [=]() {
|
||||||
|
// m_angle += 1.0f;
|
||||||
|
// m_t += 1.0f;
|
||||||
|
// if (m_angle >= 360.0f) m_angle = 0.0f;
|
||||||
|
// if (m_armTransform)
|
||||||
|
// {
|
||||||
|
// //m_armTransform->setRotationX(m_angle);
|
||||||
|
// //m_armTransform->setTranslation(QVector3D(m_t, 0, 0));
|
||||||
|
//
|
||||||
|
// Qt3DCore::QTransform transform;
|
||||||
|
// transform.setTranslation(QVector3D(2, 0, 0));
|
||||||
|
|
||||||
|
// QMatrix4x4 M = m_armTransform->matrix();
|
||||||
|
// M = transform.matrix() * M; // 左乘:在世界坐标系叠加
|
||||||
|
// m_armTransform->setMatrix(M);
|
||||||
|
|
||||||
|
// qDebug() << m_armTransform->matrix();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::setViewCenter(float x, float y, float z)
|
||||||
|
{
|
||||||
|
m_viewCenter.setX(x);
|
||||||
|
m_viewCenter.setY(y);
|
||||||
|
m_viewCenter.setZ(z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::setDistance(float distance)
|
||||||
|
{
|
||||||
|
m_distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::initScene()
|
||||||
|
{
|
||||||
|
/*auto* lightEntity = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
|
||||||
|
auto* light = new Qt3DRender::QPointLight(lightEntity);
|
||||||
|
light->setColor(Qt::white);
|
||||||
|
light->setIntensity(1.2f);
|
||||||
|
|
||||||
|
auto* lightTransform = new Qt3DCore::QTransform(lightEntity);
|
||||||
|
lightTransform->setTranslation(QVector3D(500, 500, 500));
|
||||||
|
|
||||||
|
lightEntity->addComponent(light);
|
||||||
|
lightEntity->addComponent(lightTransform);*/
|
||||||
|
|
||||||
|
// ===== 创建 base 根节点 =====
|
||||||
|
auto* baseModel = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
auto* baseLoader = new Qt3DRender::QSceneLoader(baseModel);
|
||||||
|
baseLoader->setSource(QUrl::fromLocalFile(m_baseModelPath));
|
||||||
|
|
||||||
|
//connect(baseLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
||||||
|
// this, &View3DBase::onSceneLoaderStatusChanged);
|
||||||
|
|
||||||
|
|
||||||
|
m_baseTransform = new Qt3DCore::QTransform();
|
||||||
|
m_baseTransform->setTranslation(QVector3D(0, 0, 0));
|
||||||
|
baseModel->addComponent(baseLoader);
|
||||||
|
baseModel->addComponent(m_baseTransform);
|
||||||
|
|
||||||
|
connect(baseLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
||||||
|
this, [=](Qt3DRender::QSceneLoader::Status status) {
|
||||||
|
|
||||||
|
if (status == Qt3DRender::QSceneLoader::Ready) {
|
||||||
|
applyWhiteMaterialRecursive(baseModel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// ===== 创建 arm 根节点 =====
|
||||||
|
auto* armModel = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
auto* armLoader = new Qt3DRender::QSceneLoader(armModel);
|
||||||
|
armLoader->setSource(QUrl::fromLocalFile(m_armModelPath));
|
||||||
|
|
||||||
|
m_armTransform = new Qt3DCore::QTransform();
|
||||||
|
m_armTransform->setTranslation(QVector3D(0, 0, 0));
|
||||||
|
armModel->addComponent(armLoader);
|
||||||
|
armModel->addComponent(m_armTransform);
|
||||||
|
|
||||||
|
connect(armLoader, &Qt3DRender::QSceneLoader::statusChanged,
|
||||||
|
this, [=](Qt3DRender::QSceneLoader::Status status) {
|
||||||
|
|
||||||
|
if (status == Qt3DRender::QSceneLoader::Ready) {
|
||||||
|
applyWhiteMaterialRecursive(armModel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 坐标轴依然挂在 root,不会被移动
|
||||||
|
//createAxes();
|
||||||
|
|
||||||
|
m_view->setRootEntity(m_rootEntity);
|
||||||
|
|
||||||
|
qDebug() << m_baseTransform->matrix();
|
||||||
|
qDebug() << m_armTransform->matrix();
|
||||||
|
|
||||||
|
//m_armTransform->setTranslation(QVector3D(2000, 0, 0));
|
||||||
|
//m_baseTransform->setTranslation(QVector3D(-1000, -1000, -1000));
|
||||||
|
|
||||||
|
qDebug() << m_baseTransform->matrix();
|
||||||
|
qDebug() << m_armTransform->matrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::applyWhiteMaterialRecursive(Qt3DCore::QEntity* entity)
|
||||||
|
{
|
||||||
|
// 如果这个 entity 有 mesh,就给它加白色材质
|
||||||
|
auto meshes = entity->componentsOfType<Qt3DRender::QGeometryRenderer>();
|
||||||
|
if (!meshes.isEmpty()) {
|
||||||
|
auto* mat = new Qt3DExtras::QPhongMaterial(entity);
|
||||||
|
QColor c1("#cccccc");
|
||||||
|
mat->setDiffuse(c1);
|
||||||
|
mat->setAmbient(c1);
|
||||||
|
mat->setSpecular(c1);
|
||||||
|
mat->setShininess(50.0f);
|
||||||
|
entity->addComponent(mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归处理子节点
|
||||||
|
const auto children = entity->children();
|
||||||
|
for (QObject* obj : children) {
|
||||||
|
auto* childEntity = qobject_cast<Qt3DCore::QEntity*>(obj);
|
||||||
|
if (childEntity)
|
||||||
|
applyWhiteMaterialRecursive(childEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::createAxes()
|
||||||
|
{
|
||||||
|
// 参数
|
||||||
|
float axisLength = 500.0f;
|
||||||
|
float axisRadius = 50.0f;
|
||||||
|
|
||||||
|
// ----- X axis (red) -----
|
||||||
|
Qt3DCore::QEntity* xAxis = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
auto* xMesh = new Qt3DExtras::QCylinderMesh();
|
||||||
|
xMesh->setRadius(axisRadius);
|
||||||
|
xMesh->setLength(axisLength);
|
||||||
|
xMesh->setRings(16);
|
||||||
|
xMesh->setSlices(16);
|
||||||
|
|
||||||
|
auto* xTrans = new Qt3DCore::QTransform();
|
||||||
|
// cylinder 默认沿 Y 轴,绕 Z 轴 90 度让其沿 X
|
||||||
|
xTrans->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0, 0, 1), 90.0f));
|
||||||
|
xTrans->setTranslation(QVector3D(axisLength / 2.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
|
auto* xMat = new Qt3DExtras::QPhongMaterial();
|
||||||
|
xMat->setDiffuse(QColor(Qt::red));
|
||||||
|
|
||||||
|
xAxis->addComponent(xMesh);
|
||||||
|
xAxis->addComponent(xTrans);
|
||||||
|
xAxis->addComponent(xMat);
|
||||||
|
|
||||||
|
// ----- Y axis (green) -----
|
||||||
|
Qt3DCore::QEntity* yAxis = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
auto* yMesh = new Qt3DExtras::QCylinderMesh();
|
||||||
|
yMesh->setRadius(axisRadius);
|
||||||
|
yMesh->setLength(axisLength*2);
|
||||||
|
yMesh->setRings(16);
|
||||||
|
yMesh->setSlices(16);
|
||||||
|
|
||||||
|
auto* yTrans = new Qt3DCore::QTransform();
|
||||||
|
// Y 轴无需旋转(cylinder 默认沿 Y)
|
||||||
|
yTrans->setTranslation(QVector3D(0.0f, axisLength / 2.0f, 0.0f));
|
||||||
|
|
||||||
|
auto* yMat = new Qt3DExtras::QPhongMaterial();
|
||||||
|
yMat->setDiffuse(QColor(Qt::green));
|
||||||
|
|
||||||
|
yAxis->addComponent(yMesh);
|
||||||
|
yAxis->addComponent(yTrans);
|
||||||
|
yAxis->addComponent(yMat);
|
||||||
|
|
||||||
|
// ----- Z axis (blue) -----
|
||||||
|
Qt3DCore::QEntity* zAxis = new Qt3DCore::QEntity(m_rootEntity);
|
||||||
|
auto* zMesh = new Qt3DExtras::QCylinderMesh();
|
||||||
|
zMesh->setRadius(axisRadius);
|
||||||
|
zMesh->setLength(axisLength*3);
|
||||||
|
zMesh->setRings(16);
|
||||||
|
zMesh->setSlices(16);
|
||||||
|
|
||||||
|
auto* zTrans = new Qt3DCore::QTransform();
|
||||||
|
// 让 cylinder 沿 Z:绕 X 轴 90 度
|
||||||
|
zTrans->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 90.0f));
|
||||||
|
zTrans->setTranslation(QVector3D(0.0f, 0.0f, axisLength / 2.0f));
|
||||||
|
|
||||||
|
auto* zMat = new Qt3DExtras::QPhongMaterial();
|
||||||
|
zMat->setDiffuse(QColor(Qt::blue));
|
||||||
|
|
||||||
|
zAxis->addComponent(zMesh);
|
||||||
|
zAxis->addComponent(zTrans);
|
||||||
|
zAxis->addComponent(zMat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::initCamera()
|
||||||
|
{
|
||||||
|
m_camera = m_view->camera();
|
||||||
|
// 16:10 假设窗口比例,后续 resize 时相机透视会保持
|
||||||
|
m_camera->lens()->setPerspectiveProjection(50.0f, 16.0f / 10.0f, 0.1f, 10000.0f);
|
||||||
|
updateCameraPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::updateCameraPosition()
|
||||||
|
{
|
||||||
|
float yaw = qDegreesToRadians(m_yawDeg);
|
||||||
|
float pitch = qDegreesToRadians(m_pitchDeg);
|
||||||
|
|
||||||
|
float x = m_distance * qCos(pitch) * qSin(yaw);
|
||||||
|
float y = m_distance * qSin(pitch);
|
||||||
|
float z = m_distance * qCos(pitch) * qCos(yaw);
|
||||||
|
|
||||||
|
QVector3D camPos = m_viewCenter + QVector3D(x, y, z);
|
||||||
|
m_camera->setPosition(camPos);
|
||||||
|
m_camera->setViewCenter(m_viewCenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DBase::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
QWidget::showEvent(event);
|
||||||
|
|
||||||
|
if (!m_container) {
|
||||||
|
m_container = QWidget::createWindowContainer(m_view, this);
|
||||||
|
m_view->installEventFilter(this);
|
||||||
|
|
||||||
|
auto* layout = new QHBoxLayout(this);
|
||||||
|
layout->addWidget(m_container);
|
||||||
|
layout->setMargin(0);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
// 启动自动旋转 timer(如果你不需要可以注释)
|
||||||
|
m_timer.start(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool View3DBase::eventFilter(QObject* obj, QEvent* event)
|
||||||
|
{
|
||||||
|
if (obj == m_view)
|
||||||
|
{
|
||||||
|
// 鼠标按下
|
||||||
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
auto* e = static_cast<QMouseEvent*>(event);
|
||||||
|
if (e->button() == Qt::LeftButton) {
|
||||||
|
m_mouseDragging = true;
|
||||||
|
m_lastMousePos = e->pos();
|
||||||
|
}
|
||||||
|
else if (e->button() == Qt::MiddleButton) {
|
||||||
|
m_middleDragging = true;
|
||||||
|
m_lastMousePos = e->pos();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 鼠标释放
|
||||||
|
else if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
|
auto* e = static_cast<QMouseEvent*>(event);
|
||||||
|
if (e->button() == Qt::LeftButton) {
|
||||||
|
m_mouseDragging = false;
|
||||||
|
}
|
||||||
|
else if (e->button() == Qt::MiddleButton) {
|
||||||
|
m_middleDragging = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 鼠标移动
|
||||||
|
else if (event->type() == QEvent::MouseMove) {
|
||||||
|
auto* e = static_cast<QMouseEvent*>(event);
|
||||||
|
QPoint pos = e->pos();
|
||||||
|
QPoint delta = pos - m_lastMousePos;
|
||||||
|
|
||||||
|
// 左键:orbit(旋转)
|
||||||
|
if (m_mouseDragging) {
|
||||||
|
float sensitivity = 0.3f;
|
||||||
|
m_yawDeg -= delta.x() * sensitivity;
|
||||||
|
m_pitchDeg += delta.y() * sensitivity;
|
||||||
|
|
||||||
|
if (m_pitchDeg > 89.0f) m_pitchDeg = 89.0f;
|
||||||
|
if (m_pitchDeg < -89.0f) m_pitchDeg = -89.0f;
|
||||||
|
|
||||||
|
updateCameraPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 中键:pan(平移 viewCenter)
|
||||||
|
if (m_middleDragging) {
|
||||||
|
float speed = 2.0f;
|
||||||
|
|
||||||
|
// 根据摄像机方向计算平移方向
|
||||||
|
QVector3D camPos = m_camera->position();
|
||||||
|
QVector3D forward = (m_viewCenter - camPos).normalized();
|
||||||
|
QVector3D up(0, 1, 0);
|
||||||
|
QVector3D right = QVector3D::crossProduct(forward, up).normalized();
|
||||||
|
|
||||||
|
// 世界坐标变化量
|
||||||
|
QVector3D deltaMove =
|
||||||
|
-right * (delta.x() * speed) +
|
||||||
|
up * (delta.y() * speed);
|
||||||
|
|
||||||
|
// 将平移应用到两个模型根 Transform
|
||||||
|
if (m_baseRootTransform)
|
||||||
|
m_baseRootTransform->setTranslation(
|
||||||
|
m_baseRootTransform->translation() + deltaMove*-1);
|
||||||
|
|
||||||
|
if (m_armRootTransform)
|
||||||
|
m_armRootTransform->setTranslation(
|
||||||
|
m_armRootTransform->translation() + deltaMove*-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_lastMousePos = pos;
|
||||||
|
}
|
||||||
|
// 滚轮缩放
|
||||||
|
else if (event->type() == QEvent::Wheel) {
|
||||||
|
auto* e = static_cast<QWheelEvent*>(event);
|
||||||
|
// Qt5: angleDelta 返回像素值(通常为 120 per notch)
|
||||||
|
int delta = e->angleDelta().y();
|
||||||
|
if (delta == 0) delta = e->delta(); // 备选
|
||||||
|
m_distance -= delta * 2.0f; // 缩放速度
|
||||||
|
if (m_distance < 2.0f) m_distance = 2.0f;
|
||||||
|
if (m_distance > 10000.0f) m_distance = 10000.0f;
|
||||||
|
updateCameraPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 让 Qt 继续处理(保持原行为)
|
||||||
|
return QWidget::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
View3DPlantPhenotype::View3DPlantPhenotype(const QString& baseModelPath, const QString& armModelPath, QWidget* parent)
|
||||||
|
:View3DBase(baseModelPath, armModelPath, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DPlantPhenotype::setLoc(std::vector<double> loc)
|
||||||
|
{
|
||||||
|
double x = round(loc[0] * 100) / 100;
|
||||||
|
double y = round(loc[1] * 100) / 100;
|
||||||
|
|
||||||
|
m_armTransform->setTranslation(QVector3D(x, y, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
View3DLinearStage::View3DLinearStage(const QString& baseModelPath, const QString& armModelPath, QWidget* parent)
|
||||||
|
:View3DBase(baseModelPath, armModelPath, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DLinearStage::setLoc(std::vector<double> loc)
|
||||||
|
{
|
||||||
|
double x = round(loc[0] * 100) / 100;
|
||||||
|
|
||||||
|
m_armTransform->setTranslation(QVector3D(x, 0, 0));
|
||||||
|
}
|
||||||
112
HPPA/View3D.h
Normal file
112
HPPA/View3D.h
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
#ifndef VIEW3D_H
|
||||||
|
#define VIEW3D_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QString>
|
||||||
|
#include <QQuaternion>
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
#include <Qt3DCore/QEntity>
|
||||||
|
#include <Qt3DCore/QTransform>
|
||||||
|
#include <Qt3DExtras/Qt3DWindow>
|
||||||
|
#include <Qt3DRender/QCamera>
|
||||||
|
#include <Qt3DExtras/QOrbitCameraController>
|
||||||
|
#include <Qt3DExtras/QPhongMaterial>
|
||||||
|
#include <Qt3DRender/QSceneLoader>
|
||||||
|
#include <Qt3DExtras/QCylinderMesh>
|
||||||
|
#include <QPointLight>
|
||||||
|
|
||||||
|
class View3DBase : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit View3DBase(const QString& baseModelPath,
|
||||||
|
const QString& armModelPath,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
void setViewCenter(float x, float y, float z);
|
||||||
|
void setDistance(float distance);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
|
|
||||||
|
void initScene();
|
||||||
|
void initCamera();
|
||||||
|
void updateCameraPosition();
|
||||||
|
void createAxes();
|
||||||
|
|
||||||
|
QString m_baseModelPath;
|
||||||
|
QString m_armModelPath;
|
||||||
|
|
||||||
|
Qt3DExtras::Qt3DWindow* m_view;
|
||||||
|
QWidget* m_container;
|
||||||
|
Qt3DCore::QEntity* m_rootEntity;
|
||||||
|
|
||||||
|
Qt3DCore::QEntity* m_baseEntity;
|
||||||
|
Qt3DCore::QEntity* m_armEntity;
|
||||||
|
Qt3DCore::QTransform* m_armTransform;
|
||||||
|
Qt3DCore::QTransform* m_baseTransform;
|
||||||
|
|
||||||
|
QTimer m_timer;
|
||||||
|
float m_angle = 0; // arm auto rotation
|
||||||
|
float m_t = 0;
|
||||||
|
|
||||||
|
// ----- Camera control -----
|
||||||
|
Qt3DRender::QCamera* m_camera = nullptr;
|
||||||
|
float m_distance = 5000.0f;
|
||||||
|
float m_yawDeg = 0.0f;
|
||||||
|
float m_pitchDeg = 0.0f;
|
||||||
|
QVector3D m_viewCenter = QVector3D(1000, 1000, -1000);
|
||||||
|
|
||||||
|
// Mouse state
|
||||||
|
bool m_mouseDragging = false; // left button: orbit
|
||||||
|
bool m_middleDragging = false; // middle button: pan
|
||||||
|
QPoint m_lastMousePos;
|
||||||
|
|
||||||
|
Qt3DCore::QTransform* m_baseRootTransform = nullptr;
|
||||||
|
Qt3DCore::QTransform* m_armRootTransform = nullptr;
|
||||||
|
|
||||||
|
void applyWhiteMaterialRecursive(Qt3DCore::QEntity* entity);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
virtual void setLoc(std::vector<double> loc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class View3DPlantPhenotype : public View3DBase
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
View3DPlantPhenotype(const QString& baseModelPath,
|
||||||
|
const QString& armModelPath,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setLoc(std::vector<double> loc);
|
||||||
|
};
|
||||||
|
|
||||||
|
class View3DLinearStage : public View3DBase
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
View3DLinearStage(const QString& baseModelPath,
|
||||||
|
const QString& armModelPath,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setLoc(std::vector<double> loc);
|
||||||
|
};
|
||||||
|
#endif // VIEW3D_H
|
||||||
68
HPPA/View3DModelManager.cpp
Normal file
68
HPPA/View3DModelManager.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "View3DModelManager.h"
|
||||||
|
|
||||||
|
View3DModelManager::View3DModelManager(QWidget* parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
m_stackedWidget = new QStackedWidget();
|
||||||
|
m_stackedWidget->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
layout->addWidget(m_stackedWidget);
|
||||||
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DModelManager::switchScenario(ScenarioType type)
|
||||||
|
{
|
||||||
|
if (type == ScenarioType::PlantPhenotype) {
|
||||||
|
ensurePlantPhenotypeView();
|
||||||
|
m_stackedWidget->setCurrentWidget(m_viewPlant);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ensureOneMotorView();
|
||||||
|
m_stackedWidget->setCurrentWidget(m_viewMotor);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit scenarioChanged(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DModelManager::ensurePlantPhenotypeView()
|
||||||
|
{
|
||||||
|
if (m_viewPlant)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString basePath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
|
m_viewPlant = new View3DPlantPhenotype(
|
||||||
|
basePath + "/3DModel/HPPA_frame.obj",
|
||||||
|
basePath + "/3DModel/HPPA_camera.obj",
|
||||||
|
m_stackedWidget
|
||||||
|
);
|
||||||
|
|
||||||
|
m_viewPlant->setViewCenter(1000, 1000, -1000);
|
||||||
|
m_viewPlant->setDistance(5000);
|
||||||
|
|
||||||
|
m_stackedWidget->addWidget(m_viewPlant);
|
||||||
|
|
||||||
|
emit created3DModelPlantPhenotype();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View3DModelManager::ensureOneMotorView()
|
||||||
|
{
|
||||||
|
if (m_viewMotor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString basePath = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
|
m_viewMotor = new View3DLinearStage(
|
||||||
|
basePath + "/3DModel/linear_stage_indoor1.obj",
|
||||||
|
basePath + "/3DModel/linear_stage_indoor2.obj",
|
||||||
|
m_stackedWidget
|
||||||
|
);
|
||||||
|
|
||||||
|
m_viewMotor->setViewCenter(500, 100, 500);
|
||||||
|
m_viewMotor->setDistance(1000);
|
||||||
|
|
||||||
|
m_stackedWidget->addWidget(m_viewMotor);
|
||||||
|
|
||||||
|
emit created3DModelOneMotor();
|
||||||
|
}
|
||||||
40
HPPA/View3DModelManager.h
Normal file
40
HPPA/View3DModelManager.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
|
#include "View3D.h"
|
||||||
|
|
||||||
|
class View3DPlantPhenotype;
|
||||||
|
class View3DLinearStage;
|
||||||
|
|
||||||
|
class View3DModelManager : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
enum class ScenarioType {
|
||||||
|
PlantPhenotype,
|
||||||
|
OneMotor
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit View3DModelManager(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void switchScenario(ScenarioType type);
|
||||||
|
|
||||||
|
View3DPlantPhenotype* m_viewPlant = nullptr;
|
||||||
|
View3DLinearStage* m_viewMotor = nullptr;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void scenarioChanged(ScenarioType type);
|
||||||
|
void created3DModelPlantPhenotype();
|
||||||
|
void created3DModelOneMotor();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ensurePlantPhenotypeView();
|
||||||
|
void ensureOneMotorView();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStackedWidget* m_stackedWidget = nullptr;
|
||||||
|
};
|
||||||
@ -6,24 +6,127 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>687</width>
|
<width>501</width>
|
||||||
<height>389</height>
|
<height>363</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>adjustTable</string>
|
<string>adjustTable</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<property name="styleSheet">
|
||||||
<item row="0" column="0">
|
<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 "新宋体";
|
||||||
|
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_4" rowstretch="1,2,2,2,1" columnstretch="1,10,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>66</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>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox_8">
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>252号升降台</string>
|
<string>252号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_10">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="objective_table252_up_btn">
|
<widget class="QPushButton" name="objective_table252_up_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -33,58 +136,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table252_down_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>下降</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table252_stop_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>停止</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox_7">
|
<widget class="QPushButton" name="objective_table252_down_btn">
|
||||||
<property name="title">
|
|
||||||
<string>253号升降台</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_11">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table1_up_btn">
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
<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="objective_table1_down_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -94,58 +149,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table1_stop_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>停止</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
<widget class="QPushButton" name="objective_table252_stop_btn">
|
||||||
<property name="title">
|
|
||||||
<string>254号升降台</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_9">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table2_up_btn">
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
<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="objective_table2_down_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>下降</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QPushButton" name="objective_table2_stop_btn">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -158,6 +165,222 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>253号升降台</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table1_up_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="objective_table1_down_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="2">
|
||||||
|
<widget class="QPushButton" name="objective_table1_stop_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>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>254号升降台</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table2_up_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="objective_table2_down_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="2">
|
||||||
|
<widget class="QPushButton" name="objective_table2_stop_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>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>65</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|||||||
@ -6,20 +6,120 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>544</width>
|
<width>678</width>
|
||||||
<height>346</height>
|
<height>480</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>一轴马达控制</string>
|
<string>一轴马达控制</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton
|
||||||
|
{
|
||||||
|
/*width: 172px;
|
||||||
|
height: 56px;
|
||||||
|
font: 19pt "新宋体";*/
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0.5, y1:0, x2:0.5, y2:1,
|
||||||
|
stop:0 #283D86,
|
||||||
|
stop:1 #0F1A40
|
||||||
|
);
|
||||||
|
color: white;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
QLabel
|
||||||
|
{
|
||||||
|
color: #ACCDFF;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
QLineEdit:hover {
|
||||||
|
border: 1px solid #4d8dff;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit:focus {
|
||||||
|
border: 1px solid #6aa2ff;
|
||||||
|
background-color: #23345c;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,3,1" 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>87</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>127</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>实时位置</string>
|
<string>实时位置</string>
|
||||||
</property>
|
</property>
|
||||||
@ -28,42 +128,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>运行速度</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>返回速度</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="realTimeLoc_lineEdit">
|
<widget class="QLineEdit" name="realTimeLoc_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0</string>
|
<string>0</string>
|
||||||
</property>
|
</property>
|
||||||
@ -72,86 +150,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="2">
|
||||||
<widget class="QLineEdit" name="speed_lineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>0.1</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="return_speed_lineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="move2loc_lineEdit">
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="connect_btn">
|
<widget class="QPushButton" name="connect_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -161,10 +163,57 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</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="speed_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.1</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
<widget class="QPushButton" name="zero_start_btn">
|
<widget class="QPushButton" name="zero_start_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -174,10 +223,48 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>返回速度</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="return_speed_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QPushButton" name="rangeMeasurement_btn">
|
<widget class="QPushButton" name="rangeMeasurement_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -187,36 +274,45 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="move2loc_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
<widget class="QPushButton" name="move2loc_pushButton">
|
<widget class="QPushButton" name="move2loc_pushButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>移动至</string>
|
<string>移动至</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="4" column="1">
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>161</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="left_btn">
|
<widget class="QPushButton" name="left_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -226,10 +322,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="4" column="2">
|
||||||
<widget class="QPushButton" name="right_btn">
|
<widget class="QPushButton" name="right_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -239,41 +335,64 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>状态</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="motor_state_label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>8</width>
|
||||||
|
<height>8</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>8</width>
|
||||||
|
<height>8</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: red;
|
||||||
|
border-radius: 4px;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
</layout>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
</item>
|
||||||
<item>
|
<item row="1" column="2">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>127</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="motor_state_label">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="text">
|
|
||||||
<string>马达状态</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>191</height>
|
<height>87</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user