Hi, everyone. I create a plot with CustomPlotZoom like this:
//inside MainWindow's constructor QWidget *widgetMain = new QWidget(this); setCentralWidget(widgetMain); auto *gridMain = new QGridLayout(widgetMain); plot = new CustomPlotZoom(this); gridMain->addWidget(plot);
In this plot, when I click on various parts of the graph, I can see the (x,y) coordinates. Also, I can zoom in on the plot.
Now I want to add a border to my plot. I found no other way than encapsulating the plot inside a QFrame object like this:
QFrame *frame = new QFrame(); frame->setFrameShape(QFrame::StyledPanel); plot = new CustomPlotZoom(frame); QVBoxLayout *frameLayout = new QVBoxLayout(frame); frameLayout->addWidget(plot); gridMain->addWidget(frame,2,0,2,10);
With this code, a border appears around my plot (even though the plot becomes a little smaller). However, I've noticed that the plot cannot be zoomed in anymore, and the coordinates are also not shown when I click on the graph. So I have two questions:
1) Why does this happen and how can I fix it (still using QFrame)?
2) Is there any way to add a border to the plot or simply change the color of the edges other than using QFrame?
Thank you.