void Frequencies::on_frequencyTable_itemSelectionChanged() { QList<QTableWidgetItem*> selection(m_configurator.frequencyTable->selectedItems()); if (selection.isEmpty()) return; Layer::Mode* mode = QVariantPointer<Layer::Mode>::toPointer( selection.first()->data(Qt::UserRole)); if (mode) { m_frequencies.setActiveMode(*mode); m_frequencies.setPlay(); } if (!m_configurator.impulseButton->isChecked()) return; int index(selection.first()->row()); QCPGraph* graph(m_customPlot->graph(index)); if (graph && graph->selected()) return; QList<QCPGraph*> selectedGraphs(m_customPlot->selectedGraphs()); QList<QCPGraph*>::iterator iter; for (iter = selectedGraphs.begin(); iter != selectedGraphs.end(); ++iter) { (*iter)->setSelected(false); } if (graph) { graph->setSelected(true); m_customPlot->replot(); } }
void Nmr::on_shieldingsTable_itemSelectionChanged() { QList<QTableWidgetItem*> selection(m_ui->shieldingsTable->selectedItems()); //qDebug() << "on_shieldingsTable_itemSelectionChanged called with slection" // << selection.size(); if (selection.isEmpty()) return; int row(selection.last()->row()); // First find the name of the graph QString name; QMap<int, QList<int> >::iterator iter; for (iter = m_graphToRows.begin(); iter != m_graphToRows.end(); ++iter) { if (iter.value().contains(row)) { //qDebug() << "row selected" << row << "found in" << iter.key(); //qDebug() << "Selected rows: " << iter.value(); selectAtoms(iter.value()); name = QString::number(iter.key()); break; } } if (!m_ui->impulseButton->isChecked()) return; if (name.isEmpty()) return; // now find the graph int index; for (index = 0; index < m_plot->graphCount(); ++index) { if (m_plot->graph(index)->name() == name) break; } if (index == m_plot->graphCount()) return; QCPGraph* graph(m_plot->graph(index)); if (graph && graph->selected()) return; QList<QCPGraph*> selectedGraphs(m_plot->selectedGraphs()); QList<QCPGraph*>::iterator it; for (it = selectedGraphs.begin(); it != selectedGraphs.end(); ++it) { (*it)->setSelected(false); } if (graph) graph->setSelected(true); m_plot->replot(); }
void ExcitedStates::on_energyTable_itemSelectionChanged() { if (!m_configurator.impulseButton->isChecked()) return; QList<QTableWidgetItem*> selection = m_configurator.energyTable->selectedItems(); if (selection.isEmpty()) return; int index(selection.first()->row()); QCPGraph* graph(m_spectrum->graph(index)); if (graph && graph->selected()) return; QList<QCPGraph*> selectedGraphs(m_spectrum->selectedGraphs()); QList<QCPGraph*>::iterator iter; for (iter = selectedGraphs.begin(); iter != selectedGraphs.end(); ++iter) { (*iter)->setSelected(false); } if (graph) { graph->setSelected(true); m_spectrum->replot(); } updateMoPlot(index); }