DYT/Source/src/ui/Menu/ChartPlotMenu.cpp
2024-11-22 23:11:48 +08:00

77 lines
1.7 KiB
C++

#include "ChartPlotMenu.h"
#include "../chartPlot/DYTChart.h"
#include "workspace/WorkSpace.h"
#include "workspace/WorkSpaceManager.h"
ChartPlotMenu::ChartPlotMenu(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
InitMenu();
}
ChartPlotMenu::~ChartPlotMenu()
{
}
void ChartPlotMenu::InitMenu()
{
connect(ui.toolButton, &QToolButton::clicked, this, &ChartPlotMenu::slotClicked2DCurve);
connect(ui.toolButton_3, &QToolButton::clicked, this, &ChartPlotMenu::slotClicked2DLgCurve);
connect(ui.toolButton_2, &QToolButton::clicked, this, &ChartPlotMenu::slotClicked3DCurve);
if (!m_p2DChart)
{
m_p2DChart = new DYTChart(1);
WorkSpaceManager::Get().SetDYTChart2D(m_p2DChart);
connect(m_p2DChart, &DYTChart::signalAddCurve, this, &ChartPlotMenu::signalAddCurve);
connect(m_p2DChart, &DYTChart::signalDelCurve, this, &ChartPlotMenu::signalDelCurve);
}
if (!m_p2DLgChart)
{
m_p2DLgChart = new DYTChart(2);
WorkSpaceManager::Get().SetDYTChart2DLg(m_p2DLgChart);
connect(m_p2DLgChart, &DYTChart::signalAddLgCurve, this, &ChartPlotMenu::signalAddLgCurve);
connect(m_p2DLgChart, &DYTChart::signalDelLgCurve, this, &ChartPlotMenu::signalDelLgCurve);
}
if (!m_p3DChart)
{
m_p3DChart = new DYTChart(3);
WorkSpaceManager::Get().SetDYTChart3D(m_p3DChart);
connect(m_p3DChart, &DYTChart::signalAddSurfaceCurve, this, &ChartPlotMenu::signalAddSurfaceCurve);
}
}
void ChartPlotMenu::slotClicked2DCurve()
{
WorkSpaceManager::Get().SetDYTChart2D(m_p2DChart);
m_p2DChart->show();
}
void ChartPlotMenu::slotClicked2DLgCurve()
{
WorkSpaceManager::Get().SetDYTChart2DLg(m_p2DLgChart);
m_p2DLgChart->show();
}
void ChartPlotMenu::slotClicked3DCurve()
{
WorkSpaceManager::Get().SetDYTChart3D(m_p3DChart);
m_p3DChart->show();
}