Commit 87805f48 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

position table now retains row values when adding new rows

parent bacf2ffe
Loading
Loading
Loading
Loading
+49 −49
Original line number Diff line number Diff line
@@ -1350,13 +1350,12 @@ namespace Isis {
  void JigsawSetupDialog::on_spkSolveDegreeSpinBox_valueChanged(int i) {
    // number of rows == spkSolveDegree value + 1 (i+1)
    QTableWidget *table = m_ui->positionAprioriSigmaTable;
    const int oldRowCount = table->rowCount();
    table->setRowCount(i + 1);
    const int newRowCount = table->rowCount();

    const int columnCount = table->columnCount();
    // Headers : coefficient, description, units, a priori sigma
    // The description and units are related directly to the solve options, so for now do those
    // generically (columns 1 and 2)
    for (int row = 0; row < i + 1; row++) {
    if (newRowCount > oldRowCount) {
      for (int row = oldRowCount; row < newRowCount; row++) {
        QTableWidgetItem *coefficient = new QTableWidgetItem();
        coefficient->setFlags(Qt::ItemIsEnabled);
        coefficient->setText(QString::number(row + 1));
@@ -1375,12 +1374,11 @@ namespace Isis {
        QTableWidgetItem *sigma = new QTableWidgetItem();
        sigma->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
        sigma->setText("0.0");
      table->setItem(row, columnCount - 1, sigma);
    }
        table->setItem(row, 3, sigma);

    // { NONE: N/A, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // Solve option: spk degree -> { NONE: -1, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // POSITION
    if (i + 1 > 0) { 
        if (row == 0) { 
          QTableWidgetItem *description = table->item(0, 1);
          description->setText("POSITION");

@@ -1389,7 +1387,7 @@ namespace Isis {
        }

        // VELOCITY
    if (i + 1 > 1) {
        else if (row == 1) {
          QTableWidgetItem *description = table->item(1, 1);
          description->setText("VELOCITY");

@@ -1398,13 +1396,15 @@ namespace Isis {
        }

        // ACCELERATION
    if (i + 1 > 2) {
        else if (row == 2) {
          QTableWidgetItem *description = table->item(2, 1);
          description->setText("ACCELERATION");

          QTableWidgetItem *units = table->item(2, 2);
          units->setText("m/s^2");
        }
      }
    }

    table->resizeColumnToContents(1);
    table->resizeColumnToContents(2);