[Qt-interest] GraphicsView standard practices?

Thomas Fjellstrom tfjellstrom at shaw.ca
Sun Jan 17 10:09:14 CET 2010


I've been working on a game, and the client happens to use the GraphicsView 
pretty heavily (and will use it for pretty much ALL of the ui in a future 
version), and so far its lead to a bit of a mess on my part.

Basically is structured like so:

MainWindow (QMainWindow)
 - handles a lot of core logic, talks to the game server
   through a special "Client" object
 - contains a list of connected users as a dock window
 - contains a tab widget containing an irc like chat interface

MainWidget (QGraphicsView)
 - contains the game board (GameBoard, clever eh?)
 - contains a couple themed AnimatedDialog's (QGraphicsWidgets)
   - LoginDialog, RegisterDialog (more to come later)

GameBoard (QGraphicsWidget)
 - contains a number of GameBoardSquare's (QGraphicsWidgets)

The real problem is that a lot of the game logic is split between MainWindow 
(as it has access to the Client, which handles the actual network protocol, 
and the connection to the server), and the GameBoard (because its the board, 
and knows its own state).

Right now there's a lot of signals and method calls flying through 
MainWidget so MainWindow and GameBoard can talk to each other.

What would be the best way to organize something like this?

-- 
Thomas Fjellstrom
tfjellstrom at shaw.ca



More information about the Qt-interest-old mailing list