scrolling in WScrollArea and WContainerWidget

Added by Аз Есмь 10 months ago

hello,

on one hand, a widget in a WScrollArea can be scrolled with verticalScrollBar()->setValue(), but neither WScrollArea, nor WScrollBar doesn't have a signal to intercept user's interaction with the scroll bars. on the other hand, WContainerWidget emits the scrolled() signal, but doesn't allow the scroll bars to be manipulated.

how can i combine their strengths in a widget?

thank you.


Replies (2)

RE: scrolling in WScrollArea and WContainerWidget - Added by Koen Deforche 9 months ago

Hey,

The WContainerWidget + setOverflow + scrolled() signal is indeed the method we find more useful (I'ld consider WScrollArea + WScrollBar a case of copying Qt's API just a little bit too much).

What is missing is indeed a way to set the scroll bar, but because that is mostly useful only from client-side JavaScript I believe you really should get familiar with the JavaScript syntax for that:

element.offset[Left/Top] = value;

You can do this directly from the server using:

doJavaScript(widget->jsRef() + ".offsetLeft = 10;");

Regards,
koen

RE: scrolling in WScrollArea and WContainerWidget - Added by Michaël Roy 6 days ago

That did not work for me... The code gets sent, but my WContainerWidget will not move.

I have a ContainerWidget in the center cell of a WBorderLayout. Using the above method, I do receive notifications, but the JS does nothing. It does get sent though. Am I missing something or is it the explanation that does?

Thanks,
tika.

(1-2/2)