[PyQt] Resizing index widgets

Mads Ipsen mads.ipsen at gmail.com
Thu Jan 31 06:44:19 GMT 2013


Hi Detlev,

We have of the order 60-70 interface plugins available in our 'tool box' 
- to be able to order them, group them, filter/search them - and still 
maintain a compact layout - I felt that the QToolBox offered too 'flat' 
a solution. Let me know your opinion or suggestions for a better approach.

Best regards,

Mads



On 01/30/2013 07:11 PM, Detlev Offenbach wrote:
>
> Hi Mads,
>
> why are you using QTreeView? I would use QToolbox for such a layout.
>
> Regards,
>
> Detlev
>
> On Tuesday 29 January 2013, 22:31:14 Mads Ipsen wrote:
>
> Hi,
>
> We develop a tool for manipulating atomic structures and have embedded 
> all the manipulation widgets in a panel bar (widget on the right in 
> attached screen0.png). The Panel bar has expandable buttons, which 
> upon expansion display different interfaces for manipulating the 
> atomic structures.
>
> The whole thing is implemented using a MVC approach using a QTreeView 
> and an overloaded QItemDelegate class used for handling painting of 
> the buttons, sizeHints, etc. The widget interfaces however, are 
> displayed by setting setIndexWidget() on the tree view.
>
> This works fine if the widgets have a fixed size. However if the 
> atomic structure changes (molecule to crystal), previously hidden GUI 
> elements may be shown in the widget, which gives rise to a compressed 
> (bad) layout since the index widget has a fixed size (screen1.png).
>
> The only way I could fix this was to use an idle time, that keeps 
> triggering the emission of the signal
>
> sizeHintChanged(const QModelIndex & index)
>
> from the delegate. This immediately triggers a smooth update of the 
> index widget resulting in screen2.png. From a user perspective it 
> works fine, but to me it appears somewhat hacky. Is there eg. a way to 
> monitor layout changes in visible index widgets?
>
> Best regards,
>
> Mads
>
> -- 
> +-----------------------------------------------------+
> | Mads Ipsen                                          |
> +----------------------+------------------------------+
> | Gåsebæksvej 7, 4. tv |                              |
> | DK-2500 Valby        | phone:          +45-29716388 |
> | Denmark              | email:mads.ipsen at gmail.com  <mailto:mads.ipsen at gmail.com>  |
> +----------------------+------------------------------+
>   
>
>
>
> -- 
>
> Detlev Offenbach
>
> detlev at die-offenbachs.de
>


-- 
+-----------------------------------------------------+
| Mads Ipsen                                          |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen at gmail.com |
+----------------------+------------------------------+

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130131/b601ca9f/attachment.html>


More information about the PyQt mailing list