象棋的棋盘的坐标转换成界面坐标
| 180 | |
| 181 | //象棋的棋盘的坐标转换成界面坐标 |
| 182 | QPointF ChessBoard::center(int row, int col) |
| 183 | { |
| 184 | const int displayRow = m_bReverseView ? (9 - row) : row; |
| 185 | const int displayCol = m_bReverseView ? (8 - col) : col; |
| 186 | QPointF rePoint; |
| 187 | //这里注意坐标的转换 |
| 188 | rePoint.setY(displayRow * m_nD + m_nOffSet); // 使用 setY |
| 189 | rePoint.setX(displayCol * m_nD + m_nOffSet); // 使用 setX |
| 190 | |
| 191 | return rePoint; |
| 192 | } |
| 193 | |
| 194 | //重载:坐标转换 |
| 195 | QPointF ChessBoard::center(int id) |
nothing calls this directly
no outgoing calls
no test coverage detected