大重构

This commit is contained in:
2026-07-28 17:55:29 +08:00
parent 317b49403d
commit f5f1bf9cc7
63 changed files with 179 additions and 2000 deletions
+17 -14
View File
@@ -14,26 +14,29 @@
QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
class SweepFrequentPlot : public YSG::Plot {
public:
YSG::Axis* xAxis{};
YSG::Axis* yAxis{};
YSG::Muti_Select_Rect* msr{};
YSG::Sweep_Frequent* sf{};
std::shared_ptr<YSG::Axis> xAxis{};
std::shared_ptr<YSG::Axis> yAxis{};
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
std::shared_ptr<YSG::Sweep_Frequent> sf{};
QMenu* mMenu{};
void init() override {
Plot::init();
object_name = "AxisTestPlot";
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
auto data = create_renderable_node(root_renderable(), "DataRenderable");
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
xAxis = YSG::Axis::Builder(axis, Qt::Horizontal)
.set_coord_range({0, 100})
.set_tick_length(-10).build();
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
.set_coord_range({100, 0})
.set_tick_length(-10).build();
sf = YSG::Sweep_Frequent::Builder(xAxis, yAxis)
sf = YSG::Sweep_Frequent::Builder(data, xAxis, yAxis)
.set_block_num(200)
.set_block_frequent_point_size(20)
.set_frequent_range({0, 100})
.build();
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
}
protected:
void resizeEvent(QResizeEvent* event) override {
@@ -47,10 +50,10 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
void contextMenuEvent(QContextMenuEvent* event) override {
if (!mMenu) {
auto ws =
bw(cw(sf, -1), "扫频图") +
bw(cw(xAxis), "x轴") +
bw(cw(yAxis), "y轴") +
bw(cw(msr), "多选框");
bw(cw(sf.get(), -1), "扫频图") +
bw(cw(xAxis.get()), "x轴") +
bw(cw(yAxis.get()), "y轴") +
bw(cw(msr.get()), "多选框");
mMenu = createMenu(this, ws);
}
mMenu->exec(event->globalPos());
@@ -131,11 +134,11 @@ void SweepFrequencyWidget::initMenu() {
auto startFreq = new ValueMenuButton("起始频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
that->setValue(that->mValue + (double)(add ? 1 : -1));
}, -1);
startFreq->setValue(mSweepFrequencyLine->frequent_range().lower);
startFreq->setValue(mSweepFrequencyLine->frequent_range().origin);
auto endFreq = new ValueMenuButton("终止频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
that->setValue(that->mValue + (double)(add ? 1 : -1));
}, -1);
endFreq->setValue(mSweepFrequencyLine->frequent_range().upper);
endFreq->setValue(mSweepFrequencyLine->frequent_range().target);
auto btn3 = new MenuButton("设置频率", fontSize, [&, startFreq, endFreq]() {
mSweepFrequencyLine->set_frequent_range({startFreq->mValue, endFreq->mValue});
});