[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"); |
---|
[26] | 14 | wparam->setFixedSize(350,300); |
---|
| 15 | wparam->move(628,370); |
---|
[21] | 16 | |
---|
| 17 | QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 18 | QLabel *lx = new QLabel(); |
---|
| 19 | lx->setText("position x : "); |
---|
| 20 | positionX = new QLineEdit(); |
---|
| 21 | positionX->setText(""); |
---|
| 22 | bpos->addWidget(lx); |
---|
| 23 | bpos->addWidget(positionX); |
---|
| 24 | |
---|
| 25 | QBoxLayout *bpos2 = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 26 | QLabel *ly = new QLabel(); |
---|
| 27 | ly->setText("position y : "); |
---|
| 28 | positionY = new QLineEdit(); |
---|
| 29 | positionY->setText(""); |
---|
| 30 | bpos2->addWidget(ly); |
---|
| 31 | bpos2->addWidget(positionY); |
---|
| 32 | |
---|
| 33 | QBoxLayout *bsize = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 34 | QLabel *sx = new QLabel(); |
---|
| 35 | sx->setText("size x : "); |
---|
| 36 | sizeX = new QLineEdit(); |
---|
| 37 | sizeX->setText(""); |
---|
| 38 | bsize->addWidget(sx); |
---|
| 39 | bsize->addWidget(sizeX); |
---|
| 40 | |
---|
| 41 | QBoxLayout *bsize2 = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 42 | QLabel *sy = new QLabel(); |
---|
| 43 | sy->setText("size y : "); |
---|
| 44 | sizeY = new QLineEdit(); |
---|
| 45 | sizeY->setText(""); |
---|
| 46 | bsize2->addWidget(sy); |
---|
| 47 | bsize2->addWidget(sizeY); |
---|
| 48 | parameters->addLayout(bpos); |
---|
| 49 | parameters->addLayout(bpos2); |
---|
| 50 | parameters->addLayout(bsize); |
---|
| 51 | parameters->addLayout(bsize2); |
---|
[26] | 52 | QPushButton *noselect = new QPushButton("cancel selection",wparam); |
---|
[21] | 53 | QPushButton *back = new QPushButton("back",wparam); |
---|
| 54 | QPushButton *apply = new QPushButton("apply",wparam); |
---|
| 55 | connect(back,SIGNAL(clicked()),this,SLOT(_back())); |
---|
[26] | 56 | connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection())); |
---|
| 57 | connect(apply,SIGNAL(clicked()),this,SLOT(_apply())); |
---|
| 58 | |
---|
| 59 | parameters->addWidget(noselect); |
---|
[21] | 60 | parameters->addWidget(back); |
---|
| 61 | parameters->addWidget(apply); |
---|
| 62 | |
---|
[20] | 63 | wparam->setLayout(parameters); |
---|
| 64 | wparam->show(); |
---|
| 65 | } |
---|
| 66 | |
---|
[21] | 67 | void Window::write_position(int x, int y){ |
---|
| 68 | stringstream out; |
---|
| 69 | string str; |
---|
| 70 | out << x; |
---|
| 71 | str = out.str(); |
---|
| 72 | positionX->setText( QString::fromStdString(str)); |
---|
| 73 | stringstream out2; |
---|
| 74 | string str2; |
---|
| 75 | out2 << y; |
---|
| 76 | str2 = out2.str(); |
---|
| 77 | positionY->setText(QString::fromStdString(str2)); |
---|
| 78 | } |
---|
[20] | 79 | |
---|
[26] | 80 | void Window::erase_position(){ |
---|
| 81 | positionX->setText(""); |
---|
| 82 | positionY->setText(""); |
---|
| 83 | } |
---|
| 84 | |
---|
[21] | 85 | void Window::write_size(int x,int y){ |
---|
| 86 | stringstream out; |
---|
| 87 | string str; |
---|
| 88 | out << x; |
---|
| 89 | str = out.str(); |
---|
| 90 | sizeX->setText(QString::fromStdString(str)); |
---|
| 91 | stringstream out2; |
---|
| 92 | string str2; |
---|
| 93 | out2 << y; |
---|
| 94 | str2 = out2.str(); |
---|
| 95 | sizeY->setText(QString::fromStdString(str2)); |
---|
| 96 | } |
---|
| 97 | |
---|
[26] | 98 | void Window::erase_size(){ |
---|
| 99 | sizeX->setText(""); |
---|
| 100 | sizeY->setText(""); |
---|
[21] | 101 | } |
---|
| 102 | |
---|
[26] | 103 | void Window::_cancel_selection(){ |
---|
| 104 | component_clicked = false; |
---|
| 105 | } |
---|
[21] | 106 | |
---|
[26] | 107 | void Window::_apply(){ |
---|
| 108 | if(positionX->isModified()) |
---|
| 109 | cout << "positionX modified : " << positionX->text().toStdString() << endl; |
---|
| 110 | if(positionY->isModified()) |
---|
| 111 | cout << "positionY modified : " << positionX->text().toStdString() << endl; |
---|
| 112 | if(sizeX->isModified()) |
---|
| 113 | cout << "sizeX modified : " << sizeX->text().toStdString() << endl; |
---|
| 114 | if(sizeY->isModified()) |
---|
| 115 | cout << "sizeY modified : " << sizeY->text().toStdString() << endl; |
---|
| 116 | } |
---|