[Interest] dynamic widget creation in QScrollArea

Frank Rueter | OHUfx frank at ohufx.com
Sat Aug 6 07:23:47 CEST 2016


Thanks Reto,

I'm not entirely certain I understand your example (I'm using Python).
I'm not quite sure yet how I would instantiate the widgets based on 
their visibility yet, but will think about it again if I can't get the 
QDelegate to work with animation.

Cheers,
frank

On 5/08/16 1:09 am, Reto Tschofenig, ODT Informatik GmbH wrote:
> Hi Frank
>
> if the children are the same type and it's like a table, I would 
> recommend the following alternative:
>
> don't inherit from it QScrollArea but instantiate as many child 
> widget's as visible. bind now the child-widgets depending of the 
> position of the scrollbar with the object.
>
> > widgets horizontally
> my example is vertical, but you could adapt it...
>
> +- ListView ------------------------------------+
> | +- Viewport ----------------------------+ +-+ |
> | | +- 1. ItemView ---------------------+ | |s| |
> | | + Edit Label or whatever            | | |c| |
> | | +-----------------------------------+ | |r| |
> | | +- 2. ItemView ---------------------+ | |o| |
> | | + Edit Label or whatever            | | |l| |
> | | +-----------------------------------+ | |l| |
> | | +- 3. ItemView ---------------------+ | |b| |
> | | + Edit Label or whatever            | | |a| |
> | | +-----------------------------------+ | |r| |
> | | +- 4. ItemView ---------------------+ | | | |
> | | + Edit Label or whatever            | | | | |
> | | +-----------------------------------+ | | | |
> | +---------------------------------------+ +-+ |
> +-----------------------------------------------+
>
> class ListView : QWidget{
>   QWidget* _viewport; // the parent for the ItemView's
>   QScrollBar* _scrollbar;
>   QList<ItemView*> _items;
>   int _scrollPosition;
>   QList<Object*> _objects;
> }
> class ItemView : QWidget{
>   Object* _object;
>   QLineEdit* _someEdits;
>   void bind( Object* object );
> }
>
> > smooth vertical scrolling
> Of course, the child-widgets could be also pixel accuracy moved.
>
> > QListView in icon mode
> replace the QLineEdit with a Icon-Widget or Label or paint it in 
> ItemView directly.
>
> good luck
> Reto
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
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/79209d17/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/79209d17/attachment.png>


More information about the Interest mailing list