增加轮播控件,并将rgb相机界面移入轮播控件中;
This commit is contained in:
238
HPPA/Carousel.cpp
Normal file
238
HPPA/Carousel.cpp
Normal file
@ -0,0 +1,238 @@
|
||||
#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(1000),
|
||||
m_intervalButtonSize(40)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(m_stackedWidget);
|
||||
|
||||
m_autoPlayerTimer = new QTimer(this);
|
||||
connect(m_autoPlayerTimer, &QTimer::timeout,
|
||||
this, &MyCarousel::slideRight);
|
||||
|
||||
m_nomalQSS= R"(
|
||||
QPushButton {
|
||||
background-color: white;
|
||||
border-radius: 5px;
|
||||
border: 1px solid white;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: blue;
|
||||
border-radius: 5px;
|
||||
border: 1px solid blue;
|
||||
}
|
||||
)";
|
||||
|
||||
m_lockedQSS = R"(
|
||||
QPushButton {
|
||||
background-color: red;
|
||||
border-radius: 5px;
|
||||
border: 1px solid red;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
)";
|
||||
}
|
||||
|
||||
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();
|
||||
};
|
||||
@ -161,7 +161,7 @@ void CustomDockWidgetHideAbove::toggleMaximize()
|
||||
for (QDockWidget* dock : docks)
|
||||
{
|
||||
m_originalSizes[dock] = dock->size();
|
||||
if (dock->objectName().contains("mDockWidgetRGBCamera") && dock->isVisible())
|
||||
if (dock->objectName().contains("mDockCarousel") && dock->isVisible())
|
||||
{
|
||||
dock->hide();
|
||||
m_hiddenDocks.append(dock);
|
||||
|
||||
121
HPPA/HPPA.cpp
121
HPPA/HPPA.cpp
@ -77,21 +77,6 @@ HPPA::HPPA(QWidget* parent)
|
||||
m_RecordState = 0;
|
||||
connect(this->ui.action_connect_imager, SIGNAL(triggered()), this, SLOT(onconnect()));//<2F>ź<EFBFBD><C5BA><EFBFBD><EFBFBD>ۣ<EFBFBD><DBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD>۰<DBB0><F3B6A8B7>ں<EFBFBD><DABA><EFBFBD>onconnect<63><74>
|
||||
|
||||
//rgb<67><62><EFBFBD><EFBFBD>
|
||||
m_RgbCameraThread = new QThread();
|
||||
m_RgbCamera = new RgbCameraOperation();
|
||||
m_RgbCamera->moveToThread(m_RgbCameraThread);
|
||||
m_RgbCameraThread->start();
|
||||
connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera()));//ʹ<><CAB9><EFBFBD>ź<EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>Ƶ <20><> <20>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD>濨<EFBFBD><E6BFA8>
|
||||
connect(m_RgbCamera, SIGNAL(PlotSignal()), this, SLOT(onPlotRgbImage()));
|
||||
|
||||
//m_RgbCamera->setCallback(onPlotRgbImage);
|
||||
//connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera_callback()));//ʹ<>ûص<C3BB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3><CCA3>ϵ<EFBFBD><CFB5><EFBFBD>Ƶ <20><> ʧ<><CAA7>
|
||||
|
||||
connect(this->ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʷ<EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>slider<65><72><EFBFBD>źźͲ<C5BA><CDB2><EFBFBD><EFBFBD><EFBFBD>connectǰ<74><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>setMinimum<75><6D><EFBFBD>ı<EFBFBD>slider<65><72>ֵ
|
||||
ui.FramerateSlider->setMinimum(1);
|
||||
ui.FramerateSlider->setMaximum(250);
|
||||
@ -122,9 +107,6 @@ HPPA::HPPA(QWidget* parent)
|
||||
connect(this->ui.mActionOneMotorScenario, SIGNAL(triggered()), this, SLOT(createOneMotorScenario()));
|
||||
|
||||
delete ui.centralWidget;
|
||||
ui.mDockWidgetRGBCamera->close();
|
||||
ui.mDockWidgetSimulator->close();
|
||||
ui.mDockWidgetSpectrometer->close();
|
||||
|
||||
QString qss_DockWidget_contentWidget = R"(
|
||||
background: #0D1233;
|
||||
@ -139,7 +121,7 @@ HPPA::HPPA(QWidget* parent)
|
||||
border-bottom-right-radius: 10px;
|
||||
)";
|
||||
|
||||
ui.mDockWidgetRGBCamera->setTile(QString::fromLocal8Bit("<EFBFBD>ֲ<EFBFBD>"));
|
||||
|
||||
ui.mDockWidgetSimulator->setTile(QString::fromLocal8Bit("3Dģ<EFBFBD><EFBFBD>"));
|
||||
ui.mDockWidgetSpectrometer->setTile(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
@ -178,11 +160,7 @@ HPPA::HPPA(QWidget* parent)
|
||||
//dock_layers->setMaximumWidth(450);
|
||||
//dock_layers->setMinimumHeight(497);
|
||||
//dock_layers->setMaximumHeight(498);
|
||||
|
||||
//ui.mDockWidgetRGBCamera->setMinimumWidth(449);
|
||||
//ui.mDockWidgetRGBCamera->setMaximumWidth(450);
|
||||
//ui.mDockWidgetRGBCamera->setMinimumHeight(497);
|
||||
//ui.mDockWidgetRGBCamera->setMaximumHeight(498);
|
||||
|
||||
|
||||
//<2F>߹<EFBFBD><DFB9>ײ鿴
|
||||
QDockWidget* dock_hyperimgViewer = new CustomDockWidgetBase(QString::fromLocal8Bit("hyimgViewer"), this);
|
||||
@ -307,18 +285,66 @@ HPPA::HPPA(QWidget* parent)
|
||||
QWidget* tmp6 = new QWidget();
|
||||
dock_hyperimgViewer->setTitleBarWidget(tmp6);
|
||||
|
||||
//<2F>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_dock_carousel = new CustomDockWidgetBase(QString::fromLocal8Bit("<EFBFBD>ֲ<EFBFBD>"), this);
|
||||
m_dock_carousel->setObjectName("mDockCarousel");
|
||||
m_dock_carousel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
mPanelMenu->addAction(m_dock_carousel->toggleViewAction());
|
||||
//addDockWidget(Qt::LeftDockWidgetArea, m_dock_carousel);
|
||||
|
||||
m_carousel = new MyCarousel();
|
||||
m_carousel->setObjectName(QString::fromUtf8("carousel"));
|
||||
|
||||
QScrollArea* sa = new QScrollArea();
|
||||
sa->setStyleSheet(R"(
|
||||
border: none;
|
||||
)");
|
||||
QGridLayout* gridLayout_sa = new QGridLayout(sa);
|
||||
gridLayout_sa->setSpacing(6);
|
||||
gridLayout_sa->setObjectName(QString::fromUtf8("gridLayout_sa"));
|
||||
gridLayout_sa->setVerticalSpacing(0);
|
||||
gridLayout_sa->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_cam_label = new QLabel();
|
||||
gridLayout_sa->addWidget(m_cam_label);
|
||||
|
||||
m_carousel->addWidget(sa);
|
||||
m_carousel->addWidget(new QLabel("1"));
|
||||
m_carousel->addWidget(new QLabel("2"));
|
||||
m_carousel->addWidget(new QLabel("3"));
|
||||
//m_carousel->addWidget(new QLabel("4"));
|
||||
//m_carousel->addWidget(new QLabel("5"));
|
||||
//m_carousel->addWidget(new QLabel("6"));
|
||||
//m_carousel->addWidget(new QLabel("7"));
|
||||
//m_carousel->addWidget(new QLabel("8"));
|
||||
//m_carousel->addWidget(new QLabel("9"));
|
||||
//m_carousel->addWidget(new QLabel("10"));
|
||||
//m_carousel->addWidget(new QLabel("11"));
|
||||
//m_carousel->addWidget(new QLabel("12"));
|
||||
//m_carousel->addWidget(new QLabel("13"));
|
||||
//m_carousel->addWidget(new QLabel("14"));
|
||||
//m_carousel->addWidget(new QLabel("15"));
|
||||
//m_carousel->addWidget(new QLabel("16"));
|
||||
m_carousel->play();
|
||||
|
||||
m_dock_carousel->setWidget(m_carousel);
|
||||
|
||||
initControlTabwidget();
|
||||
|
||||
|
||||
splitDockWidget(dock_layers, dock_hyperimgViewer, Qt::Horizontal);
|
||||
splitDockWidget(dock_hyperimgViewer, ui.mDockWidgetRGBCamera, Qt::Horizontal);
|
||||
ui.mDockWidgetRGBCamera->show();
|
||||
splitDockWidget(dock_hyperimgViewer, m_dock_carousel, Qt::Horizontal);
|
||||
|
||||
//m_dock_carousel->show();
|
||||
//ui.mDockWidgetRGBCamera->setMinimumWidth(449);
|
||||
//ui.mDockWidgetRGBCamera->setMaximumWidth(450);
|
||||
//ui.mDockWidgetRGBCamera->setMinimumHeight(497);
|
||||
//ui.mDockWidgetRGBCamera->setMaximumHeight(498);
|
||||
|
||||
splitDockWidget(dock_layers, ui.mDockWidgetSimulator, Qt::Vertical);
|
||||
ui.mDockWidgetSimulator->show();
|
||||
|
||||
splitDockWidget(ui.mDockWidgetRGBCamera, ui.mDockWidgetSpectrometer, Qt::Vertical);
|
||||
splitDockWidget(m_dock_carousel, ui.mDockWidgetSpectrometer, Qt::Vertical);
|
||||
ui.mDockWidgetSpectrometer->show();
|
||||
|
||||
setStyleSheet(R"(
|
||||
@ -492,6 +518,36 @@ void HPPA::initControlTabwidget()
|
||||
{
|
||||
ui.controlTabWidget->removeTab(1);
|
||||
|
||||
QWidget* videoWidget = new QWidget();
|
||||
QVBoxLayout* vBoxLayout_videoWidget = new QVBoxLayout(videoWidget);
|
||||
|
||||
vBoxLayout_videoWidget->setSpacing(6);
|
||||
vBoxLayout_videoWidget->setObjectName(QString::fromUtf8("vBoxLayout_videoWidget"));
|
||||
vBoxLayout_videoWidget->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_open_rgb_camera_btn = new QPushButton(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
m_open_rgb_camera_btn->setObjectName(QString::fromUtf8("m_open_rgb_camera_btn"));
|
||||
m_close_rgb_camera_btn = new QPushButton(QString::fromLocal8Bit("<EFBFBD>ر<EFBFBD>"));
|
||||
m_close_rgb_camera_btn->setObjectName(QString::fromUtf8("m_close_rgb_camera_btn"));
|
||||
vBoxLayout_videoWidget->addWidget(m_open_rgb_camera_btn);
|
||||
vBoxLayout_videoWidget->addWidget(m_close_rgb_camera_btn);
|
||||
|
||||
//rgb<67><62><EFBFBD><EFBFBD>
|
||||
m_RgbCameraThread = new QThread();
|
||||
m_RgbCamera = new RgbCameraOperation();
|
||||
m_RgbCamera->moveToThread(m_RgbCameraThread);
|
||||
m_RgbCameraThread->start();
|
||||
connect(m_open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera()));//ʹ<><CAB9><EFBFBD>ź<EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>Ƶ <20><> <20>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD>濨<EFBFBD><E6BFA8>
|
||||
connect(m_RgbCamera, SIGNAL(PlotSignal()), this, SLOT(onPlotRgbImage()));
|
||||
|
||||
//m_RgbCamera->setCallback(onPlotRgbImage);
|
||||
//connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera_callback()));//ʹ<>ûص<C3BB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>̣߳<DFB3>ui<75>̣߳<DFB3><CCA3>ϵ<EFBFBD><CFB5><EFBFBD>Ƶ <20><> ʧ<><CAA7>
|
||||
|
||||
connect(m_close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
|
||||
|
||||
ui.controlTabWidget->addTab(videoWidget, QString::fromLocal8Bit("rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dock
|
||||
adjustTable* adt = new adjustTable();
|
||||
adt->setWindowFlags(Qt::Widget);
|
||||
@ -660,7 +716,6 @@ void HPPA::initPanelToolbar()
|
||||
|
||||
mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction());
|
||||
|
||||
mPanelMenu->addAction(ui.mDockWidgetRGBCamera->toggleViewAction());
|
||||
mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction());
|
||||
|
||||
mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction());
|
||||
@ -1106,12 +1161,12 @@ void HPPA::onPlotRgbImage()
|
||||
//std::cout << "<22><>ʾ<EFBFBD><CABE>Ƶ+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
||||
QPixmap pixmap = QPixmap::fromImage(m_RgbCamera->m_qImage);
|
||||
|
||||
int width = ui.cam_label->width();
|
||||
int height = ui.cam_label->height();
|
||||
int width = m_cam_label->width();
|
||||
int height = m_cam_label->height();
|
||||
QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
ui.cam_label->setPixmap(fitpixmap);
|
||||
m_cam_label->setPixmap(fitpixmap);
|
||||
}
|
||||
|
||||
void HPPA::onCloseRgbCamera()
|
||||
@ -1122,8 +1177,8 @@ void HPPA::onCloseRgbCamera()
|
||||
|
||||
void HPPA::onClearLabel()
|
||||
{
|
||||
ui.cam_label->clear();
|
||||
ui.cam_label->setText("closed");
|
||||
m_cam_label->clear();
|
||||
m_cam_label->setText("closed");
|
||||
}
|
||||
|
||||
void HPPA::onCopyFinished()
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "Corning410Imager.h"
|
||||
|
||||
#include "CustomDockWidgetBase.h"
|
||||
#include "Carousel.h"
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
@ -225,6 +226,13 @@ private:
|
||||
|
||||
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;
|
||||
|
||||
public Q_SLOTS:
|
||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber);
|
||||
void PlotSpectral(int state);
|
||||
|
||||
96
HPPA/HPPA.ui
96
HPPA/HPPA.ui
@ -233,100 +233,6 @@ QToolBar QToolButton:hover {
|
||||
</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="CustomDockWidgetBase" name="mDockWidgetRGBCamera">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>轮播</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<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="0" column="0" colspan="2">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>256</width>
|
||||
<height>242</height>
|
||||
</rect>
|
||||
</property>
|
||||
<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>
|
||||
<item row="0" column="0">
|
||||
<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>
|
||||
</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="1" column="1">
|
||||
<widget class="QPushButton" name="close_rgb_camera_btn">
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@ -921,7 +827,7 @@ QToolBar QToolButton:hover {
|
||||
<customwidget>
|
||||
<class>CustomDockWidgetHideAbove</class>
|
||||
<extends>QDockWidget</extends>
|
||||
<header location="global">CustomDockWidgetBase.h</header>
|
||||
<header>CustomDockWidgetBase.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
<ClCompile Include="aboutWindow.cpp" />
|
||||
<ClCompile Include="adjustTable.cpp" />
|
||||
<ClCompile Include="CaptureCoordinator.cpp" />
|
||||
<ClCompile Include="Carousel.cpp" />
|
||||
<ClCompile Include="Corning410Imager.cpp" />
|
||||
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
||||
<ClCompile Include="hppaConfigFile.cpp" />
|
||||
@ -168,6 +169,7 @@
|
||||
<QtMoc Include="Corning410Imager.h" />
|
||||
<QtMoc Include="CaptureCoordinator.h" />
|
||||
<QtMoc Include="CustomDockWidgetBase.h" />
|
||||
<QtMoc Include="Carousel.h" />
|
||||
<ClInclude Include="imager_base.h" />
|
||||
<ClInclude Include="irisximeaimager.h" />
|
||||
<QtMoc Include="OneMotorControl.h" />
|
||||
|
||||
@ -136,7 +136,7 @@
|
||||
<ClCompile Include="CustomDockWidgetBase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CustomDockWidgetHideAbove.cpp">
|
||||
<ClCompile Include="Carousel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
@ -201,6 +201,9 @@
|
||||
<QtMoc Include="CustomDockWidgetBase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="Carousel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="imageProcessor.h">
|
||||
@ -233,9 +236,6 @@
|
||||
<ClInclude Include="irisximeaimager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CustomDockWidgetHideAbove.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="FocusDialog.ui">
|
||||
|
||||
Reference in New Issue
Block a user