void MainWindow::setupInsetLayoutTest(QCustomPlot *customPlot) { customPlot->addLayer("insetLayer"); customPlot->setCurrentLayer("insetLayer"); QCPAxisRect *insetAxRect = new QCPAxisRect(customPlot); insetAxRect->setMinimumSize(300, 250); customPlot->axisRect(0)->insetLayout()->addElement(insetAxRect, Qt::AlignRight|Qt::AlignTop); insetAxRect->setupFullAxesBox(true); insetAxRect->setBackground(QBrush(QColor(240, 240, 240))); }
void MainWindow::setupMultiAxisRectInteractions(QCustomPlot *customPlot) { QCPAxisRect *r1 = new QCPAxisRect(customPlot); customPlot->plotLayout()->addElement(1, 0, r1); QCPAxisRect *r2 = new QCPAxisRect(customPlot); customPlot->plotLayout()->addElement(0, 1, r2); QCPAxisRect *r3 = new QCPAxisRect(customPlot); customPlot->plotLayout()->addElement(1, 1, r3); QCPAxisRect *inset = new QCPAxisRect(customPlot); inset->setMinimumSize(170, 120); inset->setupFullAxesBox(true); foreach (QCPAxis *ax, inset->axes()) ax->setAutoTickCount(3); r3->insetLayout()->addElement(inset, Qt::AlignRight|Qt::AlignTop); connect(mCustomPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(setupMultiAxisRectInteractionsMouseMove(QMouseEvent*))); }