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); }
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->dp()->filename())); curve->registerChange(); curve->unlock(); } } updateColorGroup(); UpdateManager::self()->doUpdates(true); kstApp->mainWindow()->document()->setChanged(true); }
void ChooseColorDialog::show() { updateColorGroup(); QDialog::show(); }