63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
#ifndef a_信号侦察_H
|
|
#define a_信号侦察_H
|
|
#include "function_global.h"
|
|
class T_信号侦察_频谱图 : public YSG::Plot {
|
|
public:
|
|
YSG::FrequentAxis* xAxis{};
|
|
YSG::Axis* yAxis{};
|
|
YSG::MutiSelectRect* msr{};
|
|
YSG::Spectrum* sp{};
|
|
QMenu* mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
mObjectName = "SpectrumPlot";
|
|
bindRenderThread(mObjectName + "Thread");
|
|
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
|
.set_coord_range({0, 100})
|
|
.set_tick_length(-10)
|
|
.set_sub_tick_length(-5)
|
|
.set_use_wheel(true)
|
|
.set_use_drag(true)
|
|
.build();
|
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
|
.set_coord_range({100, 0})
|
|
.set_unit_text("功率")
|
|
.set_use_drag(true)
|
|
.build();
|
|
sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build();
|
|
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20;
|
|
int w = width() - leftMargin - rightMargin;
|
|
int h = height() - topMargin - bottomMargin;
|
|
xAxis->set_x(leftMargin);
|
|
xAxis->set_y(height() - bottomMargin);
|
|
xAxis->set_pixel_size(w);
|
|
yAxis->set_x(leftMargin);
|
|
yAxis->set_y(topMargin);
|
|
yAxis->set_pixel_size(h);
|
|
sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size());
|
|
}
|
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
|
if (!mMenu)
|
|
{
|
|
auto ws =
|
|
bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框");
|
|
mMenu = createMenu(this, ws);
|
|
}
|
|
mMenu->exec(event->globalPos());
|
|
}
|
|
};
|
|
class 信号侦察 : public BaseWidget {
|
|
public:
|
|
QHBoxLayout* mainLayout{};
|
|
T_信号侦察_频谱图* m_频谱图{};
|
|
TreeView *treeView{};
|
|
QVBoxLayout* createV();
|
|
void paintEvent(QPaintEvent* event) override;
|
|
信号侦察();
|
|
};
|
|
#endif // 信号侦察_H
|