Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QListWidget scrolling not working properly
Forum Updated to NodeBB v4.3 + New Features

QListWidget scrolling not working properly

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TonyB123
    wrote on last edited by
    #1

    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.

    qic=QtGui.QIcon(QtGui.QPixmap.fromImage(im))
    qtw = QtWidgets.QListWidgetItem()
    qtw.setIcon(qic)
    listWidget.addItem(qtw)
    listWidget.setIconSize(QtCore.QSize(width, height))

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

    JonBJ jsulmJ 2 Replies Last reply
    0
    • T TonyB123

      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.

      qic=QtGui.QIcon(QtGui.QPixmap.fromImage(im))
      qtw = QtWidgets.QListWidgetItem()
      qtw.setIcon(qic)
      listWidget.addItem(qtw)
      listWidget.setIconSize(QtCore.QSize(width, height))

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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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?"?

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

      1 Reply Last reply
      2
      • T TonyB123

        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.

        qic=QtGui.QIcon(QtGui.QPixmap.fromImage(im))
        qtw = QtWidgets.QListWidgetItem()
        qtw.setIcon(qic)
        listWidget.addItem(qtw)
        listWidget.setIconSize(QtCore.QSize(width, height))

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

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

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

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          1 Reply Last reply
          3
          • T Offline
            T Offline
            TonyB123
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved