Version: 6.3.1
Public Member Functions | Private Slots | Private Member Functions | Private Attributes

SMESHGUI_DeleteGroupDlg Class Reference

Class : SMESHGUI_DeleteGroupDlg Description : Delete groups and their contents. More...

#include <SMESHGUI_DeleteGroupDlg.h>

Inheritance diagram for SMESHGUI_DeleteGroupDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_DeleteGroupDlg (SMESHGUI *)
 Class : SMESHGUI_DeleteGroupDlg Description : Delete groups and their contents.
virtual ~SMESHGUI_DeleteGroupDlg ()
void Init ()

Private Slots

void onOk ()
bool onApply ()
void onClose ()
void onHelp ()
void onDeactivate ()
void onSelectionDone ()

Private Member Functions

void closeEvent (QCloseEvent *)
void enterEvent (QEvent *)
void keyPressEvent (QKeyEvent *)
QWidgetcreateButtonFrame (QWidget *)
QWidgetcreateMainFrame (QWidget *)
bool isValid ()

Private Attributes

QPushButton * myOkBtn
QPushButton * myApplyBtn
QPushButton * myCloseBtn
QPushButton * myHelpBtn
QListWidget * myListBox
SMESHGUImySMESHGUI
LightApp_SelectionMgr * mySelectionMgr
QList< SMESH::SMESH_GroupBase_var > myListGrp
bool myBlockSelection
QString myHelpFileName

Detailed Description

Class : SMESHGUI_DeleteGroupDlg Description : Delete groups and their contents.

Definition at line 49 of file SMESHGUI_DeleteGroupDlg.h.


Constructor & Destructor Documentation

SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg ( SMESHGUI theModule)

Class : SMESHGUI_DeleteGroupDlg Description : Delete groups and their contents.

Definition at line 75 of file SMESHGUI_DeleteGroupDlg.cxx.

References createButtonFrame(), createMainFrame(), Init(), MARGIN, myHelpFileName, and SPACING.

                                                                    :
  QDialog(SMESH::GetDesktop(theModule)),
  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
  mySMESHGUI(theModule)
{
  setModal(false);
  setWindowTitle(tr("CAPTION"));

  QVBoxLayout* aDlgLay = new QVBoxLayout(this);
  aDlgLay->setMargin(MARGIN);
  aDlgLay->setSpacing(SPACING);

  QWidget* aMainFrame = createMainFrame  (this);
  QWidget* aBtnFrame  = createButtonFrame(this);

  aDlgLay->addWidget(aMainFrame);
  aDlgLay->addWidget(aBtnFrame);

  myHelpFileName = "deleting_groups_page.html";

  Init();
}
SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg ( ) [virtual]

Definition at line 160 of file SMESHGUI_DeleteGroupDlg.cxx.

{
}

Member Function Documentation

void SMESHGUI_DeleteGroupDlg::closeEvent ( QCloseEvent *  ) [private]

Definition at line 333 of file SMESHGUI_DeleteGroupDlg.cxx.

References onClose().

{
  onClose();
}
QWidget * SMESHGUI_DeleteGroupDlg::createButtonFrame ( QWidget theParent) [private]

Definition at line 126 of file SMESHGUI_DeleteGroupDlg.cxx.

References MARGIN, myApplyBtn, myCloseBtn, myHelpBtn, myOkBtn, onApply(), onClose(), onHelp(), onOk(), and SPACING.

Referenced by SMESHGUI_DeleteGroupDlg().

{
  QGroupBox* aFrame = new QGroupBox(theParent);

  myOkBtn     = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"),           aFrame);
  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"),           aFrame);
  myHelpBtn   = new QPushButton(tr("SMESH_BUT_HELP"),            aFrame);

  QHBoxLayout* aLay = new QHBoxLayout(aFrame);
  aLay->setMargin(MARGIN);
  aLay->setSpacing(SPACING);

  aLay->addWidget(myOkBtn);
  aLay->addSpacing(10);
  aLay->addWidget(myApplyBtn);
  aLay->addSpacing(10);
  aLay->addStretch();
  aLay->addWidget(myCloseBtn);
  aLay->addWidget(myHelpBtn);

  // connect signals and slots
  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
  connect(myHelpBtn,  SIGNAL(clicked()), SLOT(onHelp()));

  return aFrame;
}
QWidget * SMESHGUI_DeleteGroupDlg::createMainFrame ( QWidget theParent) [private]

