| 207 | } |
| 208 | |
| 209 | bool ChessBoard::boardTransform(QPointF& origin, qreal& side) const |
| 210 | { |
| 211 | if (!ui || !ui->label) |
| 212 | return false; |
| 213 | |
| 214 | const QPoint topLeft = ui->label->mapTo(this, QPoint(0, 0)); |
| 215 | const QSize boardSize = ui->label->size(); |
| 216 | if (boardSize.isEmpty()) |
| 217 | return false; |
| 218 | |
| 219 | const qreal width = boardSize.width(); |
| 220 | const qreal height = boardSize.height(); |
| 221 | side = qMin(width, height); |
| 222 | if (side <= 0.0) |
| 223 | return false; |
| 224 | |
| 225 | origin = QPointF(topLeft); |
| 226 | origin.rx() += (width - side) / 2.0; |
| 227 | origin.ry() += (height - side) / 2.0; |
| 228 | return true; |
| 229 | } |
| 230 | |
| 231 | void ChessBoard::paintEvent(QPaintEvent *event) |
| 232 | { |
nothing calls this directly
no outgoing calls
no test coverage detected