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