Z
Z
zheleznyak_oleg2012-05-12 22:18:46
Qt
zheleznyak_oleg, 2012-05-12 22:18:46

Widget for the game "Life" on Qt?

I decided to write an implementation of the game "Life" in C ++ using Qt. Which widget can be used as a field? If you draw manually, you will have to determine which cell was clicked by the cursor coordinates, this is inconvenient.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mezomish, 2012-05-13
@Mezomish

What's inconvenient?

void mousePressEvent( QMouseEvent* e ) {
    int row = e->pos().y() / CellSize;
    int column = e->pos().x() / CellSize;

    // do whatever you want

}

W
Wo1f, 2012-05-12
@Wo1f

QGraphicsScene. And look at the examples of tic-tac-toe)

S
smashrod, 2012-06-07
@smashrod

I made a turn of the model and the delegate, in the examples there is how to draw drawings in circles in the table, here the life modeler turns out to be beautiful)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question