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

SMESHGUI_MeshInfosDlg Class Reference

#include <SMESHGUI_MeshInfosDlg.h>

Inheritance diagram for SMESHGUI_MeshInfosDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_MeshInfosDlg (SMESHGUI *)
 ~SMESHGUI_MeshInfosDlg ()

Protected Member Functions

void closeEvent (QCloseEvent *)
void keyPressEvent (QKeyEvent *)
void windowActivationChange (bool)
void DumpMeshInfos ()

Private Slots

void onSelectionChanged ()
void DeactivateActiveDialog ()
void ActivateThisDialog ()
void onStartSelection ()
void onHelp ()

Private Attributes

SMESHGUImySMESHGUI
LightApp_SelectionMgr * mySelectionMgr
bool myStartSelection
bool myIsActiveWindow
QPushButton * mySelectBtn
QLabel * mySelectLab
QStackedWidget * myWGStack
QWidgetmyMeshWidget
QLabel * myMeshName
SMESHGUI_MeshInfosBoxmyMeshInfoBox
QGroupBoxmyButtonsGroup
QPushButton * myOkBtn
QPushButton * myHelpBtn
QString myHelpFileName

Detailed Description

Definition at line 45 of file SMESHGUI_MeshInfosDlg.h.


Constructor & Destructor Documentation

SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg ( SMESHGUI theModule)

Definition at line 72 of file SMESHGUI_MeshInfosDlg.cxx.

References COLONIZE, DeactivateActiveDialog(), SMESH.GetResourceMgr(), MARGIN, myButtonsGroup, myHelpBtn, myHelpFileName, myIsActiveWindow, myMeshInfoBox, myMeshName, myMeshWidget, myOkBtn, mySelectBtn, mySelectionMgr, mySelectLab, mySMESHGUI, myStartSelection, myWGStack, onHelp(), onSelectionChanged(), onStartSelection(), SMESHGUI.SetActiveDialogBox(), and SPACING.

                                                               : 
  QDialog(SMESH::GetDesktop(theModule)),
  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
  mySMESHGUI(theModule)
{
  setModal( false );
  setAttribute( Qt::WA_DeleteOnClose, true );
  setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
  setSizeGripEnabled(true);

  myStartSelection = true;
  myIsActiveWindow = true;

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

  // select button & label
  QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
  mySelectBtn = new QPushButton(this);
  mySelectBtn->setIcon(image0);
  mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));

  mySelectLab = new QLabel(this);
  mySelectLab->setAlignment(Qt::AlignCenter);
  QFont fnt = mySelectLab->font(); fnt.setBold(true);
  mySelectLab->setFont(fnt);

  QHBoxLayout* aSelectLayout = new QHBoxLayout;
  aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
  aSelectLayout->addWidget(mySelectBtn);
  aSelectLayout->addWidget(mySelectLab);

  // top widget stack
  myWGStack = new QStackedWidget(this);

  // no valid selection
  QWidget* myBadWidget = new QWidget(myWGStack);
  QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
  QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget);
  myBadLab->setAlignment(Qt::AlignCenter);
  myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
  aBadLayout->addWidget(myBadLab);
  myWGStack->addWidget(myBadWidget);

  // mesh
  myMeshWidget = new QWidget(myWGStack);
  QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
  aMeshLayout->setSpacing(SPACING);  aMeshLayout->setMargin(0);
  myWGStack->addWidget(myMeshWidget);

  // --> name
  QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget);
  myMeshName    = new QLabel(myMeshWidget);
  myMeshName->setMinimumWidth(100);
  QFrame* line1 = new QFrame(myMeshWidget);
  line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);

  myMeshInfoBox = new SMESHGUI_MeshInfosBox(true, myMeshWidget);

  aMeshLayout->addWidget(myMeshNameLab,      0, 0);
  aMeshLayout->addWidget(myMeshName,         0, 1);
  aMeshLayout->addWidget(line1,              1, 0, 1, 2);
  aMeshLayout->addWidget(myMeshInfoBox,      2, 0, 1, 2);
  aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0);

  // buttons
  myButtonsGroup = new QGroupBox(this);
  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
  myButtonsGroupLayout->setSpacing(SPACING); myButtonsGroupLayout->setMargin(MARGIN);

  // buttons --> OK and Help buttons
  myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup);
  myOkBtn->setAutoDefault(true);
  myOkBtn->setDefault(true);
  myOkBtn->setFocus();
  myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup);
  myHelpBtn->setAutoDefault(true);

  myButtonsGroupLayout->addWidget(myOkBtn);
  myButtonsGroupLayout->addSpacing(10);
  myButtonsGroupLayout->addStretch();
  myButtonsGroupLayout->addWidget(myHelpBtn);

  aTopLayout->addLayout(aSelectLayout);
  aTopLayout->addWidget(myWGStack);
  aTopLayout->addWidget(myButtonsGroup);

  mySMESHGUI->SetActiveDialogBox(this);

  // connect signals
  connect(myOkBtn,                 SIGNAL(clicked()),                      this, SLOT(close()));
  connect( myHelpBtn,              SIGNAL(clicked()),                      this, SLOT(onHelp()));
  connect(mySelectBtn,             SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
  connect(mySelectionMgr,          SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));

  // init dialog with current selection
  onSelectionChanged();

  myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
}
SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg ( )

Definition at line 179 of file SMESHGUI_MeshInfosDlg.cxx.

{
}

Member Function Documentation

void SMESHGUI_MeshInfosDlg::ActivateThisDialog ( ) [private, slot]

Definition at line 267 of file SMESHGUI_MeshInfosDlg.cxx.

