0

I want to display multiple QML Files on a QWidget. Because every Display should be an unique Object/Widget, I plan to use for every display an own QGraphicsView with an unique QGraphicsScene. These views can be added to a layout witch will be placed on a widget.

So I will have about 50-100 QGraphicsScenes and GraphicsViews.

I want to set a background for the Displays which will not be updated when you repaint the object. That is why I want to use an own scene for each display.

Is this recommended or should I use only one GraphicsScene in a project?

László Papp
  • 51,870
  • 39
  • 111
  • 135
pck
  • 203
  • 2
  • 10

1 Answers1

0

It's not good idea, 50-100 scenes is not optimal. Why not drawing all QML files in same QML View ? Using Loader foreach file.

gbdivers
  • 1,147
  • 9
  • 9
  • Thanks for your answer. What exactly do you mean with loader? That I have a small QML File where I load the others into that? But how can i solve so the problem, that not the whole display should always beeing repainted? – pck Sep 26 '13 at 18:26
  • I talk about Loader item (http://qt-project.org/doc/qt-4.8/qml-loader.html). Or you can use model with list of your filename and Grid/Repeater. Let's QGraphicsView doing it's job and draw only if necessary. – gbdivers Sep 26 '13 at 18:39
  • I want to change the Text on the displays every 10ms. So I have to draw very often. Am I right that you want to load all displays into one QML File and display that in one QGraphicsView? The problem is, that I want to add, remove, resize and position each display at runtime. I think I can't do this, if they are in a QML-Grid!? – pck Sep 26 '13 at 18:50
  • QGraphicsView optimize rendering (not well as Qt Quick 2...) for update only what is necessary. It's not better for performance to use severals scenes. For add, remove, resize, etc. you can do it well in QML (but indeed without grid) – gbdivers Sep 26 '13 at 19:01
  • Ok, thank you so far. I have one last question: I know how to resize the objects (with propertys), but how should I add and remove them if they are all loaded in one qml file? The only idea I have, is to load each display as a QGraphicsObject, place them on a QGraphicsScene and handle them in eg. a vector. – pck Sep 26 '13 at 19:13
  • Why you want to returns to C++ ? You can load directly QML files with Loader (or Instantiator) and use active property for add/remove each file – gbdivers Sep 28 '13 at 11:58