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. Can't decide how to best utilize QGraphicsView's API

Can't decide how to best utilize QGraphicsView's API

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 315 Views
  • 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.
  • oPryzeLPO Offline
    oPryzeLPO Offline
    oPryzeLP
    wrote on last edited by oPryzeLP
    #1

    Hello,
    I've been struggling to understand the best way to execute my task... Any guidance from someone experienced would be much appreciated!

    In my software, I plan to have a 512x512 QGraphicsView object which displays a birds eye view of a Minecraft map (like actual terrain). This map is separated into squares (called chunks), each chunk contains information about that section of the map (as well as a little picture of the unique terrain). At default zoom, 64x64 chunks are shown. The scene can be zoomed in to as close as 2x2 chunks.

    The user will be able to click and drag around the map, each time loading in the new sections of the map.

    So here's my idea for accomplishing this:

    At first, I figured I should have 1 QGraphicsItem that redraws 1 QPixmap of the map (Always 512x512 pixels in size). And every time the item is dragged, the QPixmap should be redrawn and repositioned back to the center to give the illusion of continuous movement. (And using some logic we can only redraw the new chunks).

    This makes sense to me, however, I recently came across a forum post where @wysota said that redrawing a QPixmap instead of utilizing QGraphicsView's ability to handle many items is a waste of the technology (paraphrasing). Which made me question whether my approach with the drawing/repositioning of a single QPixmap would be inferior to simple having an individual QGraphicsItem for each chunk.

    My main concern is performance and memory usage. The maps can be potentially infinite, so I'm unsure the best route to take.

    Thanks so much for your time!

    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