-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddconnection.cpp
More file actions
31 lines (28 loc) · 845 Bytes
/
addconnection.cpp
File metadata and controls
31 lines (28 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "addconnection.h"
#include "ui_addconnection.h"
AddConnection::AddConnection(QWidget *parent) :
QWidget(parent),
ui(new Ui::AddConnection)
{
ui->setupUi(this);
connect(ui->pushButton,SIGNAL(clicked(bool)),this,SLOT(onApplyClicked()));
}
AddConnection::~AddConnection()
{
delete ui;
}
void AddConnection::update(QObject * sender){
if(sender!=this){
this->source=Engine::getInstance()->getGraph();
ui->first->clear();
ui->second->clear();
for(int i=0;i<source->getVerticesNumber();i++){
ui->first->addItem(QString::number(i+1));
ui->second->addItem(QString::number(i+1));
}
}
}
void AddConnection::onApplyClicked(){
source->connectVertices(ui->first->currentText().toInt()-1,ui->second->currentText().toInt()-1);
emit changed(this);
}