Back to index

salome-med  6.5.0
Public Slots | Public Member Functions | Protected Member Functions | Private Attributes
MEDGUISelectComponents Class Reference

#include <MEDGUISelectComponents.h>

List of all members.

Public Slots

void fillSelection ()

Public Member Functions

 MEDGUISelectComponents (ParaMEDMEM::MEDCalculatorBrowserLiteStruct &, QWidget *parent=0, int fieldInd=-1)
 ~MEDGUISelectComponents ()

Protected Member Functions

void changeEvent (QEvent *e)

Private Attributes

Ui::MEDGUISelectComponents * ui
ParaMEDMEM::MEDCalculatorBrowserLiteStruct * ls
int fieldInd

Detailed Description

Definition at line 46 of file MEDGUISelectComponents.h.


Constructor & Destructor Documentation

MEDGUISelectComponents::MEDGUISelectComponents ( ParaMEDMEM::MEDCalculatorBrowserLiteStruct &  l,
QWidget *  parent = 0,
int  fieldInd = -1 
)

Definition at line 48 of file MEDGUISelectComponents.cxx.

                                                                                                                   :
  QDialog(parent),
  ui(new Ui::MEDGUISelectComponents),
  ls(&l),
  fieldInd(fi)
{
  ui->setupUi(this);

  connect(ui->buttonBox,SIGNAL(rejected()),this,SLOT(close()));// close without applying
  connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(fillSelection()));//  apply
  connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(close()));//  close

  int min,max;
  fieldInd!=-1?min=fieldInd:min=0;
  fieldInd!=-1?max=fieldInd:max=(int)ls->getNumberOfFields()-1;

  QLabel *filename = new QLabel(ls->getName().c_str(),this);
  ui->verticalLayout_2->insertWidget(0,filename);

  for (int i = max; i >= min; i -= 1)
    {

      QGridLayout *fieldLayout = new QGridLayout(this);

      QLabel *fieldname = new QLabel(ls->getField(i).getName().c_str(),this);
      fieldLayout->addWidget(fieldname,0,0,1,0);


      for (int j = ls->getField(i).getComponentsSize()-1; j >= 0; j -= 1)
        {
          QCheckBox *cb = new QCheckBox(this);
          if(ls->getField(i).getSelectedComponents()[j]){
            cb->setCheckState(Qt::Checked);
          }

          std::string compname ="";
          if(ls->getField(i).getComponents()[j] != std::string("-noname-")) compname = ls->getField(i).getComponents()[j];

          QLineEdit *le = new QLineEdit(compname.c_str(),this);

          std::ostringstream chName, leName;
          chName << ls->getName().c_str() << ls->getField(i).getName().c_str() << j << "chkbox";
          leName << ls->getName().c_str() << ls->getField(i).getName().c_str() << j << "namebox";

          cb->setObjectName(QString(chName.str().c_str()));
          le->setObjectName(QString(leName.str().c_str()));
          cb->setAccessibleName(QString(chName.str().c_str()));
          le->setAccessibleName(QString(leName.str().c_str()));

          fieldLayout->addWidget(cb,j+1,0);
          fieldLayout->addWidget(le,j+1,1);
        }

      ui->verticalLayout_2->insertLayout(1,fieldLayout);

    }
}

Here is the call graph for this function:

Definition at line 107 of file MEDGUISelectComponents.cxx.

{
  delete ui;
}

Member Function Documentation

void MEDGUISelectComponents::changeEvent ( QEvent *  e) [protected]

Definition at line 113 of file MEDGUISelectComponents.cxx.

{
  QDialog::changeEvent(e);
  switch (e->type()) {
  case QEvent::LanguageChange:
    ui->retranslateUi(this);
    break;
  default:
    break;
  }
}

Definition at line 128 of file MEDGUISelectComponents.cxx.

{
  int min,max;
  fieldInd!=-1?min=fieldInd:min=0;
  fieldInd!=-1?max=fieldInd:max=(int)ls->getNumberOfFields()-1;

  for (int i = max; i >= min; i -= 1) {

    for (unsigned int j = 0; j < ls->getField(i).getComponentsSize(); j += 1)
      {
        std::ostringstream chName, leName;
        chName << ls->getName().c_str() << ls->getField(i).getName().c_str() << j << "chkbox";
        leName << ls->getName().c_str() << ls->getField(i).getName().c_str() << j << "namebox";

        QCheckBox *cb = this->findChild<QCheckBox*>(QString(chName.str().c_str()));
        QLineEdit *le = this->findChild<QLineEdit*>(QString(leName.str().c_str()));

        if (cb->isChecked())
          {
            ls->getField(i).selectComponent(j);
          }else{
          ls->getField(i).unselectComponent(j);
        }
        ls->getField(i).setComponentName(j,le->text().toStdString());
      }
  }
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 62 of file MEDGUISelectComponents.h.

ParaMEDMEM::MEDCalculatorBrowserLiteStruct* MEDGUISelectComponents::ls [private]

Definition at line 61 of file MEDGUISelectComponents.h.

Ui::MEDGUISelectComponents* MEDGUISelectComponents::ui [private]

Definition at line 60 of file MEDGUISelectComponents.h.


The documentation for this class was generated from the following files: