Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QListView ScrollToBottom doesn't scroll to the very end



  • Hello
    I want to achieve the 'Auto scroll' effect on QListView component, currently I am using scrollToBottom() function to get to the very end, but it always stays a little bit above the complete end of the list, see the image attached below.
    I think there might be some feature in the QtDesigner that I haven't discovered yet, but I was not able to figure out how to scroll to the very end, so the bottom line doesn't get clipped this bad.
    I am using Python with PySide6 and I am importing the ui file converted to the .py file using pyside6-uic tool.

    Thanks to anybody answering, I really appreciate any piece of help, since I'm fairly new to the whole Qt stuff, but I like to learn and I hope my question is just not completely stupid.

    The image:
    issue.png


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Shouldn't you rather use scrollTo using QAbstractItemView::PositionAtBottom ?



  • I don't know if I'm doing anything wrong, but the code implemented throws me an exception

    TypeError: 'PySide6.QtWidgets.QListView.scrollTo' called with wrong argument types:
      PySide6.QtWidgets.QListView.scrollTo(ScrollHint)
    Supported signatures:
      PySide6.QtWidgets.QListView.scrollTo(PySide6.QtCore.QModelIndex, PySide6.QtWidgets.QAbstractItemView.ScrollHint = PySide6.QtWidgets.QAbstractItemView.ScrollHint.EnsureVisible)
    

    The line I added looks like this:

    self.ui.phpConsole.scrollTo(QAbstractItemView.PositionAtBottom)
    

    I just changed the line mentioned previously with this one, but the error shows up.


  • Lifetime Qt Champion

    You are missing the index argument.


Log in to reply