63 lines
1.9 KiB
C++
63 lines
1.9 KiB
C++
#include "panels/chart/RawDataChartView.hpp"
|
||
|
||
#include <QComboBox>
|
||
#include <QHBoxLayout>
|
||
#include <QLabel>
|
||
#include <QToolButton>
|
||
#include <QVBoxLayout>
|
||
|
||
namespace geopro::app {
|
||
|
||
RawDataChartView::RawDataChartView(QWidget* parent) : QWidget(parent) {
|
||
auto* lay = new QVBoxLayout(this);
|
||
lay->setContentsMargins(0, 0, 0, 0);
|
||
lay->setSpacing(0);
|
||
|
||
// ---- 工具条 ----
|
||
auto* toolbar = new QWidget(this);
|
||
auto* tbLay = new QHBoxLayout(toolbar);
|
||
tbLay->setContentsMargins(4, 4, 4, 4);
|
||
tbLay->setSpacing(4);
|
||
|
||
auto* btnGrid = new QToolButton(toolbar);
|
||
btnGrid->setText(QStringLiteral("网格"));
|
||
|
||
auto* btnColorScale = new QToolButton(toolbar);
|
||
btnColorScale->setText(QStringLiteral("色阶配置"));
|
||
|
||
auto* lblCurrentChart = new QLabel(QStringLiteral("当前图形:"), toolbar);
|
||
|
||
chartTypeCombo_ = new QComboBox(toolbar);
|
||
chartTypeCombo_->addItem(QStringLiteral("散点图"));
|
||
|
||
auto* btnSaveAs = new QToolButton(toolbar);
|
||
btnSaveAs->setText(QStringLiteral("另存为"));
|
||
|
||
tbLay->addWidget(btnGrid);
|
||
tbLay->addWidget(btnColorScale);
|
||
tbLay->addWidget(lblCurrentChart);
|
||
tbLay->addWidget(chartTypeCombo_);
|
||
tbLay->addWidget(btnSaveAs);
|
||
tbLay->addStretch();
|
||
|
||
lay->addWidget(toolbar);
|
||
|
||
// ---- 图表占位区(stretch) ----
|
||
plotArea_ = new QWidget(this);
|
||
plotArea_->setObjectName(QStringLiteral("rawPlotArea"));
|
||
lay->addWidget(plotArea_, 1);
|
||
|
||
// ---- 色阶占位(固定高 36px) ----
|
||
auto* colorScaleBar = new QWidget(this);
|
||
colorScaleBar->setObjectName(QStringLiteral("rawColorScaleBar"));
|
||
colorScaleBar->setFixedHeight(36);
|
||
lay->addWidget(colorScaleBar);
|
||
}
|
||
|
||
void RawDataChartView::setData(const geopro::controller::DatasetDetailController::ChartData& d) {
|
||
// 步骤1:保存数据,图表渲染留给后续步骤。
|
||
data_ = d;
|
||
}
|
||
|
||
} // namespace geopro::app
|