64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#pragma once
|
|
#include "Tool.h"
|
|
|
|
static QWidget* createWaterFallPlot() {
|
|
class WaterFallPlot : public YSG::Plot {
|
|
public:
|
|
YSG::FrequentAxis *xAxis{};
|
|
YSG::TimeAxis *yAxis{};
|
|
YSG::MutiSelectRect *msr{};
|
|
YSG::WaterFall *wf{};
|
|
QMenu *mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
mObjectName = "WaterFallPlot";
|
|
bindRenderThread(mObjectName + "Thread");
|
|
|
|
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
|
.set_tickLength(-10)
|
|
.set_subTickLength(-5)
|
|
.build();
|
|
|
|
yAxis = YSG::TimeAxis::Builder(this, Qt::Vertical)
|
|
.set_timePointSize(800).build();
|
|
|
|
|
|
wf = YSG::WaterFall::Builder(xAxis, yAxis)
|
|
.set_layerName("plottable")
|
|
.set_frequentRange({0, 20})
|
|
.build();
|
|
|
|
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
xAxis->set_x(0);
|
|
xAxis->set_y(height());
|
|
xAxis->set_pixelSize(width());
|
|
yAxis->set_x(0);
|
|
yAxis->set_y(0);
|
|
yAxis->set_pixelSize(height());
|
|
yAxis->set_timePointSize(height());
|
|
|
|
//wf->set_frequentPointSize(wf->frequentAxis()->getPixelPointSize());
|
|
wf->set_frequentPointSize(width());
|
|
|
|
}
|
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
|
if(!mMenu) {
|
|
auto ws =
|
|
bw(cw(wf, -1), "瀑布图") +
|
|
bw(cw(xAxis), "频率轴") +
|
|
bw(cw(yAxis), "时间轴") +
|
|
bw(cw(msr), "多选框");
|
|
mMenu = createMenu(this, ws);
|
|
}
|
|
mMenu->exec(event->globalPos());
|
|
}
|
|
};
|
|
auto w = new WaterFallPlot;
|
|
w->init();
|
|
return w;
|
|
}
|
|
|