void ChooseColorDialog::apply() { CurveList curveList = _store->getObjects<Curve>(); for (CurveList::iterator curve_iter = curveList.begin(); curve_iter != curveList.end(); ++curve_iter) { VectorPtr vector; CurvePtr curve = kst_cast<Curve>(*curve_iter); if (_xVector->isChecked()) { vector = curve->xVector(); } else { vector = curve->yVector(); } if (DataVectorPtr dataVector = kst_cast<DataVector>(vector)) { curve->writeLock(); curve->setColor(getColorForFile(dataVector->filename())); curve->registerChange(); curve->unlock(); } } // Store the selected colors in the corresponding datasource objects QMutableMapIterator<DataSourcePtr, QColor> itDatasource(_dataSourceColors); QListIterator<ColorButton*> itColorButton(_colorButtons); DataSourcePtr ds; while (itDatasource.hasNext()) { ds = itDatasource.next().key(); ds->setColor(itColorButton.next()->color()); // Per construction there should always be as many color buttons as datasources } updateColorGroup(); // This will update the _dataSourceColors map UpdateManager::self()->doUpdates(true); kstApp->mainWindow()->document()->setChanged(true); }
bool VScalar::checkValidity(const DataSourcePtr& ds) const { if (ds) { ds->readLock(); bool rc = ds->vector().isValid(_field); ds->unlock(); return rc; } return false; }
bool DataString::_checkValidity(const DataSourcePtr ds) const { if (ds) { ds->readLock(); bool rc = ds->string().isValid(_dp->_field); ds->unlock(); return rc; } return false; }
bool DataMatrix::checkValidity(const DataSourcePtr& ds) const { if (ds) { ds->readLock(); bool rc = ds->matrix().isValid(_field); ds->unlock(); return rc; } return false; }