FunctionForm::FunctionForm(QString fileName): QDialog() { //variable à initialiser a zero au début indexFilePH=0; indexFile=0; indexDirec=0; indexFileNotExisting=0; //permet d'avoir le chemin pathTab =fileName; //première fenêtre //combobox choix = new QComboBox; for (int i=0; i<(int)ConnectionSettings::tabFunction.size();i++ ){ choix->addItem(ConnectionSettings::tabFunction[i]->getNameFunction()); } //boutons Yes = new QPushButton("&Yes"); Cancel = new QPushButton("&Cancel"); buttonLayout = new QHBoxLayout; buttonLayout->addWidget(Yes); buttonLayout->addWidget(Cancel); totalLayout = new QVBoxLayout; totalLayout->addWidget(choix); totalLayout->addLayout(buttonLayout); connect(Yes, SIGNAL(clicked()), this, SLOT(openConnectionForm())); connect(Cancel, SIGNAL(clicked()), this, SLOT(quit())); //ajout du scroll widget = new QWidget; widget->setLayout(totalLayout); area = new QScrollArea; area->setWidget(widget); area->setWidgetResizable(true); layoutTotal = new QVBoxLayout; layoutTotal->addWidget(area); setLayout(layoutTotal); setWindowTitle("Function Form"); setModal(true); resize(600,200); }
FunctionForm::FunctionForm(QString fileName): QDialog() { indexFilePH=0; indexFile=0; indexDirec=0; pathTab =fileName; choix = new QComboBox; for (int i=0; i<(int)ConnectionSettings::tabFunction.size();i++ ){ choix->addItem(ConnectionSettings::tabFunction[i]->getNameFunction()); } Yes = new QPushButton("&Yes"); Cancel = new QPushButton("&Cancel"); buttonLayout = new QHBoxLayout; buttonLayout->addWidget(Yes); buttonLayout->addWidget(Cancel); totalLayout = new QVBoxLayout; totalLayout->addWidget(choix); totalLayout->addLayout(buttonLayout); connect(Yes, SIGNAL(clicked()), this, SLOT(openConnectionForm())); connect(Cancel, SIGNAL(clicked()), this, SLOT(quit())); //ajout du scroll widget = new QWidget; widget->setLayout(totalLayout); area = new QScrollArea; area->setWidget(widget); area->setWidgetResizable(true); layoutTotal = new QVBoxLayout; layoutTotal->addWidget(area); setLayout(layoutTotal); setWindowTitle("Function Form"); setModal(true); resize(600,200); }
//slot appelé en cliquant sur le bouton back //fonction de retour à la fenêtre de choix d'une function void FunctionForm::fctBack(){ //destructeur for(int i=tabGroupBox.size(); i>0; i--){ tabLineEdit[i-1]->~QWidget(); tabQFormLayout[i-1]->~QFormLayout(); tabQcheckBox[i-1]->~QCheckBox(); for(int j=tabButtonFilePH.size(); j>0; j--){ tabButtonFilePH[j-1]->~QPushButton(); tabButtonFilePH.pop_back(); } for(int j=tabButtonFile.size(); j>0; j--){ tabButtonFile[j-1]->~QPushButton(); tabButtonFile.pop_back(); } for(int j=tabButtonDirec.size(); j>0; j--){ tabButtonDirec[j-1]->~QPushButton(); tabButtonDirec.pop_back(); } for(int j=tabButtonFileNotExisting.size(); j>0; j--){ tabButtonFileNotExisting[j-1]->~QPushButton(); tabButtonFileNotExisting.pop_back(); } tabQHBox[i-1]->~QHBoxLayout(); tabGroupBox[i-1]->~QGroupBox(); tabLineEdit.pop_back(); tabQFormLayout.pop_back(); tabQcheckBox.pop_back(); tabQHBox.pop_back(); tabGroupBox.pop_back(); } indexFilePH=0; indexFile=0; indexDirec=0; indexFileNotExisting=0; Ok->~QPushButton(); back->~QPushButton(); buttonLayout2->~QHBoxLayout(); resize(600,200); //re-build the former window choix = new QComboBox; for (int i=0; i<(int)ConnectionSettings::tabFunction.size();i++ ){ choix->addItem(ConnectionSettings::tabFunction[i]->getNameFunction()); } Yes = new QPushButton("&Yes"); Cancel = new QPushButton("&Cancel"); buttonLayout = new QHBoxLayout; buttonLayout->addWidget(Yes); buttonLayout->addWidget(Cancel); totalLayout->addWidget(choix); totalLayout->addLayout(buttonLayout); connect(Yes, SIGNAL(clicked()), this, SLOT(openConnectionForm())); connect(Cancel, SIGNAL(clicked()), this, SLOT(quit())); }