[9dd61b1] | 1 | #include "stackvariablesexogenas.h" |
---|
| 2 | |
---|
| 3 | stackVariablesExogenas::stackVariablesExogenas(QStringList Lista,QStringList Componentes,QList<int> inicio, |
---|
| 4 | QList<int> fin,QWidget *parent,int contar) : |
---|
| 5 | QWidget(parent) |
---|
| 6 | { |
---|
| 7 | layoutMain = new QHBoxLayout; |
---|
| 8 | |
---|
| 9 | comboAccount = new QComboBox(this); |
---|
| 10 | |
---|
| 11 | stackedWidget = new QStackedWidget(this); |
---|
| 12 | |
---|
| 13 | QStringList nuevosComponentes; |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | for (int i = 0;i < contar; ++i) |
---|
| 17 | { |
---|
| 18 | comboAccount->addItem(QString(Lista[i])); |
---|
| 19 | |
---|
| 20 | comboAccount->setObjectName(QString("CuentaExogena %1").arg(i + 1)); |
---|
| 21 | |
---|
| 22 | nuevosComponentes = generarComponentes(Componentes,inicio[i],fin[i]); |
---|
| 23 | |
---|
| 24 | veWidget = new VariableExogenaWidget(i,nuevosComponentes,stackedWidget); |
---|
| 25 | |
---|
| 26 | stackedWidget->addWidget(veWidget); |
---|
| 27 | |
---|
| 28 | widgetList.append(veWidget); |
---|
| 29 | |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | layoutMain->addWidget(comboAccount); |
---|
| 33 | layoutMain->addWidget(stackedWidget); |
---|
| 34 | |
---|
| 35 | setLayout(layoutMain); |
---|
| 36 | |
---|
| 37 | connect(comboAccount, SIGNAL(activated(int)), |
---|
| 38 | stackedWidget, SLOT(setCurrentIndex(int))); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | QStringList stackVariablesExogenas::generarComponentes(QStringList Componentes, int inicio, int fin) |
---|
| 42 | { |
---|
| 43 | QStringList mylista; |
---|
| 44 | inicio-=3; |
---|
| 45 | fin-=3; |
---|
| 46 | for(int i=inicio;i<=fin;i++) |
---|
| 47 | { |
---|
| 48 | mylista.append(Componentes[i]); |
---|
| 49 | } |
---|
| 50 | return mylista; |
---|
| 51 | } |
---|