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. Add a really huge widget to a QScrollArea
QtWS25 Last Chance

Add a really huge widget to a QScrollArea

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

    I'm trying to implement a hex viewer using QT. I wrote a custom control, extending the class QWidget, without scrolling support, and embedded it into a QScrollArea. When my control displays a small file, everything goes just fine including scrolling. If i try to open a file 3GB big, it still displays the control, but the scrollbars do not appear. Do anyone have any tips for this problem?

    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      There are maximum sizes you can use for windows and widgets. You seem to be bouncing into them.
      I think you need to start to think about a way to render only the part of the view you actually need. Instead of sizing your widget to span the whole file, create a widget that only draws the part of the file that is currently in the viewport.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        decden
        wrote on last edited by
        #3

        Well, i already optimized the render routine to render only the portion given by event->rect(). Is it better if i add the scrollbars and do all the offsetting in the paint routine itself? And therefore delete the QScrollArea?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          You can base your widget of QAbstractScrollArea. That class provides you with the framework of a scrollable area. You can use the scroll bars directly to calculate the offset you need.

          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