コード例 #1
0
ファイル: minefield.cpp プロジェクト: opieproject/opie
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;
}
コード例 #2
0
ファイル: artgraficosdb.cpp プロジェクト: trifolio6/Bulmages
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
}