update .gitignore
This commit is contained in:
@@ -73,8 +73,7 @@ public:
|
||||
auto initialize_plot() -> void {
|
||||
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()->setRange(QCPRange(0.5, matrix_size.width() - 0.5),
|
||||
QCPRange(0.5, matrix_size.height() - 0.5));
|
||||
@@ -109,10 +108,20 @@ public:
|
||||
if (!xlabel.isEmpty()) self.xAxis->setLabel(xlabel);
|
||||
if (!ylabel.isEmpty()) self.yAxis->setLabel(ylabel);
|
||||
|
||||
// 添加颜色刻度
|
||||
QCPColorScale* color_scale = new QCPColorScale(&self);
|
||||
color_scale->setType(QCPAxis::atBottom);
|
||||
self.plotLayout()->addElement(1, 0, color_scale);
|
||||
// 添加/复用颜色刻度(避免重复 addElement 到相同单元格导致告警)
|
||||
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);
|
||||
self.plotLayout()->addElement(1, 0, color_scale);
|
||||
}
|
||||
cpmp->setColorScale(color_scale);
|
||||
|
||||
// 设置颜色渐变
|
||||
@@ -149,12 +158,10 @@ public:
|
||||
initialized = false;
|
||||
initialize_plot();
|
||||
}
|
||||
|
||||
auto update_plot_data() -> void {
|
||||
if (!initialized || self.plottableCount() == 0) return;
|
||||
|
||||
auto* cpmp = static_cast<QCPColorMap*>(self.plottable(0));
|
||||
|
||||
|
||||
// 设置新数据
|
||||
for (const auto& item : data_points) {
|
||||
@@ -182,7 +189,7 @@ private:
|
||||
QSize matrix_size;
|
||||
QVector<PointData> data_points;
|
||||
double color_min = 0.0;
|
||||
double color_max = 15.0;
|
||||
double color_max = 800.0;
|
||||
bool initialized;
|
||||
BasicPlot& self;
|
||||
};
|
||||
|
||||
@@ -173,10 +173,6 @@ int cpcodec_close(CPCodecContext *ctx) {
|
||||
ctx->codec->close(ctx);
|
||||
}
|
||||
|
||||
if (ctx->codec && ctx->codec->close) {
|
||||
ctx->codec->close(ctx);
|
||||
}
|
||||
|
||||
ctx->is_open = false;
|
||||
ctx->release_priv_storage();
|
||||
ctx->codec_type = CPMediaType::Unknow;
|
||||
@@ -220,4 +216,4 @@ int cpcodec_receive_frame(CPCodecContext *ctx, CPFrame *frame) {
|
||||
}
|
||||
return ctx->codec->receive_frame(ctx, *frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user