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