void MineField::contentsMousePressEvent( QMouseEvent* e ) { int c = e->pos().x() / cellSize; int r = e->pos().y() / cellSize; if ( onBoard( r, c ) ) cellPressed( r, c ); else currCol = currRow = -1; }
void BtLabel::mousePressEvent ( QMouseEvent * e ) { if (e->button() == Qt::LeftButton) { int cellwidth = g_confpr->value(CONF_TPV_CELL_WIDTH ).toInt(); /// Evitamos un posible SegFault por division por 0. if (cellwidth == 0) cellwidth = 1; // blMsgInfo(QString::number(e->x())); emit (cellPressed(e->x() / cellwidth, e->y() / cellwidth)); e->accept(); }// end if }