Thank you!
I didn't need much, so the solution to the problem was pretty simple.
What I've done:
Step 1
Added to mainwindow.h:
protected: virtual void resizeEvent(QResizeEvent *);
And in mainwindow.cpp:
void MainWindow::resizeEvent(QResizeEvent *event) {
QCPAxis *x, *y;
x = plotPresenter->customPlot->axisRect()->axis(QCPAxis::atBottom);
y = plotPresenter->customPlot->axisRect()->axis(QCPAxis::atLeft);
y->setScaleRatio(x, 1.0);
}
After this step, I saw some drawbacks when magnifying the screen. The next step corrected this.
Step 2
Added after
y->setScaleRatio(x, 1.0);
line:
plotPresenter->customPlot->replot();
Why did I do this?
Because
resizeEvent is protected! I didn't want to use inheritance, since my task is rather small. And I also didn't want to change the QCustomPlot source code. And
resizeEvent calls the replot function, which I inserted!
I have the QCustomPlot in a vertical layer.
Thanks again!