[20] | 1 | #include "window.h" |
---|
| 2 | |
---|
| 3 | using namespace std; |
---|
| 4 | |
---|
| 5 | using namespace morpheo::tools::viewer::parser; |
---|
| 6 | using namespace morpheo::tools::viewer::bdd; |
---|
| 7 | using namespace morpheo::tools::viewer::graphics; |
---|
| 8 | |
---|
| 9 | void Window::wparameters() |
---|
| 10 | { |
---|
| 11 | wparam = new QWidget(); |
---|
[21] | 12 | parameters = new QBoxLayout(QBoxLayout::TopToBottom,0); |
---|
[20] | 13 | wparam->setWindowTitle("parameters"); |
---|
[21] | 14 | wparam->setFixedSize(250,300); |
---|
| 15 | wparam->move(678,370); |
---|
| 16 | |
---|
| 17 | lname = new QLabel(wparam); |
---|
| 18 | lname->setText(""); |
---|
| 19 | |
---|
| 20 | QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 21 | QLabel *lx = new QLabel(); |
---|
| 22 | lx->setText("position x : "); |
---|
| 23 | positionX = new QLineEdit(); |
---|
| 24 | positionX->setText(""); |
---|
| 25 | bpos->addWidget(lx); |
---|
| 26 | bpos->addWidget(positionX); |
---|
| 27 | |
---|
| 28 | QBoxLayout *bpos2 = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 29 | QLabel *ly = new QLabel(); |
---|
| 30 | ly->setText("position y : "); |
---|
| 31 | positionY = new QLineEdit(); |
---|
| 32 | positionY->setText(""); |
---|
| 33 | bpos2->addWidget(ly); |
---|
| 34 | bpos2->addWidget(positionY); |
---|
| 35 | |
---|
| 36 | QBoxLayout *bsize = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 37 | QLabel *sx = new QLabel(); |
---|
| 38 | sx->setText("size x : "); |
---|
| 39 | sizeX = new QLineEdit(); |
---|
| 40 | sizeX->setText(""); |
---|
| 41 | bsize->addWidget(sx); |
---|
| 42 | bsize->addWidget(sizeX); |
---|
| 43 | |
---|
| 44 | QBoxLayout *bsize2 = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 45 | QLabel *sy = new QLabel(); |
---|
| 46 | sy->setText("size y : "); |
---|
| 47 | sizeY = new QLineEdit(); |
---|
| 48 | sizeY->setText(""); |
---|
| 49 | bsize2->addWidget(sy); |
---|
| 50 | bsize2->addWidget(sizeY); |
---|
| 51 | |
---|
| 52 | QBoxLayout *bport = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 53 | QLabel *lport = new QLabel(); |
---|
| 54 | lport->setText("nb ports : "); |
---|
| 55 | nb_ports = new QLineEdit(); |
---|
| 56 | nb_ports->setText(""); |
---|
| 57 | bport->addWidget(lport); |
---|
| 58 | bport->addWidget(nb_ports); |
---|
| 59 | |
---|
| 60 | parameters->addWidget(lname); |
---|
| 61 | parameters->addLayout(bpos); |
---|
| 62 | parameters->addLayout(bpos2); |
---|
| 63 | parameters->addLayout(bsize); |
---|
| 64 | parameters->addLayout(bsize2); |
---|
| 65 | parameters->addLayout(bport); |
---|
| 66 | QPushButton *back = new QPushButton("back",wparam); |
---|
| 67 | QPushButton *apply = new QPushButton("apply",wparam); |
---|
| 68 | connect(back,SIGNAL(clicked()),this,SLOT(_back())); |
---|
| 69 | parameters->addWidget(back); |
---|
| 70 | parameters->addWidget(apply); |
---|
| 71 | |
---|
[20] | 72 | wparam->setLayout(parameters); |
---|
| 73 | wparam->show(); |
---|
| 74 | } |
---|
| 75 | |
---|
[21] | 76 | void Window::write_name(string name){ |
---|
| 77 | QString n = QString::fromStdString(name); |
---|
| 78 | lname->setText(n); |
---|
| 79 | |
---|
| 80 | } |
---|
[20] | 81 | |
---|
[21] | 82 | void Window::write_position(int x, int y){ |
---|
| 83 | stringstream out; |
---|
| 84 | string str; |
---|
| 85 | out << x; |
---|
| 86 | str = out.str(); |
---|
| 87 | positionX->setText( QString::fromStdString(str)); |
---|
| 88 | stringstream out2; |
---|
| 89 | string str2; |
---|
| 90 | out2 << y; |
---|
| 91 | str2 = out2.str(); |
---|
| 92 | positionY->setText(QString::fromStdString(str2)); |
---|
| 93 | |
---|
| 94 | } |
---|
[20] | 95 | |
---|
[21] | 96 | void Window::write_size(int x,int y){ |
---|
| 97 | stringstream out; |
---|
| 98 | string str; |
---|
| 99 | out << x; |
---|
| 100 | str = out.str(); |
---|
| 101 | sizeX->setText(QString::fromStdString(str)); |
---|
| 102 | stringstream out2; |
---|
| 103 | string str2; |
---|
| 104 | out2 << y; |
---|
| 105 | str2 = out2.str(); |
---|
| 106 | sizeY->setText(QString::fromStdString(str2)); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | void Window::write_ports(int x){ |
---|
| 110 | stringstream out; |
---|
| 111 | string str; |
---|
| 112 | out << x; |
---|
| 113 | str = out.str(); |
---|
| 114 | nb_ports->setText(QString::fromStdString(str)); |
---|
| 115 | wparam->show(); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | |
---|