是否选中该枚棋子。pt为输入参数; row, col为输出参数
| 163 | |
| 164 | //是否选中该枚棋子。pt为输入参数; row, col为输出参数 |
| 165 | bool ChessBoard::isChecked(QPointF pt, int &row, int &col) |
| 166 | { |
| 167 | for (row = 0; row <= 9; row++) { |
| 168 | for (col = 0; col <= 8; col++) { |
| 169 | QPointF temp = center(row, col); |
| 170 | qreal dx = temp.x() - pt.x(); // 使用 qreal |
| 171 | qreal dy = temp.y() - pt.y(); // 使用 qreal |
| 172 | if (dx * dx + dy * dy < m_nR * m_nR) { |
| 173 | return true; |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | //象棋的棋盘的坐标转换成界面坐标 |
nothing calls this directly
no outgoing calls
no test coverage detected