update .gitignore

This commit is contained in:
2025-10-29 14:08:18 +08:00
parent 1f65ba0114
commit c50b44efe2
3 changed files with 69 additions and 66 deletions

2
.gitignore vendored
View File

@@ -2,7 +2,7 @@
.vscode/ .vscode/
.vs/ .vs/
.idea/ .idea/
.VSCodeCounter/
cmake-build-*/ cmake-build-*/
build/ build/
output/ output/

View File

@@ -73,7 +73,6 @@ public:
auto initialize_plot() -> void { auto initialize_plot() -> void {
if (initialized) return; if (initialized) return;
// 创建颜色映射
QCPColorMap* cpmp = new QCPColorMap(self.xAxis, self.yAxis); QCPColorMap* cpmp = new QCPColorMap(self.xAxis, self.yAxis);
cpmp->data()->setSize(matrix_size.width(), matrix_size.height()); cpmp->data()->setSize(matrix_size.width(), matrix_size.height());
cpmp->data()->setRange(QCPRange(0.5, matrix_size.width() - 0.5), cpmp->data()->setRange(QCPRange(0.5, matrix_size.width() - 0.5),
@@ -109,10 +108,20 @@ public:
if (!xlabel.isEmpty()) self.xAxis->setLabel(xlabel); if (!xlabel.isEmpty()) self.xAxis->setLabel(xlabel);
if (!ylabel.isEmpty()) self.yAxis->setLabel(ylabel); if (!ylabel.isEmpty()) self.yAxis->setLabel(ylabel);
// 添加颜色刻度 // 添加/复用颜色刻度(避免重复 addElement 到相同单元格导致告警)
QCPColorScale* color_scale = new QCPColorScale(&self); QCPLayoutElement* occupied = self.plotLayout()->element(1, 0);
QCPColorScale* color_scale = occupied ? qobject_cast<QCPColorScale*>(occupied) : nullptr;
if (!color_scale) {
if (occupied) {
// 单元格被其他元素占用,移除并删除后再放入 ColorScale
self.plotLayout()->remove(occupied);
delete occupied;
occupied = nullptr;
}
color_scale = new QCPColorScale(&self);
color_scale->setType(QCPAxis::atBottom); color_scale->setType(QCPAxis::atBottom);
self.plotLayout()->addElement(1, 0, color_scale); self.plotLayout()->addElement(1, 0, color_scale);
}
cpmp->setColorScale(color_scale); cpmp->setColorScale(color_scale);
// 设置颜色渐变 // 设置颜色渐变
@@ -149,13 +158,11 @@ public:
initialized = false; initialized = false;
initialize_plot(); initialize_plot();
} }
auto update_plot_data() -> void { auto update_plot_data() -> void {
if (!initialized || self.plottableCount() == 0) return; if (!initialized || self.plottableCount() == 0) return;
auto* cpmp = static_cast<QCPColorMap*>(self.plottable(0)); auto* cpmp = static_cast<QCPColorMap*>(self.plottable(0));
// 设置新数据 // 设置新数据
for (const auto& item : data_points) { for (const auto& item : data_points) {
if (item.x >= 0 && item.x < matrix_size.width() && if (item.x >= 0 && item.x < matrix_size.width() &&
@@ -182,7 +189,7 @@ private:
QSize matrix_size; QSize matrix_size;
QVector<PointData> data_points; QVector<PointData> data_points;
double color_min = 0.0; double color_min = 0.0;
double color_max = 15.0; double color_max = 800.0;
bool initialized; bool initialized;
BasicPlot& self; BasicPlot& self;
}; };

View File

@@ -173,10 +173,6 @@ int cpcodec_close(CPCodecContext *ctx) {
ctx->codec->close(ctx); ctx->codec->close(ctx);
} }
if (ctx->codec && ctx->codec->close) {
ctx->codec->close(ctx);
}
ctx->is_open = false; ctx->is_open = false;
ctx->release_priv_storage(); ctx->release_priv_storage();
ctx->codec_type = CPMediaType::Unknow; ctx->codec_type = CPMediaType::Unknow;