Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Tiling with QGraphicsItems

Tiling with QGraphicsItems

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brazz
    wrote on last edited by brazz
    #1

    When a QGraphicsItem is not being displayed (there is no exposed rect) does the GraphicsItem take up ram? I am trying to implement tiling into a program that could have as man as 500 250X250 tiles, while the tiles themselves could also get scaled larger or smaller. If I were to add all of the tiles/graphicsItems to the scene, would Qt take care of most of the rendering? So when an items coordinates are displayed in the QGraphicsView window it will paint/render the tile, and if it is not displayed in the QGraphicsView window the prorgam automatically clears up memory. I saw mention of one system where the only items ever being painted are what is in the exposed rect of the QgraphicsItem. As performance effective and impressive as this is, I don't think I'll have the time to program a system such as this. It would involve writing a new class that inherits QGraphicsItem and redefining all the virtual functions to go along with it.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Yes, the actual QGraphicsItems will take up memory once created.
      The culling part only makes it not draw, its not deallocated.

      Did you see the 40.000 items sample?
      http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html

      Did you try with the needed amount of tiles ?
      Is performance or memory usage an issue?
      Before design the best solution, you should test a bit first to see what is needed memory wise etc.

      1 Reply Last reply
      1
      • B Offline
        B Offline
        brazz
        wrote on last edited by
        #3

        the problem is is that I have very limited development time, so I almost need to choose a method and make it work in whatever way is possible.

        mrjjM 1 Reply Last reply
        0
        • B brazz

          the problem is is that I have very limited development time, so I almost need to choose a method and make it work in whatever way is possible.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @brazz
          Then just go for it.
          Might need a tons of RAM but should work fine otherwise.

          Alternatively use a tiling engine
          https://github.com/jsykes/million-tile-engine
          if you are making a game kind of app.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved