I'm writing a Qt4 application that plays a traditional "war game." These games are played on a map that is tessellated into hexagons, instead of squares like in chess.
Now, if the game map is stored as a a huge graphic graphic image, the memory requirements are excessive. To reduce the memory usage, "tiles" are used. This exploits the fact that many of the game hexagons are identical. By analogy, if one wanted to store a chess board image, one would only have to store an image of a black square and a white square. The visible part of the chessboard could be drawn on the fly, then the playing pieces are drawn on top.
Now, topographically, a hex grid is more or less equivalent to a square grid, if alternating columns are offset downward by half a square height. The pattern resembles bricks in a brick wall.
I was going to implement the hex map display by using a graphic view with two scroll bars.
However, the though occurs to me that it might be possible to subclass a QTableView to do the same thing. One would have to alter the painting and selection functions so alternate columns were offset.
Would it make more sense to implement such a map with a QGraphicView, a QTableView, or some other widget?
Bookmarks