PDA

View Full Version : A simple chess GUI



Havard
15th October 2006, 17:21
Hi.

I am just starting out learning QT, and really loving it! I have a few very basic questions about using QImage to create a simple chess GUI.

Say I have a picture of a chess board, and of all the pieces. I now need to somehow define the board as a kind of "background" so that when I move the images of the pieces around on the board, it does not destroy the board-picture. What is the "best" way of doing this in QT? (thinking of semi-fast way of showing, moving and taking away the images of the pieces on top of the board).

I have looked at QImage and Qpixmap, and have learned that QImage is best suited to load the images of the pieces (and transform them to fit the board's squares), and that Qpixmap probably is my choice for displaying them, but I am a bit stuck on what way is best to add, take away and move them on top of the board?

Thank you!

Havard

Brandybuck
15th October 2006, 18:47
This sounds like a job for QGraphicsView. This is new in Qt 4.2.0. Check it out.

Havard
15th October 2006, 20:10
Thank you Brandybuck, I will.

Any suggestions as how to do it with 4.1.4 as well?

Havard

jacek
15th October 2006, 20:25
Any suggestions as how to do it with 4.1.4 as well?
Maybe QTableView with custom delegate and model?