SpikeStream Application Library  0.2
NeuronGroupSelectionDialog.cpp
Go to the documentation of this file.
00001 //SpikeStream includes
00002 #include "NeuronGroupSelectionDialog.h"
00003 using namespace spikestream;
00004 
00005 //SpikeStream includes
00006 #include "NeuronGroupSelectionModel.h"
00007 #include "NeuronGroupSelectionView.h"
00008 
00009 //Qt includes
00010 #include <QLayout>
00011 #include <QPushButton>
00012 #include <QScrollArea>
00013 
00014 
00016 NeuronGroupSelectionDialog::NeuronGroupSelectionDialog(Network* network, QWidget* parent) : QDialog(parent){
00017         //Set title
00018         this->setWindowTitle("Select Neuron Groups");
00019 
00020         //Vertical box to organize layout
00021         QVBoxLayout* verticalBox = new QVBoxLayout(this);
00022 
00023         //Add table view and model
00024         neurGrpSelectionModel = new NeuronGroupSelectionModel(network->getNeuronGroups());
00025         QTableView* neuronGroupSelectionView = new NeuronGroupSelectionView(this, neurGrpSelectionModel);
00026         verticalBox->addWidget(neuronGroupSelectionView);
00027 
00028         //Ok and cancel buttons
00029         QHBoxLayout* buttonLayout = new QHBoxLayout();
00030         QPushButton* cancelButton = new QPushButton("Cancel");
00031         connect (cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
00032         buttonLayout->addWidget(cancelButton);
00033         QPushButton* okButton = new QPushButton("Ok");
00034         connect (okButton, SIGNAL(clicked()), this, SLOT(accept()));
00035         buttonLayout->addWidget(okButton);
00036         verticalBox->addLayout(buttonLayout);
00037 
00038         if((100 + network->getNeuronGroupCount() * 30) < 750)
00039                 this->setMinimumSize(400, 100 + network->getNeuronGroupCount() * 30);
00040         else
00041                 this->setMinimumSize(400, 750);
00042 }
00043 
00044 
00046 NeuronGroupSelectionDialog::~NeuronGroupSelectionDialog(){
00047 }
00048 
00049 
00051 QList<NeuronGroup*> NeuronGroupSelectionDialog::getNeuronGroups(){
00052         return neurGrpSelectionModel->getSelectedNeuronGroups();
00053 }
 All Classes Files Functions Variables Typedefs Friends Defines