feat/dataset-detail-chart #5
|
|
@ -29,6 +29,7 @@ add_executable(geopro_desktop WIN32
|
||||||
panels/chart/DatasetChartView.cpp
|
panels/chart/DatasetChartView.cpp
|
||||||
panels/AnomalyTablePanel.cpp
|
panels/AnomalyTablePanel.cpp
|
||||||
panels/DatasetDetailPage.cpp
|
panels/DatasetDetailPage.cpp
|
||||||
|
panels/DatasetDetailPanel.cpp
|
||||||
CentralScene.cpp
|
CentralScene.cpp
|
||||||
ProjectListDialog.cpp
|
ProjectListDialog.cpp
|
||||||
SettingsDialog.cpp)
|
SettingsDialog.cpp)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include "panels/DatasetDetailPanel.hpp"
|
||||||
|
#include "panels/DatasetDetailPage.hpp"
|
||||||
|
namespace geopro::app {
|
||||||
|
|
||||||
|
DatasetDetailPanel::DatasetDetailPanel(QWidget* parent) : QTabWidget(parent) {
|
||||||
|
setTabsClosable(true);
|
||||||
|
connect(this, &QTabWidget::tabCloseRequested, this, [this](int i) { delete widget(i); });
|
||||||
|
connect(this, &QTabWidget::currentChanged, this, [this](int i) {
|
||||||
|
if (auto* p = qobject_cast<DatasetDetailPage*>(widget(i)))
|
||||||
|
emit activeDatasetChanged(p->dsId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
DatasetDetailPage* DatasetDetailPanel::pageFor(const QString& dsId) const {
|
||||||
|
for (int i = 0; i < count(); ++i)
|
||||||
|
if (auto* p = qobject_cast<DatasetDetailPage*>(widget(i)))
|
||||||
|
if (p->dsId() == dsId) return p;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatasetDetailPanel::openOrUpdate(const geopro::controller::DatasetDetailController::ChartData& d) {
|
||||||
|
auto* p = pageFor(d.dsId);
|
||||||
|
if (!p) { p = new DatasetDetailPage(this); addTab(p, d.dsId); } // 标题后续可换 ds 名
|
||||||
|
p->setData(d);
|
||||||
|
setCurrentWidget(p);
|
||||||
|
}
|
||||||
|
void DatasetDetailPanel::focusDataset(const QString& dsId) {
|
||||||
|
if (auto* p = pageFor(dsId)) setCurrentWidget(p);
|
||||||
|
}
|
||||||
|
} // namespace geopro::app
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
#pragma once
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include "DatasetDetailController.hpp"
|
||||||
|
namespace geopro::app {
|
||||||
|
class DatasetDetailPage;
|
||||||
|
|
||||||
|
// 多 Tab 壳:每数据集一页(按 dsId 去重)。R095。
|
||||||
|
class DatasetDetailPanel : public QTabWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DatasetDetailPanel(QWidget* parent = nullptr);
|
||||||
|
void openOrUpdate(const geopro::controller::DatasetDetailController::ChartData& d); // 双击/数据到达
|
||||||
|
void focusDataset(const QString& dsId); // 单击聚焦已开页
|
||||||
|
signals:
|
||||||
|
void activeDatasetChanged(const QString& dsId); // 反向联动数据集列表
|
||||||
|
private:
|
||||||
|
DatasetDetailPage* pageFor(const QString& dsId) const;
|
||||||
|
};
|
||||||
|
} // namespace geopro::app
|
||||||
Loading…
Reference in New Issue