| 10 | #include <QMenu> |
| 11 | |
| 12 | AeqPreviewPlot::AeqPreviewPlot(QWidget* parent) : QCustomPlot(parent) |
| 13 | { |
| 14 | setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); |
| 15 | |
| 16 | xAxis->setRange(QCPRange(20,24000)); |
| 17 | xAxis->setLabel(tr("Frequency (Hz)")); |
| 18 | |
| 19 | yAxis->setRange(QCPRange(-10,10)); |
| 20 | yAxis->setLabel(tr("Amplitude (dBr)")); |
| 21 | |
| 22 | QSharedPointer<QCPAxisTickerLog> logTicker(new QCPAxisTickerLog); |
| 23 | xAxis->setTicker(logTicker); |
| 24 | xAxis->setScaleType(QCPAxis::stLogarithmic); |
| 25 | rescaleAxes(); |
| 26 | |
| 27 | QFont legendFont = font(); |
| 28 | legendFont.setPointSize(10); |
| 29 | legend->setFont(legendFont); |
| 30 | legend->setSelectedFont(legendFont); |
| 31 | legend->setVisible(true); |
| 32 | |
| 33 | axisRect()->insetLayout()->setInsetAlignment(0, (Qt::Alignment)(Qt::AlignBottom|Qt::AlignRight)); |
| 34 | |
| 35 | plotLayout()->insertRow(0); |
| 36 | titleElement = new QCPTextElement(this, "", QFont("sans", 10)); |
| 37 | plotLayout()->addElement(0, 0, titleElement); |
| 38 | |
| 39 | setContextMenuPolicy(Qt::CustomContextMenu); |
| 40 | connect(this, &QCustomPlot::customContextMenuRequested, this, &AeqPreviewPlot::onContextMenuRequest); |
| 41 | connect(this, &QCustomPlot::mouseMove, this, &AeqPreviewPlot::onHover); |
| 42 | connect(this, &QCustomPlot::legendClick, this, &AeqPreviewPlot::onLegendClick); |
| 43 | connect(this, &QCustomPlot::legendDoubleClick, this, &AeqPreviewPlot::onLegendDoubleClick); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | #define ADD(name,label,color_light,width) \ |
| 48 | auto name = addGraph(); \ |
nothing calls this directly
no test coverage detected