I am working on a tic tac toe program. At the moment, I am trying to make it so that you can click where you want the "x" to go. I currently have an event handler for a mouse click:
Qt Code:
  1. void QWidget::mousePressEvent ( QMouseEvent *event )
  2. {
  3. QPoint mousePos = mapFromGlobal(QCursor::pos());
  4. }
To copy to clipboard, switch view to plain text mode 

My goal now is to set up 9 different areas in the main window. I then want to determine which area received the click. What would these functions look like?
The 9 areas would fall in between the squares of the tic tac toe board. The function that draws that is here:

Qt Code:
  1. void MainWindow::paintEvent(QPaintEvent *event)
  2. {
  3. QPainter painter(this);
  4.  
  5. // Draw Tic Tac Toe Board
  6. painter.setRenderHint(QPainter::Antialiasing, true);
  7. painter.setPen(QPen(Qt::black, 10, Qt::SolidLine, Qt::RoundCap,
  8. Qt::MiterJoin));
  9. painter.drawLine(80, 20, 80, 250);
  10.  
  11. painter.setRenderHint(QPainter::Antialiasing, true);
  12. painter.setPen(QPen(Qt::black, 10, Qt::SolidLine, Qt::RoundCap,
  13. Qt::MiterJoin));
  14. painter.drawLine(170, 20, 170, 250);
  15.  
  16. painter.setRenderHint(QPainter::Antialiasing, true);
  17. painter.setPen(QPen(Qt::black, 10, Qt::SolidLine, Qt::RoundCap,
  18. Qt::MiterJoin));
  19. painter.drawLine(10, 90, 250, 90);
  20.  
  21. painter.setRenderHint(QPainter::Antialiasing, true);
  22. painter.setPen(QPen(Qt::black, 10, Qt::SolidLine, Qt::RoundCap,
  23. Qt::MiterJoin));
  24. painter.drawLine(10, 180, 250, 180);
  25. }
To copy to clipboard, switch view to plain text mode 

Thanks for the help