[9dd61b1] | 1 | #include "stackvariablesexogenas.h" |
---|
| 2 | #include <QDebug> |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | stackVariablesExogenas::stackVariablesExogenas(QStringList Lista,QStringList Componentes,QList<int> inicio, |
---|
| 6 | QList<int> fin,QWidget *parent,int contar) : |
---|
| 7 | QWidget(parent) |
---|
| 8 | { |
---|
| 9 | layoutMain = new QHBoxLayout; |
---|
| 10 | |
---|
| 11 | comboAccount = new QComboBox(this); |
---|
| 12 | |
---|
| 13 | stackedWidget = new QStackedWidget(this); |
---|
| 14 | |
---|
| 15 | QStringList nuevosComponentes; |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | for (int i = 0;i < contar; ++i) |
---|
| 19 | { |
---|
| 20 | comboAccount->addItem(QString(Lista[i])); |
---|
| 21 | |
---|
| 22 | comboAccount->setObjectName(QString("CuentaExogena %1").arg(i + 1)); |
---|
| 23 | |
---|
| 24 | nuevosComponentes = generarComponentes(Componentes,inicio[i],fin[i]); |
---|
| 25 | |
---|
| 26 | veWidget = new VariableExogenaWidget(i,nuevosComponentes,stackedWidget); |
---|
| 27 | |
---|
| 28 | stackedWidget->addWidget(veWidget); |
---|
| 29 | |
---|
| 30 | widgetList.append(veWidget); |
---|
| 31 | |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | //Aqui se agrega el apartado para todas las cuentas |
---|
| 35 | comboAccount->addItem("Todas las Cuentas"); |
---|
| 36 | comboAccount->setObjectName(QString("CuentaExogenaFinal")); |
---|
| 37 | nuevosComponentes.clear(); |
---|
| 38 | VariableExogenaWidget * widget = new VariableExogenaWidget(contar,nuevosComponentes,stackedWidget); |
---|
| 39 | widget->accounListWidget->setVisible(false); |
---|
| 40 | stackedWidget->addWidget(widget); |
---|
| 41 | widgetList.append(widget); |
---|
| 42 | |
---|
| 43 | layoutMain->addWidget(comboAccount); |
---|
| 44 | layoutMain->addWidget(stackedWidget); |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | setLayout(layoutMain); |
---|
| 48 | |
---|
| 49 | connect(comboAccount, SIGNAL(activated(int)), |
---|
| 50 | stackedWidget, SLOT(setCurrentIndex(int))); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | QStringList stackVariablesExogenas::generarComponentes(QStringList Componentes, int inicio, int fin) |
---|
| 54 | { |
---|
| 55 | QStringList mylista; |
---|
| 56 | inicio-=3; |
---|
| 57 | fin-=3; |
---|
| 58 | for(int i=inicio;i<=fin;i++) |
---|
| 59 | { |
---|
| 60 | mylista.append(Componentes[i]); |
---|
| 61 | } |
---|
| 62 | return mylista; |
---|
| 63 | } |
---|