Definition at line 102 of file SMESHGUI_DeleteGroupDlg.cxx.

References MARGIN, myListBox, and SPACING.

Referenced by SMESHGUI_DeleteGroupDlg().

{
  QGroupBox* aMainGrp =
    new QGroupBox(tr("SELECTED_GROUPS"), theParent);
  QVBoxLayout* aLay = new QVBoxLayout(aMainGrp);
  aLay->setMargin(MARGIN);
  aLay->setSpacing(SPACING);

  myListBox = new QListWidget(aMainGrp);
  myListBox->setMinimumSize(150, 100);
  myListBox->setSelectionMode(QListWidget::NoSelection);
  //myListBox->setRowMode(QListBox::FitToWidth);
  myListBox->setFlow(QListWidget::LeftToRight);
  myListBox->setWrapping(true);

  aLay->addWidget(myListBox);
  
  return aMainGrp;
}
void SMESHGUI_DeleteGroupDlg::enterEvent ( QEvent *  ) [private]

Definition at line 320 of file SMESHGUI_DeleteGroupDlg.cxx.

References SMESHGUI.EmitSignalDeactivateDialog(), SMESH.GetViewWindow(), GROUP, mySelectionMgr, and mySMESHGUI.

{
  mySMESHGUI->EmitSignalDeactivateDialog();
  setEnabled(true);
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(ActorSelection);
  mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
}
void SMESHGUI_DeleteGroupDlg::Init ( )

Definition at line 168 of file SMESHGUI_DeleteGroupDlg.cxx.

References SMESH.GetViewWindow(), GROUP, myBlockSelection, mySelectionMgr, mySMESHGUI, onClose(), onDeactivate(), onSelectionDone(), and SMESHGUI.SetActiveDialogBox().

Referenced by SMESHGUI_DeleteGroupDlg().

{
  myBlockSelection = false;
  mySMESHGUI->SetActiveDialogBox((QDialog*)this);

  // selection and SMESHGUI
  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));

  // set selection mode
  mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(ActorSelection);
  onSelectionDone();
}
bool SMESHGUI_DeleteGroupDlg::isValid ( ) [private]

Definition at line 189 of file SMESHGUI_DeleteGroupDlg.cxx.

References SMESHGUI.desktop(), SMESHGUI.isActiveStudyLocked(), myListBox, and mySMESHGUI.

Referenced by onApply().

{
  if (myListBox->count() == 0) {
    SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
                                 tr("NO_SELECTED_GROUPS"));
    return false;
  }

  return !mySMESHGUI->isActiveStudyLocked();
}
void SMESHGUI_DeleteGroupDlg::keyPressEvent ( QKeyEvent *  e) [private]

Definition at line 342 of file SMESHGUI_DeleteGroupDlg.cxx.

References onHelp().

{
  QDialog::keyPressEvent( e );
  if ( e->isAccepted() )
    return;

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    onHelp();
  }
}
bool SMESHGUI_DeleteGroupDlg::onApply ( ) [private, slot]

Definition at line 204 of file SMESHGUI_DeleteGroupDlg.cxx.

References isValid(), SMESHGUI.Modified(), myBlockSelection, myListBox, myListGrp, mySelectionMgr, mySMESHGUI, and SMESH.UpdateView().

Referenced by createButtonFrame(), and onOk().

{
  if (!isValid())
    return false;

  myBlockSelection = true;

  QList<SMESH::SMESH_GroupBase_var>::iterator anIter;
  for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) {
    SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh();
    if (!aMesh->_is_nil())
      aMesh->RemoveGroupWithContents(*anIter);
  }

  myListBox->clear();
  myListGrp.clear();
  mySelectionMgr->clearSelected();
  SMESH::UpdateView();
  SMESHGUI::Modified();
  mySMESHGUI->updateObjBrowser(true);

  myBlockSelection = false;
  return true;
}
void SMESHGUI_DeleteGroupDlg::onClose ( ) [private, slot]

