I'm working on a GUI with a Qwt plot and came across a seemingly banal problem - namely I can't resize a QScrollBar the way I would like to.
This is how the plot looks like:
http://tinypic.com/view.php?pic=6534o0&s=5#.UpXAwoZhauY
As you can see the vertical and horizontal scroll are bigger/longer than the size of plot canvas and I would like to make them smaller.
I tried scroll->setContentsMargin, I tried styling with margin or height/ width, tried using sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, stretch=3) or overriding the sizeHint virtual function:
QSize CScroll::sizeHint() const
{QSize s=QScrollBar::sizeHint();
const QSize size(s.width()*0.5, s.height());
return size;
}
but as you can see in the screenshot - the size hint affects only the "thickness" of the scroll - so the vertical scroll is affected and the the horizontal one, not.
I also tried changing the grid layout so that it had one more column/row and empty cells to force the scrollbars to move, but that resulted in scrolls taking half of the space I wanted them too (and I'm no expert when it comes to using layouts).
PS. I am using custom scrollbars because using QScrollArea with a QwtPlot doesn't really work
If you using layouts, you can simple add space item before and after scrollbar