[Interest] dynamic widget creation in QScrollArea
Frank Rueter | OHUfx
frank at ohufx.com
Sat Aug 6 07:13:39 CEST 2016
Thanks bo,
I will have a look at QListView and delegates instead. I'd love to get
that to work as it has so many things for free that I will want to utilise.
I am having trouble though with creating a delegate that makes every
item behave like my custom widget.
E.g. The widget/item is like a QMovie instance that plays back on mouse
over, has it's own QSlider to scrub through the movie and can be
dragged/dropped.
I will give it another shot and might be back for more help...
Thanks,
frank
On 4/08/16 8:36 pm, Bo Thorsen wrote:
> Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:
>> 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?
>
> I don't think that sounds unreasonable. If I were you, I would try
> very hard to stay with QListView instead, but other than that it
> doesn't sound hard to do. Time consuming, yes, but not difficult.
>
> Bo Thorsen,
> Director, Viking Software.
>
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx for storytellers <http://www.ohufx.com>*
*vfx compositing <http://ohufx.com/index.php/vfx-compositing> |
*workflow customisation & consulting
<http://ohufx.com/index.php/vfx-customising>**
*W E L L I N G T O N | N E W Z E A L A N D *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160806/d62d5abb/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/20160806/d62d5abb/attachment.png>
More information about the Interest
mailing list