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::setupMultiAxisRectInteractionsMouseMove(QMouseEvent *event) { QCPAxisRect *ar = qobject_cast<QCPAxisRect*>(mCustomPlot->layoutElementAt(event->pos())); if (ar) ar->setBackground(QColor(230, 230, 230)); for (int i=0; i<mCustomPlot->axisRectCount(); ++i) { if (mCustomPlot->axisRect(i) != ar) mCustomPlot->axisRect(i)->setBackground(Qt::NoBrush); } mCustomPlot->replot(); }