39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#pragma once
|
|
#include "../Tool.h"
|
|
|
|
|
|
static QWidget* createFrequentAxisTestPlot() {
|
|
class AxisTestPlot : public YSG::Plot {
|
|
public:
|
|
YSG::FrequentAxis *axis{};
|
|
QMenu *mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
mObjectName = "AxisTestPlot";
|
|
axis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
|
.set_tickLength(-10)
|
|
.set_subTickLength(-5)
|
|
.set_coordRange({-12000, 12000})
|
|
.build();
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
int space = 50;
|
|
axis->set_x(space);
|
|
axis->set_y(height()/2);
|
|
axis->set_pixelSize(width() - space * 2);
|
|
}
|
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
|
if(!mMenu) {
|
|
auto ws = bw( cw(axis), "轴");
|
|
mMenu = createMenu(this, ws);
|
|
}
|
|
mMenu->exec(event->globalPos());
|
|
}
|
|
};
|
|
auto w = new AxisTestPlot;
|
|
w->init();
|
|
return w;
|
|
}
|
|
|