[Interest] dynamic widget creation in QScrollArea
Frank Rueter | OHUfx
frank at ohufx.com
Thu Aug 4 10:05:25 CEST 2016
Hi all,
I am playing with the idea of writing a custom widget based on
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if
I'm heading in the right direction:
I have a heap of custom widgets, potentially thousands, depending on the
contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally
as will fit in the current window size (dynamic).
I would also like smooth vertical scrolling.
If I create a single parent widget with a grid layout that creates all
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find the
ones currently visible in the scroll area, then figure out the indexes
of the widgets in the rows above and below to create them dynamically,
that should speed up the startup and still provide smooth scrolling.
Obviously I'd have to manually scale the scroll area based on the
maximum amount of widgets and the parent widget's width to get an
indicative scrollbar.
Not sure how tricky that will be.
Does that sound crazy or doable?
Basically I am trying to re-create the behavior of a QListView in icon
mode. I tried using QListView with delegates, but couldn't get the
delegates to provide the kind of complexity I need for the child widgets
which I have already written (which are basically mini movie players
that can be drag&dropped and have playback all at once on demand).
Any thoughts on this before I dive into this little experiment?
Cheers,
frank
--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation
and consulting <http://ohufx.com/index.php/vfx-customising>* *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160804/17ea2101/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160804/17ea2101/attachment.png>
More information about the Interest
mailing list