void GridSettingsDialog::buttonBoxClicked(QAbstractButton* button) { switch (mUi->buttonBox->buttonRole(button)) { case QDialogButtonBox::AcceptRole: // nothing to do here break; case QDialogButtonBox::ResetRole: { mCurrentGrid = GridProperties(); // update widgets mUi->rbtnGroup->blockSignals(true); mUi->cbxUnits->blockSignals(true); mUi->spbxInterval->blockSignals(true); mUi->rbtnGroup->button(static_cast<int>(mCurrentGrid.getType())) ->setChecked(true); mUi->cbxUnits->setCurrentIndex(mCurrentGrid.getUnit().getIndex()); mUi->spbxInterval->setValue( mCurrentGrid.getUnit().convertToUnit(*mCurrentGrid.getInterval())); mUi->rbtnGroup->blockSignals(false); mUi->cbxUnits->blockSignals(false); mUi->spbxInterval->blockSignals(false); updateInternalRepresentation(); break; } default: // restore initial settings mCurrentGrid = mOriginalGrid; break; } emit gridPropertiesChanged(mCurrentGrid); }
void GridSettingsDialog::cbxUnitsChanged(int index) { try { mCurrentGrid.setUnit(LengthUnit::fromIndex(index)); mUi->spbxInterval->setValue( mCurrentGrid.getUnit().convertToUnit(*mCurrentGrid.getInterval())); updateInternalRepresentation(); emit gridPropertiesChanged(mCurrentGrid); } catch (Exception& e) { QMessageBox::critical(this, tr("Error"), e.getMsg()); } }
bool MemoryOneModeNetwork::setTie(int i, int j, double newValue) { // check validity of index // if (!isIndexValid(i)) return false; // if (!isIndexValid(j)) return false; double oldValue = getTieValue(i, j); // no change at all if (oldValue == newValue) return true; // trying to set a reflexive tie in a non-reflexive network if((!_reflexive) && (i == j)) return false; // Sets tie value and updates lookup maps updateInternalRepresentation(i, j, oldValue, newValue); if (!_directed) { double oldValue = getTieValue(j,i); updateInternalRepresentation(j, i, oldValue, newValue); } return true; }