Definition at line 243 of file SMESHGUI_DeleteGroupDlg.cxx.

References SMESH.GetViewWindow(), mySelectionMgr, mySMESHGUI, and SMESHGUI.ResetState().

Referenced by closeEvent(), createButtonFrame(), Init(), and onOk().

{
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
    aViewWindow->SetSelectionMode(ActorSelection);
  disconnect(mySelectionMgr, 0, this, 0);
  disconnect(mySMESHGUI, 0, this, 0);
  mySMESHGUI->ResetState();
  mySelectionMgr->clearFilters();
  reject();
}
void SMESHGUI_DeleteGroupDlg::onDeactivate ( ) [private, slot]

Definition at line 310 of file SMESHGUI_DeleteGroupDlg.cxx.

References mySelectionMgr.

Referenced by Init().

{
  mySelectionMgr->clearFilters();
  setEnabled(false);
}
void SMESHGUI_DeleteGroupDlg::onHelp ( ) [private, slot]

Definition at line 258 of file SMESHGUI_DeleteGroupDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by createButtonFrame(), and keyPressEvent().

{
  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
  if (app) 
    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
  else {
    QString platform;
#ifdef WIN32
    platform = "winapplication";
#else
    platform = "application";
#endif
    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
                                                                 platform)).
                             arg(myHelpFileName));
  }
}
void SMESHGUI_DeleteGroupDlg::onOk ( ) [private, slot]

Definition at line 233 of file SMESHGUI_DeleteGroupDlg.cxx.

References onApply(), and onClose().

Referenced by createButtonFrame().

{
  if (onApply())
    onClose();
}
void SMESHGUI_DeleteGroupDlg::onSelectionDone ( ) [private, slot]

Definition at line 282 of file SMESHGUI_DeleteGroupDlg.cxx.

References SMESH_controls.aGroup, myBlockSelection, myListBox, myListGrp, and mySelectionMgr.

Referenced by Init().

{
  if (myBlockSelection)
    return;

  myListGrp.clear();
  QStringList aNames;

  SALOME_ListIO aListIO;
  mySelectionMgr->selectedObjects(aListIO);
  SALOME_ListIteratorOfListIO anIter (aListIO);
  for ( ; anIter.More(); anIter.Next()) {
    SMESH::SMESH_GroupBase_var aGroup =
      SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
    if (!aGroup->_is_nil()) {
      aNames.append(aGroup->GetName());
      myListGrp.append(aGroup);
    }
  }

  myListBox->clear();
  myListBox->addItems(aNames);
}

Field Documentation

QPushButton* SMESHGUI_DeleteGroupDlg.myApplyBtn [private]

Definition at line 81 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by createButtonFrame().

Definition at line 90 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by Init(), onApply(), and onSelectionDone().

QPushButton* SMESHGUI_DeleteGroupDlg.myCloseBtn [private]

Definition at line 82 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by createButtonFrame().

QPushButton* SMESHGUI_DeleteGroupDlg.myHelpBtn [private]

Definition at line 83 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by createButtonFrame().

Definition at line 92 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by onHelp(), and SMESHGUI_DeleteGroupDlg().

QListWidget* SMESHGUI_DeleteGroupDlg.myListBox [private]

Definition at line 84 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by createMainFrame(), isValid(), onApply(), and onSelectionDone().

QList<SMESH::SMESH_GroupBase_var> SMESHGUI_DeleteGroupDlg.myListGrp [private]

Definition at line 89 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by onApply(), and onSelectionDone().

QPushButton* SMESHGUI_DeleteGroupDlg.myOkBtn [private]

Definition at line 80 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by createButtonFrame().

LightApp_SelectionMgr* SMESHGUI_DeleteGroupDlg.mySelectionMgr [private]

Definition at line 86 of file SMESHGUI_DeleteGroupDlg.h.

Referenced by enterEvent(), Init(), isValid(), onApply(), onClose(), and onHelp().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS