I am plotting bar graphs using QCustomPlot inside a QSplitter
(horizontal orientation). However, the bar graph can have more than 20 entries on the x axis and hence the bar graph shrinks horizontally thereby fitting inside the splitter region but the axis labels and bar values start to overlap. I want to avoid that by adding a QScrollArea
which should let me scroll horizontally. However, on dragging the splitter to reduce the horizontal size, the graph automatically resizes and tick labels start to overlap and no scroll bar appears until the width is a very small value. How can I fix a minimum width for the graph so that if the splitter is dragged and the view width becomes less than the minimum width, a horizontal scrollbar would appear?
Note that setting setMinimumSize
and setMinimumWidth
on the QCustomPlot
instance has NO effect whatsoever in the behavior.
How the code is:
QSplitter
contains a QWidget
which contains a QScrollArea
containing the plot.