Qt World Summit: Register Today!

Multiple GrapchicsViews or one GraphicsView with widget proxies

  • In my app I want to have both graphics items and widgets, but the layout of the items and widget requires me to either have everything in one graphics view and use proxies for the widgets or use multiple graphics views.

    What would be more lightweight, use two or three QGraphicsViews (with maximum a hand-full of items) and the rest of the UI with Widgets, or use one QGraphicsView with graphics items and widget proxies.

    Typical widgets will be LIst/Treeviews, stack widget and tab bar.

    Typical graphics items will be clickable images with effects

  • since a QGraphicsscene (which handles all the item stuff etc) can have several QGraphicViews I would choose to have several Views. The data is only stored once in the scene which is the same for all views. The Scene will then display the same data in every view (if they have the same scale/scenerect etc)

  • Ok, so what you're saying is that I could use one graphics scene with all graphics items added and then have multiple graphics views showing different part of the scene and mix the views with traditional widget by using layouts (QWidget-based layouts), right?

    Sound good.

  • I think better to use one GraphicsView. Maybe it will be slightly more expensive, but it will give a lot of flexibility in feature.

  • also do refer to the chips demo src that ships with Qt, a very neat example

Log in to reply