source: mmcs/formloadmatrix.C @ e62517a

Last change on this file since e62517a was e62517a, checked in by rudmanmrrod <rudman22@…>, 8 years ago

Migrado el proyecto a la versión 5 de Qt, agregado primer boceto del PDF

  • Property mode set to 100755
File size: 1.6 KB
Line 
1/*
2    realizado por José Ruiz en Mayo de 2015
3*/
4#include "formloadmatrix.H"
5#include "ui_formLoadMatrix.h"
6
7void FormLoadMatrix::closeEvent(QCloseEvent *)
8{
9    emit formClosed();
10}
11
12FormLoadMatrix::FormLoadMatrix(QWidget * parent)
13    : QWidget(parent, Qt::Tool),
14      ui(new Ui::FormLoadMatrix)
15{
16    ui->setupUi(this);
17    int x = parent->pos().x() + parent->width()/2 - this->width()/2;
18    int y = parent->pos().y() + parent->height()/2 - this->height()/2;
19    this->move(x, y);
20
21    connect(ui->buttonSearch, SIGNAL(clicked()),this,SLOT(slotLoadMatrixFile()));
22    connect(ui->buttonCancel, SIGNAL(clicked()),this,SLOT(close()));
23    connect(ui->buttonOpen, SIGNAL(clicked()), this,
24            SLOT(slotButtonAcceptClicked()));
25
26}
27
28void FormLoadMatrix::slotLoadMatrixFile() {
29    QString filename = QFileDialog::getOpenFileName(this,
30            "Seleccione archivo de Matriz", QDir::homePath(),"*.csv");
31
32    if(filename.isEmpty()) return;
33    ui->editFilePath->setText(filename);
34}
35
36void FormLoadMatrix::slotButtonAcceptClicked()
37{
38    if (ui->editFilePath->text().isEmpty())
39    {
40        QMessageBox::critical(this, "Faltan datos",
41                              "Debe seleccionar un archivo");
42
43        ui->editFilePath->setFocus();
44        return;
45    }
46    else if(!ui->radioAccount->isChecked() and !ui->radioComponent->isChecked()){
47        QMessageBox::critical(this, "Faltan datos",
48                              "Debe seleccionar si cargará cuentas y componentes o sólo componentes");
49        ui->editFilePath->setFocus();
50        return;
51    }
52
53    emit formAccepted(ui->editFilePath->text(), ui->spinNumber->value(),ui->spinBox->value());
54
55    close();
56}
Note: See TracBrowser for help on using the repository browser.