Hi,

I have a QScrollArea with some widgets inside and I would like to force it to scroll all the way to the right when I click a button after a new widget is created inside this scrollarea.

This is what I have so far:
The QScrollArea is called imageList:

Qt Code:
  1. int max = imageList->horizontalScrollBar()->maximum();
  2. imageList->horizontalScrollBar()->setValue(max);
To copy to clipboard, switch view to plain text mode 

However it is not scrolling all the way to the right. It is scrolling to the element before the last one. Obviously this code is placed after adding the last widget to the QScrollArea.
Am I doing something wrong?

Thanks a lot in advance for your help.