void CSVSettings::RangeView::updateView (bool signalUpdate) const { QString value; if (!selectedValues().isEmpty()) value = selectedValues().at(0); switch (mRangeType) { case CSMSettings::Type_SpinBox: static_cast <SpinBox *> (mRangeWidget)->setValue (value); break; case CSMSettings::Type_DoubleSpinBox: static_cast <QDoubleSpinBox *> (mRangeWidget)->setValue (value.toDouble()); break; case CSMSettings::Type_Slider: case CSMSettings::Type_Dial: mRangeWidget->setProperty ("value", value.toInt()); mRangeWidget->setProperty ("sliderPosition", value.toInt()); break; default: break; } View::updateView (signalUpdate); }
int CSVSettings::View::currentIndex () const { if (selectedValues().isEmpty()) return -1; QString currentValue = selectedValues().at(0); for (int i = 0; i < mDataModel->rowCount(); i++) if (value(i) == currentValue) return i; return -1; }
std::unique_ptr<ElDistVector> UnitCoarsening::interpolate( const std::unique_ptr<ElDistVector> & values ) { std::unique_ptr<ElDistVector> selectedValues( new ElDistVector( values->Grid() ) ); selectedValues->AlignWith( *values ); El::Zeros( *selectedValues, selectedPositions.size(), values->Width() ); selectData( values, selectedValues ); return rbf.interpolate( selectedValues ); }
void CSVSettings::TextView::updateView(bool signalUpdate) const { QString values = selectedValues().join (mDelimiter); if (isEquivalent (widgetText(), values)) return; setWidgetText (values); View::updateView (signalUpdate); }
void CSVSettings::ListView::updateView (bool signalUpdate) const { QStringList values = selectedValues(); if (mComboBox) { int idx = -1; if (values.size() > 0) idx = (mComboBox->findText(values.at(0))); mComboBox->setCurrentIndex (idx); } View::updateView (signalUpdate); }
void CSVSettings::View::setSelectedValues (const QStringList &list, bool doViewUpdate, bool signalUpdate) const { QItemSelection selection; if (stringListsMatch (list, selectedValues())) return; if (!mHasFixedValues) { QStandardItemModel *model = static_cast <QStandardItemModel *>(mDataModel); model->clear(); model->appendColumn (toStandardItemList (list)); for (int i = 0; i < model->rowCount(); i++) { QModelIndex idx = model->index(i, 0); selection.append (QItemSelectionRange (idx, idx)); } } else { for (int i = 0; i < mDataModel->rowCount(); i++) { if (list.contains(value(i))) { QModelIndex idx = mDataModel->index(i, 0); selection.append(QItemSelectionRange (idx, idx)); } } } select (selection); //update the view if the selection was set from the model side, not by the //user if (doViewUpdate) updateView (signalUpdate); }
void CSVSettings::View::updateView (bool signalUpdate) const { if (signalUpdate) emit viewUpdated(viewKey(), selectedValues()); }