Answer the question
In order to leave comments, you need to log in
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
What's inconvenient?
void mousePressEvent( QMouseEvent* e ) {
int row = e->pos().y() / CellSize;
int column = e->pos().x() / CellSize;
// do whatever you want
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question