Changeset 04999c9 in mmcs for mainwindow.C
- Timestamp:
- Sep 23, 2015, 10:55:02 AM (9 years ago)
- Branches:
- master, matrices
- Children:
- 07b8f66
- Parents:
- cfbc36f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mainwindow.C
rcfbc36f r04999c9 19 19 void MainWindow::slotNuevoProyecto() 20 20 { 21 MainWindow *mw = new MainWindow; 22 mw->show(); 21 QMessageBox msBox(QMessageBox::Question,"Nuevo Proyecto","¿Desea crar un nuevo proyecto?", 22 QMessageBox::Yes | QMessageBox::No,this); 23 msBox.setButtonText(QMessageBox::Yes,"&Si"); 24 msBox.setDefaultButton(QMessageBox::Yes); 25 if(msBox.exec()==QMessageBox::Yes) 26 { 27 MainWindow *mw = new MainWindow; 28 mw->show(); 29 } 23 30 } 24 31 … … 281 288 282 289 PHNoClasico.addMenu(&PHNoClasicoIncidencia); 283 284 290 Modelos.addMenu(&PHNoClasico); 291 292 PreciosNH.setTitle("Precios No Homogéneos"); 293 PreciosNH.setDisabled(true); 294 295 actionPNHIncidencia100.setText("(&1) Incidencia 100%"); 296 actionPNHIncidencia100.setDisabled(true); 297 298 PreciosNH.addAction(&actionPNHIncidencia100); 299 300 PreciosNHIncidencia.setTitle("(&2) Incidencia i%"); 301 PreciosNHIncidencia.setDisabled(true); 302 303 actionPNHIncidenciaCuenta.setText("Por cue&nta"); 304 actionPNHIncidenciaCuenta.setDisabled(true); 305 PreciosNHIncidencia.addAction(&actionPNHIncidenciaCuenta); 306 307 actionPNHIncidenciaComponente.setText("Por co&mponente"); 308 actionPHNCIncidenciaComponente.setDisabled(true); 309 PreciosNHIncidencia.addAction(&actionPNHIncidenciaComponente); 310 311 PreciosNH.addMenu(&PreciosNHIncidencia); 312 Modelos.addMenu(&PreciosNH); 285 313 286 314 OpMatrices.addMenu(&Modelos); … … 294 322 actionCompararResultados(this), actionModeloNoClasico(this),actionCompararResultadosMNC(this),actionPHClasicoIncidencia100(this), 295 323 actionPHCIncidenciaCuenta(this),actionPHCIncidenciaComponente(this),actionPHNoClasicoIncidencia100(this),actionPHNCIncidenciaCuenta(this), 296 actionPHNCIncidenciaComponente(this),formLoadMatrix(0) 324 actionPHNCIncidenciaComponente(this),actionPNHIncidencia100(this),actionPNHIncidenciaCuenta(this),actionPNHIncidenciaComponente(this), 325 formLoadMatrix(0) 297 326 { 298 327 tabWidget = new QTabWidget; … … 313 342 opcionMAT = 0; 314 343 opcionMBT = 0; 344 opcionPNHT = 1; 345 opcionFormPNH = 0; 315 346 /* Estas variables permiten tener el control de los procedimientos que se pueden generar multiples ventanas */ 316 347 cantidadEncadenamientos = 1; … … 323 354 cantidadPHNCindidenciaiCuenta = 1; 324 355 cantidadPHNCindidenciaiComponente = 1; 356 cantidadPNHincidencia100 = 1; 357 cantidadPNHincidenciaiCuenta = 1; 358 cantidadPNHincidenciaiComponente = 1; 325 359 326 360 initGUI(); … … 1217 1251 actionPHNCIncidenciaComponente.setEnabled(true); 1218 1252 connect(&actionPHNCIncidenciaComponente,SIGNAL(triggered()),this,SLOT(slotPHNCIncidenciaiComponente())); 1253 //Se activa la opcion para los modelos de precios no homogéneos 1254 PreciosNH.setEnabled(true); 1255 actionPNHIncidencia100.setEnabled(true); 1256 connect(&actionPNHIncidencia100,SIGNAL(triggered()),this,SLOT(slotPNHIncudencia100())); 1257 PreciosNHIncidencia.setEnabled(true); 1258 actionPNHIncidenciaCuenta.setEnabled(true); 1259 connect(&actionPNHIncidenciaCuenta,SIGNAL(triggered()),this,SLOT(slotPNHIncidenciaiCuenta())); 1260 actionPNHIncidenciaComponente.setEnabled(true); 1261 connect(&actionPNHIncidenciaComponente,SIGNAL(triggered()),this,SLOT(slotPNHIncidenciaiComponente())); 1219 1262 1220 1263 tabWidget->setCurrentIndex(indice); … … 3982 4025 } 3983 4026 4027 /* Funcion para calcular la incidencia "i" en los precios homogéneos clásico (cuenta) */ 3984 4028 void MainWindow::calcularPHCIncidenciaI(QTableWidget *tw,QMap<QString,double> inci) 3985 4029 { … … 4057 4101 } 4058 4102 4103 /* Funcion para calcular la incidencia "i" en los precios homogéneos clásico (componente) */ 4059 4104 void MainWindow::calcularPHCIncidenciaIComponente(QTableWidget *tw,QTableWidget *ot) 4060 4105 { … … 4160 4205 QTableWidget *MatrizMi = new QTableWidget; 4161 4206 MatrizMi->setObjectName("PHNC100"); 4162 calcularPHN Incidencia100(MatrizMi);4207 calcularPHNCIncidencia100(MatrizMi); 4163 4208 4164 4209 tabWidget->addTab(new QWidget,"PHNC100"); … … 4173 4218 } 4174 4219 4175 void MainWindow::calcularPHNIncidencia100(QTableWidget *tw) 4220 /* Funcion para calcular la incidencia "i" en los precios homogéneos no clásico (cuenta)*/ 4221 void MainWindow::calcularPHNCIncidencia100(QTableWidget *tw) 4176 4222 { 4177 4223 QTableWidget *Mbt = findChild<QTableWidget *>("MatrizMbT"); … … 4272 4318 QTableWidget *MatrizIC = new QTableWidget; 4273 4319 MatrizIC->setObjectName(QString("PHNCIcuenta %1").arg(cantidadPHNCindidenciaiCuenta)); 4274 calcularPHN Incidencia100(MatrizIC);4320 calcularPHNCIncidencia100(MatrizIC); 4275 4321 calcularPHCIncidenciaI(MatrizIC,cantidades); 4276 4322 … … 4321 4367 QTableWidget *MatrizIComp = new QTableWidget; 4322 4368 MatrizIComp->setObjectName(QString("PHNCIcomponente %1").arg(cantidadPHNCindidenciaiComponente)); 4323 calcularPHN Incidencia100(MatrizIComp);4369 calcularPHNCIncidencia100(MatrizIComp); 4324 4370 calcularPHCIncidenciaIComponente(MatrizIComp,tw); 4325 4371 … … 4334 4380 cantidadPHNCindidenciaiComponente++; 4335 4381 } 4382 4383 void MainWindow::slotPNHIncudencia100() 4384 { 4385 if(opcionFormPNH==0) 4386 { 4387 crearFormularioPNH(); 4388 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4389 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNH())); 4390 formPreciosNoHomogeneos->show(); 4391 } 4392 else 4393 { 4394 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4395 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHi())); 4396 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHic())); 4397 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNH())); 4398 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNH())); 4399 formPreciosNoHomogeneos->show(); 4400 } 4401 } 4402 4403 void MainWindow::slotCloseformPNH() 4404 { 4405 formPreciosNoHomogeneos->close(); 4406 } 4407 4408 void MainWindow::slotSelectPNH() 4409 { 4410 int cantidad=stackPNH->comboAccount->count(); 4411 int seleccionados = 0; 4412 for(int i = 0;i<cantidad;i++) 4413 { 4414 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4415 seleccionados += lw->selectedItems().count(); 4416 } 4417 if(seleccionados>1) 4418 { 4419 QMessageBox::warning(this,"Alerta","Debe seleccionar sólo\nun componente"); 4420 } 4421 else if(seleccionados<1) 4422 { 4423 QMessageBox::warning(this,"Alerta","Debe seleccionar un componente"); 4424 } 4425 else 4426 { 4427 QStringList componentes; 4428 for(int i = 0;i<cantidad;i++) 4429 { 4430 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4431 if(lw->selectedItems().count()!=0) 4432 { 4433 componentes.append(lw->selectedItems().value(0)->text()); 4434 } 4435 } 4436 QString componente = componentes.at(0); 4437 QVector<double> Send; 4438 calcularVectorSend(componente,Send); 4439 QTableWidget *PNH100 = new QTableWidget; 4440 opcionPNHT = 0; 4441 multiplicarMatricesPNH(PNH100,Send); 4442 formPreciosNoHomogeneos->close(); 4443 } 4444 } 4445 4446 /* Funcion para calcular el vector Send, que se utiliza para crear una matriz identidad con una diagonal conformada 4447 por los valores de un componente previamente seleccionado */ 4448 void MainWindow::calcularVectorSend(QString componente,QVector<double> &vector) 4449 { 4450 if(opcionMa == 0) 4451 { 4452 slotMa(); 4453 } 4454 if(opcionMb == 0) 4455 { 4456 calcularMb(); 4457 } 4458 QTableWidget *Bn = findChild<QTableWidget *>("Bn"); 4459 int filas = Bn->rowCount(); 4460 int columnas = Bn->columnCount(); 4461 for(int i=2;i<filas;i++) 4462 { 4463 if(Bn->item(i,1)->text()==componente) 4464 { 4465 for(int j=2;j<columnas;j++) 4466 { 4467 QString value = Separador(Bn->item(i,j),true); 4468 vector.append(value.toDouble()); 4469 } 4470 break; 4471 } 4472 } 4473 } 4474 4475 void MainWindow::multiplicarMatricesPNH(QTableWidget *tw,QVector<double> vector) 4476 { 4477 int count = MatrixMa.rows(); 4478 MatrixXd ident = MatrixXd::Identity(count,count); 4479 for(int i = 0;i<count;i++) 4480 { 4481 for(int j = 0;j<count;j++) 4482 { 4483 if(i==j) 4484 { 4485 ident(i,j) = vector.at(i); 4486 } 4487 } 4488 } 4489 MatrixXd res = ident*MatrixMa; 4490 /*for(int i = 0;i<count;i++) 4491 { 4492 for(int j = 0;j<count;j++) 4493 { 4494 double value = res(i,j); 4495 QString valor = QString::number(value,'f',precission); 4496 QTableWidgetItem *item = new QTableWidgetItem(valor); 4497 valor = Separador(item,false); 4498 item->setText(valor); 4499 item->setFlags(item->flags() ^ Qt::ItemIsEditable); 4500 item->setTextAlignment(Qt::AlignCenter); 4501 tw->setItem(i,j,item); 4502 } 4503 } 4504 tabWidget->addTab(new QWidget,"PNHMa"); 4505 int indice=ObtenerIndice("PNHMa"); 4506 4507 QHBoxLayout * layoutCentralWidget = new QHBoxLayout; 4508 layoutCentralWidget->addWidget(tw); 4509 QWidget *widget = tabWidget->widget(indice); 4510 widget->setLayout(layoutCentralWidget); 4511 tabWidget->setCurrentIndex(indice);*/ 4512 4513 MatrixXd trans = res.transpose(); 4514 /*QTableWidget *nt = new QTableWidget; 4515 CrearTablaVacia(count+1,nt); 4516 for(int i = 0;i<count;i++) 4517 { 4518 for(int j = 0;j<count;j++) 4519 { 4520 double value = trans(i,j); 4521 QString valor = QString::number(value,'f',precission); 4522 QTableWidgetItem *item = new QTableWidgetItem(valor); 4523 valor = Separador(item,false); 4524 item->setText(valor); 4525 item->setFlags(item->flags() ^ Qt::ItemIsEditable); 4526 item->setTextAlignment(Qt::AlignCenter); 4527 nt->setItem(i,j,item); 4528 } 4529 } 4530 tabWidget->addTab(new QWidget,"PNHMa^T"); 4531 indice=ObtenerIndice("PNHMa^T"); 4532 QHBoxLayout * layoutCentralWidget2 = new QHBoxLayout; 4533 layoutCentralWidget2->addWidget(nt); 4534 QWidget *widget2 = tabWidget->widget(indice); 4535 widget2->setLayout(layoutCentralWidget2); 4536 tabWidget->setCurrentIndex(indice);*/ 4537 4538 calcularPNHIncidencia100(tw,trans); 4539 if(opcionPNHT == 0) 4540 { 4541 tabWidget->addTab(new QWidget,QString("PNH100 %1").arg(cantidadPNHincidencia100)); 4542 int indice=ObtenerIndice(QString("PNH100 %1").arg(cantidadPNHincidencia100)); 4543 QHBoxLayout * layoutCentralWidget3 = new QHBoxLayout; 4544 layoutCentralWidget3->addWidget(tw); 4545 QWidget *widget3 = tabWidget->widget(indice); 4546 widget3->setLayout(layoutCentralWidget3); 4547 tabWidget->setCurrentIndex(indice); 4548 cantidadPNHincidencia100++; 4549 opcionPNHT = 1; 4550 } 4551 } 4552 4553 void MainWindow::calcularPNHIncidencia100(QTableWidget *tw,MatrixXd Diagonal) 4554 { 4555 int count = Vpond.count(); 4556 MatrixXd Res(count,count); 4557 for(int i=0;i<count;i++) 4558 { 4559 for(int j=0;j<count;j++) 4560 { 4561 Res(i,j)=Diagonal(i,j) * Vpond.at(i); 4562 } 4563 } 4564 CrearTablaVacia(count+1,tw); 4565 for(int i=0;i<count;i++) 4566 { 4567 for(int j=0;j<count;j++) 4568 { 4569 double value = Res(i,j); 4570 QString valor = QString::number(value,'f',precission); 4571 QTableWidgetItem *item = new QTableWidgetItem(valor); 4572 valor = Separador(item,false); 4573 item->setText(valor); 4574 item->setFlags(item->flags() ^ Qt::ItemIsEditable); 4575 item->setTextAlignment(Qt::AlignCenter); 4576 tw->setItem(i,j,item); 4577 } 4578 } 4579 titleEndogena(tw); 4580 spanEndogenaCell(tw,2,0,false); 4581 } 4582 4583 void MainWindow::slotPNHIncidenciaiCuenta() 4584 { 4585 if(opcionFormPNH==0) 4586 { 4587 crearFormularioPNH(); 4588 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4589 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHi())); 4590 } 4591 else 4592 { 4593 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4594 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNH())); 4595 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHic())); 4596 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHi())); 4597 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHi())); 4598 formPreciosNoHomogeneos->show(); 4599 } 4600 4601 } 4602 4603 void MainWindow::slotSelectPNHi() 4604 { 4605 int cantidad=stackPNH->comboAccount->count(); 4606 int seleccionados = 0; 4607 for(int i = 0;i<cantidad;i++) 4608 { 4609 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4610 seleccionados += lw->selectedItems().count(); 4611 } 4612 if(seleccionados>1) 4613 { 4614 QMessageBox::warning(this,"Alerta","Debe seleccionar sólo\nun componente"); 4615 } 4616 else if(seleccionados<1) 4617 { 4618 QMessageBox::warning(this,"Alerta","Debe seleccionar un componente"); 4619 } 4620 else 4621 { 4622 QStringList componentes; 4623 for(int i = 0;i<cantidad;i++) 4624 { 4625 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4626 if(lw->selectedItems().count()!=0) 4627 { 4628 componentes.append(lw->selectedItems().value(0)->text()); 4629 } 4630 } 4631 componentePNH = componentes.at(0); 4632 formPreciosNoHomogeneos->close(); 4633 FI = new FormIncidenciaI(this); 4634 QTableWidget *tw = FI->ui->TableIncidencia; 4635 int cuentas = totalCuentas.count(); 4636 crearTablaVaciaEncadenamiento(2,tw,cuentas); 4637 QStringList nombreCuenta = totalCuentas.keys(); 4638 for(int i=0;i<cuentas;i++) 4639 { 4640 QTableWidgetItem *titulo = new QTableWidgetItem(nombreCuenta.at(i)); 4641 titulo->setFlags(titulo->flags() ^ Qt::ItemIsEditable); 4642 titulo->setTextAlignment(Qt::AlignCenter); 4643 CellStyle(titulo); 4644 tw->setItem(0,i,titulo); 4645 QTableWidgetItem *number = new QTableWidgetItem(QString::number(0,'f',precission)); 4646 number->setTextAlignment(Qt::AlignCenter); 4647 QString item = Separador(number,false); 4648 number->setText(item); 4649 tw->setItem(1,i,number); 4650 } 4651 connect(FI->ui->CalcularIncidencia,SIGNAL(clicked()),this,SLOT(slotCalcularPNHIncidenciaiCuenta())); 4652 FI->show(); 4653 } 4654 } 4655 4656 void MainWindow::slotCalcularPNHIncidenciaiCuenta() 4657 { 4658 QVector<double> Send; 4659 calcularVectorSend(componentePNH,Send); 4660 QTableWidget *PNH100 = new QTableWidget; 4661 multiplicarMatricesPNH(PNH100,Send); 4662 int count = PNH100->rowCount(); 4663 QTableWidget *PNHI = new QTableWidget; 4664 CrearTablaVacia(count+1,PNHI); 4665 clonarTabla(PNH100,PNHI,count+1); 4666 spanEndogenaCell(PNHI,2,0,false); 4667 4668 QTableWidget *tw = FI->ui->TableIncidencia; 4669 int cuentas = totalCuentas.count(); 4670 QMap<QString,double> cantidades; 4671 for(int i=0;i<cuentas;i++) 4672 { 4673 QString cuenta = tw->item(0,i)->text(); 4674 QString value = Separador(tw->item(1,i),true); 4675 cantidades.insert(cuenta,value.toDouble()); 4676 } 4677 4678 calcularPHCIncidenciaI(PNHI,cantidades); 4679 4680 tabWidget->addTab(new QWidget,QString("PNHI %1").arg(cantidadPNHincidenciaiCuenta)); 4681 int indice=ObtenerIndice(QString("PNHI %1").arg(cantidadPNHincidenciaiCuenta)); 4682 4683 QHBoxLayout * layoutCentralWidget = new QHBoxLayout; 4684 layoutCentralWidget->addWidget(PNHI); 4685 QWidget *widget = tabWidget->widget(indice); 4686 widget->setLayout(layoutCentralWidget); 4687 tabWidget->setCurrentIndex(indice); 4688 cantidadPNHincidenciaiCuenta++; 4689 FI->close(); 4690 } 4691 4692 void MainWindow::slotPNHIncidenciaiComponente() 4693 { 4694 if(opcionFormPNH==0) 4695 { 4696 crearFormularioPNH(); 4697 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4698 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHic())); 4699 formPreciosNoHomogeneos->show(); 4700 } 4701 else 4702 { 4703 QPushButton *buttonSeleccionar = findChild<QPushButton *>("SeleccionarPNH"); 4704 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNH())); 4705 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHi())); 4706 disconnect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHic())); 4707 connect(buttonSeleccionar,SIGNAL(clicked()),this,SLOT(slotSelectPNHic())); 4708 formPreciosNoHomogeneos->show(); 4709 } 4710 } 4711 4712 void MainWindow::slotSelectPNHic() 4713 { 4714 int cantidad=stackPNH->comboAccount->count(); 4715 int seleccionados = 0; 4716 for(int i = 0;i<cantidad;i++) 4717 { 4718 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4719 seleccionados += lw->selectedItems().count(); 4720 } 4721 if(seleccionados>1) 4722 { 4723 QMessageBox::warning(this,"Alerta","Debe seleccionar sólo\nun componente"); 4724 } 4725 else if(seleccionados<1) 4726 { 4727 QMessageBox::warning(this,"Alerta","Debe seleccionar un componente"); 4728 } 4729 else 4730 { 4731 QStringList componentes; 4732 for(int i = 0;i<cantidad;i++) 4733 { 4734 QListWidget *lw = findChild<QListWidget *>(QString("accountlistPNH %1").arg(i+1)); 4735 if(lw->selectedItems().count()!=0) 4736 { 4737 componentes.append(lw->selectedItems().value(0)->text()); 4738 } 4739 } 4740 componentePNH = componentes.at(0); 4741 formPreciosNoHomogeneos->close(); 4742 FI = new FormIncidenciaI(this); 4743 QTableWidget *tw = FI->ui->TableIncidencia; 4744 int contador = ComponentesEndogenos.count(); 4745 crearTablaVaciaEncadenamiento(2,tw,contador); 4746 4747 for(int i=0;i<contador;i++) 4748 { 4749 QTableWidgetItem *titulo = new QTableWidgetItem(ComponentesEndogenos.at(i)); 4750 titulo->setFlags(titulo->flags() ^ Qt::ItemIsEditable); 4751 titulo->setTextAlignment(Qt::AlignCenter); 4752 CellStyleComponente(titulo); 4753 tw->setItem(0,i,titulo); 4754 QTableWidgetItem *number = new QTableWidgetItem(QString::number(0,'f',precission)); 4755 number->setTextAlignment(Qt::AlignCenter); 4756 QString item = Separador(number,false); 4757 number->setText(item); 4758 tw->setItem(1,i,number); 4759 } 4760 connect(FI->ui->CalcularIncidencia,SIGNAL(clicked()),this,SLOT(slotCalcularPNHIncidenciaiComponente())); 4761 FI->show(); 4762 } 4763 } 4764 4765 void MainWindow::slotCalcularPNHIncidenciaiComponente() 4766 { 4767 QVector<double> Send; 4768 calcularVectorSend(componentePNH,Send); 4769 QTableWidget *PNH100 = new QTableWidget; 4770 multiplicarMatricesPNH(PNH100,Send); 4771 int count = PNH100->rowCount(); 4772 QTableWidget *PNHIc = new QTableWidget; 4773 CrearTablaVacia(count+1,PNHIc); 4774 clonarTabla(PNH100,PNHIc,count+1); 4775 spanEndogenaCell(PNHIc,2,0,false); 4776 4777 QTableWidget *tw = FI->ui->TableIncidencia; 4778 calcularPHCIncidenciaIComponente(PNHIc,tw); 4779 4780 tabWidget->addTab(new QWidget,QString("PNHIc %1").arg(cantidadPNHincidenciaiComponente)); 4781 int indice=ObtenerIndice(QString("PNHIc %1").arg(cantidadPNHincidenciaiComponente)); 4782 4783 QHBoxLayout * layoutCentralWidget = new QHBoxLayout; 4784 layoutCentralWidget->addWidget(PNHIc); 4785 QWidget *widget = tabWidget->widget(indice); 4786 widget->setLayout(layoutCentralWidget); 4787 tabWidget->setCurrentIndex(indice); 4788 cantidadPNHincidenciaiComponente++; 4789 FI->close(); 4790 } 4791 4792 void MainWindow::crearFormularioPNH() 4793 { 4794 formPreciosNoHomogeneos = new FormPreciosNoHomogeneos(this); 4795 QHBoxLayout * layoutLateralWidget = new QHBoxLayout; 4796 QVBoxLayout * layoutCentralWidget = new QVBoxLayout; 4797 QHBoxLayout * layoutAccounts = new QHBoxLayout; 4798 QHBoxLayout * labels = new QHBoxLayout; 4799 QLabel *label1 = new QLabel; 4800 QLabel *label2 = new QLabel; 4801 label1->setText("Cuentas"); 4802 label2->setText("Componentes"); 4803 labels->addWidget(label1); 4804 labels->addWidget(label2); 4805 QWidget *nw = new QWidget; 4806 nw->setLayout(labels); 4807 QGroupBox * groupBoxAccount = new QGroupBox; 4808 layoutCentralWidget->addWidget(nw); 4809 layoutAccounts->addWidget(stackPNH=new StackPreciosNoHomogeneos(diccCuentasExogenas,groupBoxAccount)); 4810 4811 groupBoxAccount->setObjectName("PNHgroupbox");//Se le asigna nombre al objeto 4812 groupBoxAccount->setLayout(layoutAccounts);; 4813 groupBoxAccount->setStyleSheet("QGroupBox {border: 1px solid gray; " 4814 "border-radius: 3px; margin-top: 0.5em;} " 4815 "QGroupBox::title { subcontrol-origin: margin; " 4816 "left: 10px; padding: 0 3px 0 3px; } "); 4817 4818 4819 layoutLateralWidget->addWidget(groupBoxAccount); 4820 4821 /*** Se crean y personalizan los bottones para seleccionar y cancelar ***/ 4822 QPushButton * buttonSeleccionar = new QPushButton; 4823 buttonSeleccionar->setObjectName("SeleccionarPNH");//Se le asigna nombre al objeto 4824 buttonSeleccionar->setText("&Seleccionar"); 4825 buttonSeleccionar->setFixedWidth(130); 4826 buttonSeleccionar->setStyleSheet("background-color: #358ccb; color: #fff;" 4827 "font-weight: bold; height: 30px; border: none;" 4828 "border-radius: 5px; margin-top: 40px;"); 4829 QPushButton * buttonCancelar = new QPushButton; 4830 buttonCancelar->setObjectName("CancelarPNH");//Se le asigna nombre al objeto 4831 buttonCancelar->setText("&Cancelar"); 4832 buttonCancelar->setFixedWidth(130); 4833 buttonCancelar->setStyleSheet("background-color: #358ccb; color: #fff;" 4834 "font-weight: bold; height: 30px; border: none;" 4835 "border-radius: 5px; margin-top: 40px;"); 4836 4837 connect(buttonCancelar,SIGNAL(clicked()),this,SLOT(slotCloseformPNH())); 4838 4839 QHBoxLayout * layoutsButtons = new QHBoxLayout; 4840 layoutsButtons->addWidget(buttonSeleccionar); 4841 layoutsButtons->addWidget(buttonCancelar); 4842 QWidget *buttonWidget = new QWidget; 4843 buttonWidget->setLayout(layoutsButtons); 4844 4845 QWidget *widget = new QWidget; 4846 widget->setLayout(layoutLateralWidget); 4847 layoutCentralWidget->addWidget(widget); 4848 layoutCentralWidget->addWidget(buttonWidget);//Se agregan los botones 4849 formPreciosNoHomogeneos->setLayout(layoutCentralWidget); 4850 opcionFormPNH++; 4851 }
Note: See TracChangeset
for help on using the changeset viewer.