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. Qt widgets: setRange for verticalScrollbar of QListView

Qt widgets: setRange for verticalScrollbar of QListView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k 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.
  • W Offline
    W Offline
    Wahsekim
    wrote on last edited by
    #1

    Hello, I have my sub classing QListView.
    I made my own paintEvent() of list view and I would like to setRange() for my vertical scrollbar of list view. But it seems that the range is calculated by QListView and I can't change it. Is there any solution that I can't modify the scroll bar of list view.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      It's pretty unusual to modify the paint event of such a widget, generally a QStyledItemDelegate is used for special rendering. Why did you do it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wahsekim
        wrote on last edited by
        #3

        Yes, it's unusual. I'm doing some transformation which modify the height of the view. I tried to paint with delegate, but it seems that I need some kind of global position in the view to make sure my calculate is right. So I redefined the paintEvent of QListView.

        Back to the question, I found that setRange is called in updateVertical/HorizontalScrollBar inside of updateGeometries(). So do setSingleStep and setPageStep. So I redifined updateGeometries() to make the range is not reset. Works fine. I don't know if there will be some side effect.

        Ty for your advice.
        [quote author="SGaist" date="1404941104"]Hi,

        It's pretty unusual to modify the paint event of such a widget, generally a QStyledItemDelegate is used for special rendering. Why did you do it ?[/quote]

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The best is to test it extensively ;)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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