References SMESHGUI.EmitSignalDeactivateDialog(), mySelectionMgr, mySMESHGUI, and onSelectionChanged().

Referenced by windowActivationChange().

{
  /* Emit a signal to deactivate any active dialog */
  mySMESHGUI->EmitSignalDeactivateDialog();
  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
}
void SMESHGUI_MeshInfosDlg::closeEvent ( QCloseEvent *  e) [protected]
void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog ( ) [private, slot]

Definition at line 258 of file SMESHGUI_MeshInfosDlg.cxx.

References mySelectionMgr.

Referenced by SMESHGUI_MeshInfosDlg().

{
  disconnect(mySelectionMgr, 0, this, 0);
}
void SMESHGUI_MeshInfosDlg::DumpMeshInfos ( ) [protected]

Definition at line 187 of file SMESHGUI_MeshInfosDlg.cxx.

References _PTR(), Handle(), myMeshInfoBox, myMeshName, myMeshWidget, mySelectionMgr, mySelectLab, myStartSelection, myWGStack, SMESHGUI_MeshInfosBox.SetMeshInfo(), and SMESH.SObjectToObject().

Referenced by onSelectionChanged().

{
  SUIT_OverrideCursor wc;

  SALOME_ListIO aList;
  mySelectionMgr->selectedObjects(aList);

  int nbSel = aList.Extent();
  if (nbSel == 1) {
    myStartSelection = false;
    mySelectLab->setText("");
    Handle(SALOME_InteractiveObject) IObject = aList.First();
    _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
    if (aSO) {
      //CORBA::Object_var anObject = aSO->GetObject();
      CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
      if (!CORBA::is_nil(anObject)) {
        SMESH::SMESH_IDSource_var anIDSource = SMESH::SMESH_IDSource::_narrow(anObject);
        if (!anIDSource->_is_nil()) {
          myWGStack->setCurrentWidget(myMeshWidget);
          setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
          myMeshName->setText(aSO->GetName().c_str());

          SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
          myMeshInfoBox->SetMeshInfo( aMeshInfo );

          return;
        }
      }
    }
  }
  myWGStack->setCurrentIndex(0);
  setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
}
void SMESHGUI_MeshInfosDlg::keyPressEvent ( QKeyEvent *  e) [protected]

Definition at line 314 of file SMESHGUI_MeshInfosDlg.cxx.

References onHelp().

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

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

Definition at line 290 of file SMESHGUI_MeshInfosDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by keyPressEvent(), and SMESHGUI_MeshInfosDlg().

{
  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_MeshInfosDlg::onSelectionChanged ( ) [private, slot]
void SMESHGUI_MeshInfosDlg::onStartSelection ( ) [private, slot]

Definition at line 278 of file SMESHGUI_MeshInfosDlg.cxx.

References mySelectLab, myStartSelection, and onSelectionChanged().

Referenced by SMESHGUI_MeshInfosDlg().

{
  myStartSelection = true;
  onSelectionChanged();
  myStartSelection = true;
  mySelectLab->setText(tr("INF_SELECT_OBJECT"));
}
void SMESHGUI_MeshInfosDlg::windowActivationChange ( bool  oldActive) [protected]

Definition at line 246 of file SMESHGUI_MeshInfosDlg.cxx.

References ActivateThisDialog(), and myIsActiveWindow.

{
  QDialog::windowActivationChange(oldActive);
  if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
    ActivateThisDialog();
  myIsActiveWindow = isActiveWindow();
}

Field Documentation

Definition at line 81 of file SMESHGUI_MeshInfosDlg.h.

Referenced by SMESHGUI_MeshInfosDlg().

QPushButton* SMESHGUI_MeshInfosDlg.myHelpBtn [private]

Definition at line 83 of file SMESHGUI_MeshInfosDlg.h.

Referenced by SMESHGUI_MeshInfosDlg().

Definition at line 85 of file SMESHGUI_MeshInfosDlg.h.

Referenced by onHelp(), and SMESHGUI_MeshInfosDlg().

Definition at line 70 of file SMESHGUI_MeshInfosDlg.h.

Referenced by SMESHGUI_MeshInfosDlg(), and windowActivationChange().

Definition at line 79 of file SMESHGUI_MeshInfosDlg.h.

Referenced by DumpMeshInfos(), and SMESHGUI_MeshInfosDlg().

Definition at line 78 of file SMESHGUI_MeshInfosDlg.h.

Referenced by DumpMeshInfos(), and SMESHGUI_MeshInfosDlg().

Definition at line 77 of file SMESHGUI_MeshInfosDlg.h.

Referenced by DumpMeshInfos(), and SMESHGUI_MeshInfosDlg().

QPushButton* SMESHGUI_MeshInfosDlg.myOkBtn [private]

Definition at line 82 of file SMESHGUI_MeshInfosDlg.h.

Referenced by SMESHGUI_MeshInfosDlg().

QPushButton* SMESHGUI_MeshInfosDlg.mySelectBtn [private]

Definition at line 72 of file SMESHGUI_MeshInfosDlg.h.

Referenced by SMESHGUI_MeshInfosDlg().

LightApp_SelectionMgr* SMESHGUI_MeshInfosDlg.mySelectionMgr [private]

Definition at line 73 of file SMESHGUI_MeshInfosDlg.h.

Referenced by DumpMeshInfos(), onStartSelection(), and SMESHGUI_MeshInfosDlg().

QStackedWidget* SMESHGUI_MeshInfosDlg.myWGStack [private]

Definition at line 75 of file SMESHGUI_MeshInfosDlg.h.

Referenced by DumpMeshInfos(), and SMESHGUI_MeshInfosDlg().

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