Solved How do I make a scrollbar move along with the hosting widget?
-
Folks,
Even QScollArea behaves the exact same way - the scroll bars do not follow the temporal window's dimensions. Any idea? Alternatives?
I have noticed that the QCustomPlot widget itself does not change in size (I gave up QScrollArea) - it must be the same issue? Is it layout related? -
@tamirmichael
Well it normally does.
Did you apply a layout to the viewport of the scoll area ? -
Can you show maybe some picture/sketch of what you are trying to achieved ?
Did you make QScrollArea the hosting widget ?
-
-
How are you setting that up ?
-
Does it matter which layout type?
I will try to mess with QScollArea somewhat more...how do I set it to "host" ? Tried to drop the scroll bar onto it etc. without result...@SGaist So far I only added the scroll area, and tried to place the scrollbars where I want them, on or off it - with negative results.
I see that dragging the QScrollArea does indeed change the location of my scroll bar too - does that mean that its "hosting"? I see no change in behavior though...
Can you tell me in a few short sentences what I need to do? It's silly I have a working example but I cannot seem to find anything at all about it that makes it work! :-( -
@tamirmichael
Hi
I checked the sample and its now clear what you mean.
You want to scroll the axes of the customplot with the scrollbars.
adn not scroll the actual widget around.
You need all the code from the example to do so. (except setupPlot())
private slots:
void horzScrollBarChanged(int value);
void vertScrollBarChanged(int value);
void xAxisChanged(QCPRange range);
void yAxisChanged(QCPRange range);
and their code.
and the connect statements and othe code from constructor.the example uses a QGridLayout to keep scrollbars following the customplot.
You can still use a ScrollArea if you want instead of the free scrollbars. -
Hopeless UI design ! Hopeless !
-
@tamirmichael
why is it hopeless ?
Its fully documented and works pretty nice.
https://doc.qt.io/qt-5/layout.html -
I think it is tremendously un-intuitive. There other ways to suggest that behavior like this is to be induced, and the link above does indeed demonstrates that I am not the only one who just did not get it. Either way thanks.