/// Set the same tie to all parameters.
/// @param tie :: A tie string.
void EditLocalParameterDialog::setTieAll(QString tie) {
  for (int i = 0; i < m_ties.size(); ++i) {
    m_ties[i] = tie;
    m_fixes[i] = false;
    updateRoleColumn(i);
  }
  redrawCells();
}
/// Fix/unfix all parameters.
/// @param fix :: Fix (true) or unfix (false).
void EditLocalParameterDialog::setAllFixed(bool fix) {
  if (m_fixes.empty())
    return;
  for (int i = 0; i < m_fixes.size(); ++i) {
    m_fixes[i] = fix;
    m_ties[i] = "";
    updateRoleColumn(i);
  }
  redrawCells();
}
/// Set value to log value
/// @param i :: [input] Index of parameter to set
void EditLocalParameterDialog::setValueToLog(int i) {
  assert(i < m_values.size());
  const auto *multifit = static_cast<MultiDatasetFit *>(this->parent());
  assert(multifit);

  const auto &logName = m_uiForm.logValueSelector->getLog();
  const auto &function = m_uiForm.logValueSelector->getFunction();

  double value = std::numeric_limits<double>::quiet_NaN();
  try {
    value = multifit->getLogValue(logName, function, i);
  } catch (const std::invalid_argument &err) {
    const auto &message =
        QString("Failed to get log value:\n\n %1").arg(err.what());
    multifit->logWarning(message.toStdString());
    QMessageBox::critical(this, "MantidPlot - Error", message);
  }
  m_values[i] = value;
  m_uiForm.tableWidget->item(i, valueColumn)->setText(makeNumber(value));
  updateRoleColumn(i);
}
/// Set a new tie for a parameter
/// @param index :: Index of a paramter to tie.
/// @param tie :: A tie string.
void EditLocalParameterDialog::setTie(int index, QString tie) {
  m_ties[index] = tie;
  m_fixes[index] = false;
  updateRoleColumn(index);
}