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

SMESHGUI_MeasureDlg Class Reference

#include <SMESHGUI_Measurements.h>

Inheritance diagram for SMESHGUI_MeasureDlg:
Inheritance graph
[legend]

Public Types

enum  { MinDistance, BoundingBox }
 

Measurement type.

More...

Public Member Functions

 SMESHGUI_MeasureDlg (QWidget *=0, int=MinDistance)
 Constructor.
 ~SMESHGUI_MeasureDlg ()
 Destructor.
void reject ()
 Perform clean-up actions on the dialog box closing.

Protected Member Functions

void keyPressEvent (QKeyEvent *)
 Process keyboard event.
void enterEvent (QEvent *)
 Reactivate dialog box, when mouse pointer goes into it.

Private Types

enum  { NodeMode, ElemMode }

Private Slots

void help ()
 Show help page.
void updateSelection ()
 Setup selection mode depending on the current dialog box state.
void activate ()
 Activate dialog box.
void deactivate ()
 Deactivate dialog box.

Private Attributes

QTabWidget * myTabWidget
SMESHGUI_MinDistancemyMinDist
SMESHGUI_BoundingBoxmyBndBox

Detailed Description

Definition at line 138 of file SMESHGUI_Measurements.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NodeMode 
ElemMode 

Definition at line 142 of file SMESHGUI_Measurements.h.

anonymous enum

Measurement type.

Enumerator:
MinDistance 

minimum distance

BoundingBox 

bounding box

Definition at line 146 of file SMESHGUI_Measurements.h.


Constructor & Destructor Documentation

SMESHGUI_MeasureDlg::SMESHGUI_MeasureDlg ( QWidget parent = 0,
int  page = MinDistance 
)

Constructor.

Parameters:
parentparent widget
pagespecifies the dialog page to be shown at the start-up

Definition at line 1093 of file SMESHGUI_Measurements.cxx.

References BoundingBox, deactivate(), SMESHGUI.GetSMESHGUI(), help(), MinDistance, myBndBox, myMinDist, myTabWidget, reject(), SMESHGUI.resourceMgr(), and updateSelection().

: QDialog( parent )
{
  setModal( false );
  setAttribute( Qt::WA_DeleteOnClose, true );
  setWindowTitle( tr( "MEASUREMENTS" ) );
  setSizeGripEnabled( true );

  SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();

  myTabWidget = new QTabWidget( this );

  // min distance

  myMinDist = new SMESHGUI_MinDistance( myTabWidget );
  myTabWidget->addTab( myMinDist, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_MIN_DIST" ) ), tr( "MIN_DIST" ) );

  // bounding box
  
  myBndBox = new SMESHGUI_BoundingBox( myTabWidget );
  myTabWidget->addTab( myBndBox, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_BND_BOX" ) ), tr( "BND_BOX" ) );

  // buttons
  QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
  okBtn->setAutoDefault( true );
  okBtn->setDefault( true );
  okBtn->setFocus();
  QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
  helpBtn->setAutoDefault( true );

  QHBoxLayout* btnLayout = new QHBoxLayout;
  btnLayout->setSpacing( SPACING );
  btnLayout->setMargin( 0 );
  btnLayout->addWidget( okBtn );
  btnLayout->addStretch( 10 );
  btnLayout->addWidget( helpBtn );

  QVBoxLayout* l = new QVBoxLayout ( this );
  l->setMargin( MARGIN );
  l->setSpacing( SPACING );
  l->addWidget( myTabWidget );
  l->addStretch();
  l->addLayout( btnLayout );

  myTabWidget->setCurrentIndex( qMax( (int)MinDistance, qMin( (int)BoundingBox, page ) ) );

  connect( okBtn,       SIGNAL( clicked() ),              this, SLOT( reject() ) );
  connect( helpBtn,     SIGNAL( clicked() ),              this, SLOT( help() ) );
  connect( myTabWidget, SIGNAL( currentChanged( int  ) ), this, SLOT( updateSelection() ) );
  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) );

  updateSelection();
}
SMESHGUI_MeasureDlg::~SMESHGUI_MeasureDlg ( )

Destructor.

Definition at line 1151 of file SMESHGUI_Measurements.cxx.

{
}

Member Function Documentation

void SMESHGUI_MeasureDlg::activate ( ) [private, slot]
void SMESHGUI_MeasureDlg::deactivate ( ) [private, slot]

Deactivate dialog box.

Definition at line 1225 of file SMESHGUI_Measurements.cxx.

References SMESHGUI_BoundingBox.deactivate(), SMESHGUI_MinDistance.deactivate(), myBndBox, myMinDist, myTabWidget, and SMESHGUI.selectionMgr().

Referenced by SMESHGUI_MeasureDlg().

{
  myMinDist->deactivate();
  myBndBox->deactivate();
  myTabWidget->setEnabled( false );
  disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
}
void SMESHGUI_MeasureDlg::enterEvent ( QEvent *  ) [protected]

Reactivate dialog box, when mouse pointer goes into it.

Definition at line 1184 of file SMESHGUI_Measurements.cxx.

References activate().

{
  activate();
}
void SMESHGUI_MeasureDlg::help ( ) [private, slot]

Show help page.

Definition at line 1204 of file SMESHGUI_Measurements.cxx.

References MinDistance, myTabWidget, and SMESH.ShowHelpFile().

Referenced by keyPressEvent(), and SMESHGUI_MeasureDlg().

{
  SMESH::ShowHelpFile( myTabWidget->currentIndex() == MinDistance ?
                       "measurements_page.html#min_distance_anchor" : 
                       "measurements_page.html#bounding_box_anchor" );
}
void SMESHGUI_MeasureDlg::keyPressEvent ( QKeyEvent *  e) [protected]

Process keyboard event.

Parameters:
ekey press event

Definition at line 1172 of file SMESHGUI_Measurements.cxx.

References help().

{
  QDialog::keyPressEvent( e );
  if ( !e->isAccepted() && e->key() == Qt::Key_F1 ) {
    e->accept();
    help();
  }
}
void SMESHGUI_MeasureDlg::reject ( )

Perform clean-up actions on the dialog box closing.

Definition at line 1158 of file SMESHGUI_Measurements.cxx.

References SMESH.GetViewWindow(), SMESHGUI.selectionMgr(), and SMESH.SetPointRepresentation().

Referenced by SMESHGUI_MeasureDlg().

{
  LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
  selMgr->clearFilters();
  SMESH::SetPointRepresentation( false );
  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
    aViewWindow->SetSelectionMode( ActorSelection );
  QDialog::reject();
}
void SMESHGUI_MeasureDlg::updateSelection ( ) [private, slot]

Setup selection mode depending on the current dialog box state.

Definition at line 1192 of file SMESHGUI_Measurements.cxx.

References BoundingBox, MinDistance, myBndBox, myMinDist, myTabWidget, SMESHGUI_BoundingBox.updateSelection(), and SMESHGUI_MinDistance.updateSelection().

Referenced by activate(), and SMESHGUI_MeasureDlg().

{
  if ( myTabWidget->currentIndex() == MinDistance )
    myMinDist->updateSelection();
  else if ( myTabWidget->currentIndex() == BoundingBox )
    myBndBox->updateSelection();
    
}

Field Documentation

Definition at line 169 of file SMESHGUI_Measurements.h.

Referenced by deactivate(), SMESHGUI_MeasureDlg(), and updateSelection().

Definition at line 168 of file SMESHGUI_Measurements.h.

Referenced by deactivate(), SMESHGUI_MeasureDlg(), and updateSelection().

QTabWidget* SMESHGUI_MeasureDlg.myTabWidget [private]
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