QListWidget - Auto Scroll
-
Hi all!
I am using a QListWidget to display various messages in a lightweight server application. However one tiny cosmetic problem is really irritating me,
As items are being added to the list the vertical scrollbar will not automatically scroll down to always show the latest message at the bottom of the QListWidget. There appears to be an 'autoscroll' option in the design properties of the QListWidget but I'm yet to understand what this does.
Could anybody help please??
Much Love
Andrew -
Did you try to call "QAbstractItemView::scrollToBottom()":http://doc.qt.nokia.com/4.7/qabstractitemview.html#scrollToBottom after you have added an item? (the function is available in all subclasses, including QListWidget).
-
Yes my issue is more how can I do this using connect() signals and slots as nearly all methods and several classes are pumping data into this QListWidget so it would be much easier to simply signal the system to do it.
Thanks
Andrew -
You can try this (I did not try it myself):
@
connect(
listView->model(),
SIGNAL(rowsInserted ( const QModelIndex &, int, int ) ),
listView,
SLOT(scrollToBottom ())
);
@ -
That worked perfectly first time, your a star. Thank You :-D
-
Oh wow... I'd rather believe I did too much (sometimes fance, sometimes not so fancy) stuff with list views in the last years :-)
-
When you frequently add lines to the model, the widget starts to slow down. You can make setUniformItemSizes(), but I want the elements to be of different heights.
There is a solution?