Nominate our 2022 Qt Champions!

QListWidget scrolling not working properly

  • Hi,

    I have an image that is 800x12000 pixels that I add to QListWidget using addItem method. The trouble is that the vertical scrollbar only allows scrolling down to only the top part of the image. The rest of the image isn't reachable.

    The image is there as I can call .save and then view it from the image file in all it's glory in a photo viewer.

    qtw = QtWidgets.QListWidgetItem()
    listWidget.setIconSize(QtCore.QSize(width, height))

    Is this a bug in Qt? How do I get the scrolling in QListWidget to work properly?

  • @TonyB123
    I imagine QListWidget scrolls to (the start of) each item in the list. What do you mean exactly by "How do I get the scrolling in QListWidget to work properly?"?

    Your item is something like 10+ screen-fuls high. You really want that in a list widget?

  • Lifetime Qt Champion

    @TonyB123 Why do you want to put such a huge image into a QListWidget?!

  • Lifetime Qt Champion

    I think a QScrollArea with a QLabel showing image might work better than
    a monster size item.

  • The scrollbar range only allows to see a little of a window height of the image and not the rest of the image. The scrollbar is huge and almost the same height of the window, so moving it down only a bit and it already reaches its limit and only reveals a few more lines of the image.

    I since chopped up the image into smaller chunks and displayed them across multiple QListWidgetItems and the scrolling works for this.

Log in to reply