You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Src/nmNum/nmSubWxs/nmWxDataKrog.cpp

107 lines
2.9 KiB
C++

#include "zxLogInstance.h"
#include "ZxTableView.h"
#include "ZxTableModel.h"
#include "ZxSubAxisX.h"
#include "ZxSubAxisY.h"
#include "ZxPlot.h"
#include "iGuiPlot.h"
#include "nmWxDataKrog.h"
#include "ui_nmWxDataKrog.h"
nmWxDataKrog::nmWxDataKrog(QWidget *parent) :
iWxKrog(parent),
ui(new Ui::nmWxDataKrog)
{
ui->setupUi(this);
}
nmWxDataKrog::~nmWxDataKrog()
{
delete ui;
}
void nmWxDataKrog::initUI()
{
{
QWidget* pWx = initUI_TableView();
Q_ASSERT (NULL != pWx);
QVBoxLayout* pLayout = new QVBoxLayout();
Q_ASSERT (NULL != pLayout);
pLayout->addWidget(pWx);
ui->gbxTable->setLayout(pLayout);
pLayout->setMargin(0);
pLayout->setSpacing(0);
}
{
QWidget* pWx = initUI_Chart();
Q_ASSERT (NULL != pWx);
QVBoxLayout* pLayout = new QVBoxLayout();
Q_ASSERT (NULL != pLayout);
pLayout->addWidget(pWx);
ui->gbxChart->setLayout(pLayout);
pLayout->setMargin(0);
pLayout->setSpacing(0);
}
ui->splitter->setStretchFactor(0, 2);
ui->splitter->setStretchFactor(1, 3);
//showConstAbouts(false);
iWxPvtUtilItem::loadPvt();
freshChartByTableChange();
}
QWidget* nmWxDataKrog::initUI_Chart()
{
m_pWxPlot = new iGuiPlot(false);
Q_ASSERT (NULL != m_pWxPlot);
m_pWxPlot->initUI("", QSize(80, 64));
ZxPlot* pPlot = m_pWxPlot->m_pPlot;
if (NULL != pPlot)
{
pPlot->getMainAxisX()->setExpTickMode(false);
pPlot->getMainAxisY()->setExpTickMode(false);
pPlot->setLegendVisible(true);
}
return m_pWxPlot;
}
QWidget* nmWxDataKrog::initUI_TableView()
{
QStringList list = m_listNames;
ZxTableModel* pTableModel = new ZxTableModel(1, 1, list, NULL);
Q_ASSERT (NULL != pTableModel);
ZxTableView* pTableView = new ZxTableView(NULL, NULL);
Q_ASSERT (NULL != pTableView);
pTableView->setModel(pTableModel);
pTableView->fuzzyUiOfQt5();
pTableView->setMenuMode(ZxTableView::MTM_Edit_Without_Col);
m_pTableView = pTableView;
m_pTableModel = pTableModel;
// Model、Table更改
disconnect(pTableModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
this, SLOT(slotTableCellChanged(const QModelIndex&, const QModelIndex&)));
connect(pTableModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
this, SLOT(slotTableCellChanged(const QModelIndex&, const QModelIndex&)));
disconnect(pTableView, SIGNAL(sigViewRangeChanged(QModelIndexList, QModelIndexList, QModelIndex)),
this, SLOT(slotTableRowChanged(QModelIndexList, QModelIndexList, QModelIndex)));
connect(pTableView, SIGNAL(sigViewRangeChanged(QModelIndexList, QModelIndexList, QModelIndex)),
this, SLOT(slotTableRowChanged(QModelIndexList, QModelIndexList, QModelIndex)));
bindSubCtrl(m_pTableView);
fillTableViewWithDefault();
return m_pTableView;
}