source: mmcs/formloadmatrix.C @ 9dd61b1

matrices
Last change on this file since 9dd61b1 was 9dd61b1, checked in by rboet <rboet@…>, 9 years ago

Avance del proyecto 60%

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#include "formloadmatrix.H"
2#include "ui_formLoadMatrix.h"
3
4void FormLoadMatrix::closeEvent(QCloseEvent *)
5{
6    emit formClosed();
7}
8
9FormLoadMatrix::FormLoadMatrix(QWidget * parent)
10    : QWidget(parent, Qt::Tool)
11{
12    ui.setupUi(this);
13
14    int x = parent->pos().x() + parent->width()/2 - this->width()/2;
15    int y = parent->pos().y() + parent->height()/2 - this->height()/2;
16    this->move(x, y);
17
18    ui.editYear->setValidator(new QIntValidator);
19    connect(ui.buttonSearch, SIGNAL(clicked()),this,SLOT(slotLoadMatrixFile()));
20    connect(ui.buttonCancel, SIGNAL(clicked()),this,SLOT(close()));
21    connect(ui.buttonOpen, SIGNAL(clicked()), this,
22            SLOT(slotButtonAcceptClicked()));
23
24}
25
26void FormLoadMatrix::slotLoadMatrixFile() {
27    QString filename = QFileDialog::getOpenFileName(this,
28            "Seleccione archivo de Matriz", QDir::homePath(),"*.csv");
29
30    if(filename.isEmpty()) return;
31    ui.editFilePath->setText(filename);
32}
33
34void FormLoadMatrix::slotButtonAcceptClicked()
35{
36    if (ui.editFilePath->text().isEmpty())
37    {
38        QMessageBox::critical(this, "Faltan datos",
39                              "Debe seleccionar un archivo");
40
41        ui.editFilePath->setFocus();
42        return;
43    }
44
45    emit formAccepted(ui.editFilePath->text(), ui.spinNumber->value(),
46                      ui.comboSeparator->currentText().toStdString()[0]);
47
48    close();
49}
Note: See TracBrowser for help on using the repository browser.