49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#pragma once
|
|
#include "../Tool.h"
|
|
|
|
|
|
|
|
static QWidget* createMutiSelectPlot() {
|
|
class MutiSelectPlot : public YSG::Plot{
|
|
public:
|
|
YSG::Axis *xAxis{};
|
|
YSG::Axis *yAxis{};
|
|
YSG::MutiSelectRect *mMutiSelectRect{};
|
|
QMenu *mMenu{};
|
|
void init() override {
|
|
Plot::init();
|
|
mObjectName = "PlanispherePlot";
|
|
bindRenderThread("PlanispherePlotThread");
|
|
|
|
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
|
.set_tickLength(-10)
|
|
.set_subTickLength(-5).build();
|
|
|
|
yAxis = YSG::Axis::Builder(this, Qt::Vertical).build();
|
|
mMutiSelectRect = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
|
}
|
|
protected:
|
|
void resizeEvent(QResizeEvent* event) override {
|
|
xAxis->set_x(0);
|
|
xAxis->set_y(height() - 1);
|
|
xAxis->set_pixelSize(width());
|
|
yAxis->set_x(0);
|
|
yAxis->set_y(0);
|
|
//yAxis->setCoordReserve(true);
|
|
yAxis->set_pixelSize(height());
|
|
}
|
|
void contextMenuEvent(QContextMenuEvent* event) override {
|
|
if(!mMenu) {
|
|
auto ws = bw( cw(mMutiSelectRect), "多选框");
|
|
mMenu = createMenu(this, ws);
|
|
}
|
|
mMenu->exec(event->globalPos());
|
|
}
|
|
};
|
|
|
|
auto w = new MutiSelectPlot;
|
|
w->init();
|
|
|
|
return w;
|
|
}
|