Ejemplo n.º 1
0
void ExcitedStates::plotSelectionChanged(bool tf)
{      
   QCPGraph* graph(qobject_cast<QCPGraph*>(sender()));
   if (!graph) return;
       
   if (tf) {
      graph->setPen(m_selectedPen);
      graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc));
   }else {
      graph->setPen(m_pen);
      graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle));
      return;
   }

   if (!tf) return;
   if (!m_configurator.impulseButton->isChecked()) return;

   bool ok;
   int row(graph->name().toInt(&ok));
   if (!ok) return;

   QTableWidget* table(m_configurator.energyTable);
   table->setCurrentCell(row, 0, 
      QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect);
   table->scrollToItem(table->item(row,0));
   updateMoPlot(row);
}
Ejemplo n.º 2
0
void ExcitedStates::on_energyTable_itemSelectionChanged()
{      
   QList<QTableWidgetItem*> selection = m_configurator.energyTable->selectedItems();
   if (selection.isEmpty()) return;

   int index(selection.first()->row());

   updateMoPlot(index);
   if (!m_configurator.impulseButton->isChecked()) return;

   int nGraphs(m_spectrum->graphCount());

   if (index < 0 || index >= nGraphs) {
      qDebug() << "Unmatched graph requested" << index;
      return;
   }

   for (int i = 0; i < nGraphs; ++i) {
       QCPGraph* graph(m_spectrum->graph(i));

       if (i == index) {
          QCPDataSelection selection(QCPDataRange(0,graph->dataCount()));
          m_spectrum->graph(i)->setSelection(selection);
       }else {
          graph->setSelection(QCPDataSelection());  // Empty selection
       }
   }

   m_spectrum->replot();
}
Ejemplo n.º 3
0
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);
}