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 | //Aqui se agrega el apartado para todas las cuentas |
---|
33 | comboAccount->addItem("Todas las Cuentas"); |
---|
34 | comboAccount->setObjectName(QString("CuentaExogenaFinal")); |
---|
35 | nuevosComponentes.clear(); |
---|
36 | VariableExogenaWidget * widget = new VariableExogenaWidget(contar,nuevosComponentes,stackedWidget); |
---|
37 | widget->accounListWidget->setVisible(false); |
---|
38 | stackedWidget->addWidget(widget); |
---|
39 | widgetList.append(widget); |
---|
40 | |
---|
41 | layoutMain->addWidget(comboAccount); |
---|
42 | layoutMain->addWidget(stackedWidget); |
---|
43 | |
---|
44 | |
---|
45 | setLayout(layoutMain); |
---|
46 | |
---|
47 | connect(comboAccount, SIGNAL(activated(int)), |
---|
48 | stackedWidget, SLOT(setCurrentIndex(int))); |
---|
49 | } |
---|
50 | |
---|
51 | QStringList stackVariablesExogenas::generarComponentes(QStringList Componentes, int inicio, int fin) |
---|
52 | { |
---|
53 | QStringList mylista; |
---|
54 | inicio-=3; |
---|
55 | fin-=3; |
---|
56 | for(int i=inicio;i<=fin;i++) |
---|
57 | { |
---|
58 | mylista.append(Componentes[i]); |
---|
59 | } |
---|
60 | return mylista; |
---|
61 | } |
---|