SpikeStream Application Library
0.2
|
00001 //SpikeStream includes 00002 #include "TruthTableDialog.h" 00003 #include "TruthTableView.h" 00004 using namespace spikestream; 00005 00006 //Qt includes 00007 #include <QDebug> 00008 #include <QLayout> 00009 #include <QPushButton> 00010 00011 00013 TruthTableDialog::TruthTableDialog(QWidget* parent) : QDialog(parent) { 00014 QVBoxLayout *mainVBox = new QVBoxLayout(this); 00015 00016 //Create model and add view 00017 truthTableModel = new TruthTableModel(); 00018 QTableView* truthTableView = new TruthTableView(truthTableModel); 00019 truthTableView->setMinimumSize(600, 300); 00020 mainVBox->addWidget(truthTableView); 00021 00022 //Add buttons 00023 QHBoxLayout* buttonBox = new QHBoxLayout(); 00024 QPushButton* okPushButton = new QPushButton("Ok"); 00025 buttonBox->addWidget(okPushButton); 00026 QPushButton* cancelPushButton = new QPushButton("Cancel"); 00027 buttonBox->addWidget(cancelPushButton); 00028 mainVBox->addLayout(buttonBox); 00029 00030 connect (okPushButton, SIGNAL(clicked()), this, SLOT(okButtonPressed())); 00031 connect (cancelPushButton, SIGNAL(clicked()), this, SLOT(cancelButtonPressed())); 00032 } 00033 00034 00036 TruthTableDialog::~TruthTableDialog(){ 00037 } 00038 00039 00040 /*----------------------------------------------------------*/ 00041 /*----- PUBLIC METHODS -----*/ 00042 /*----------------------------------------------------------*/ 00043 00045 void TruthTableDialog::show(unsigned int neuronID){ 00046 this->setWindowTitle("Truth Table for Neuron " + QString::number(neuronID)); 00047 truthTableModel->setNeuronID(neuronID); 00048 this->setVisible(true); 00049 } 00050 00051 00052 /*----------------------------------------------------------*/ 00053 /*----- PRIVATE SLOTS -----*/ 00054 /*----------------------------------------------------------*/ 00055 00057 void TruthTableDialog::cancelButtonPressed(){ 00058 this->hide(); 00059 } 00060 00061 00063 void TruthTableDialog::okButtonPressed(){ 00064 this->hide(); 00065 } 00066