40 lines
1.0 KiB
C++
40 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 = new YSG::FrequentAxis;
|
|
axis->init(this, "axis");
|
|
axis->setOrientation(Qt::Horizontal);
|
|
axis->setTickLength(-10);
|
|
axis->setSubTickLength(-5);
|
|
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
int space = 50;
|
|
axis->setX(space);
|
|
axis->setY(height()/2);
|
|
axis->setPixelLength(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;
|
|
}
|
|
|