void DialogRect::on_spinBoxY_valueChanged(int i) { if (m_controlSquare) { m_rect->setY(translateFromSpinValue(i)); if (translateToSpinValue(m_rect->height()) == getOne()) { m_rect->setHeight(translateFromSpinValue(getTwo())); ui->spinBoxHeight->setValue(getTwo()); } else ui->spinBoxHeight->setValue(translateToSpinValue(m_rect->height())); } else { m_rect->setY(i); m_rect->setHeight(ui->spinBoxHeight->value()); } updateValues(); }
void DialogRect::on_spinBoxX_valueChanged(int i) { if (m_controlSquare) { m_rect->setX(translateFromSpinValue(i)); if (translateToSpinValue(m_rect->width()) == getOne()) { m_rect->setWidth(translateFromSpinValue(getTwo())); ui->spinBoxWidth->setValue(getTwo()); } else ui->spinBoxWidth->setValue(translateToSpinValue(m_rect->width())); } else { m_rect->setX(i); m_rect->setWidth(ui->spinBoxWidth->value()); } updateValues(); }
sf::Vector2i getCellPositionFromScreenPosition(int x, int y) { return sf::Vector2i(getOne(Constants::BOARD_X, x), getOne(Constants::BOARD_Y, y)); }
int getOne(char *buf,const char *col_name) { return getOne(buf,getTemplate(col_name)); }