Centralized dialog box for the measurements. More...
#include <SMESHGUI_MeshInfo.h>

Public Types | |
| enum | { BaseInfo, ElemInfo } |
Information type. More... | |
Public Member Functions | |
| SMESHGUI_MeshInfoDlg (QWidget *=0, int=BaseInfo) | |
| Constructor. | |
| ~SMESHGUI_MeshInfoDlg () | |
| Destructor. | |
| void | showInfo (const Handle(SALOME_InteractiveObject)&) |
| Show mesh information. | |
| 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 | updateInfo () |
| Show mesh information. | |
| void | activate () |
| Activate dialog box. | |
| void | deactivate () |
| Deactivate dialog box. | |
| void | modeChanged () |
| Called when users switches between node / element modes. | |
| void | idChanged () |
| Caled when users prints mesh element ID in the corresponding field. | |
Private Attributes | |
| QTabWidget * | myTabWidget |
| SMESHGUI_MeshInfo * | myBaseInfo |
| QButtonGroup * | myMode |
| QLineEdit * | myID |
| SMESHGUI_ElemInfo * | myElemInfo |
| SMESH_Actor * | myActor |
Centralized dialog box for the measurements.
Mesh information dialog box.
Definition at line 202 of file SMESHGUI_MeshInfo.h.
anonymous enum [private] |
Definition at line 206 of file SMESHGUI_MeshInfo.h.
| anonymous enum |
Information type.
Definition at line 210 of file SMESHGUI_MeshInfo.h.
Constructor.
| parent | parent widget |
| page | specifies the dialog page to be shown at the start-up |
Definition at line 1191 of file SMESHGUI_MeshInfo.cxx.
References BaseInfo, deactivate(), ElemInfo, ElemMode, SMESHGUI.GetSMESHGUI(), help(), idChanged(), modeChanged(), myBaseInfo, myElemInfo, myID, myMode, myTabWidget, NodeMode, reject(), SMESHGUI.resourceMgr(), and updateSelection().
: QDialog( parent ), myActor( 0 ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); setWindowTitle( tr( "MESH_INFO" ) ); setSizeGripEnabled( true ); myTabWidget = new QTabWidget( this ); // base info myBaseInfo = new SMESHGUI_MeshInfo( myTabWidget ); myTabWidget->addTab( myBaseInfo, tr( "BASE_INFO" ) ); // elem info QWidget* w = new QWidget( myTabWidget ); myMode = new QButtonGroup( this ); myMode->addButton( new QRadioButton( tr( "NODE_MODE" ), w ), NodeMode ); myMode->addButton( new QRadioButton( tr( "ELEM_MODE" ), w ), ElemMode ); myMode->button( NodeMode )->setChecked( true ); myID = new QLineEdit( w ); myID->setValidator( new SMESHGUI_IdValidator( this ) ); int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 ); mode = qMin( 1, qMax( 0, mode ) ); if ( mode == 0 ) myElemInfo = new SMESHGUI_SimpleElemInfo( w ); else myElemInfo = new SMESHGUI_TreeElemInfo( w ); QGridLayout* elemLayout = new QGridLayout( w ); elemLayout->setMargin( MARGIN ); elemLayout->setSpacing( SPACING ); elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 ); elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 ); elemLayout->addWidget( myID, 0, 2 ); elemLayout->addWidget( myElemInfo, 1, 0, 1, 3 ); myTabWidget->addTab( w, tr( "ELEM_INFO" ) ); 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)BaseInfo, qMin( (int)ElemInfo, page ) ) ); connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) ); connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ) ); connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ) ); connect( myID, SIGNAL( textEdited( QString ) ), this, SLOT( idChanged() ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); updateSelection(); }
| SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg | ( | ) |
| void SMESHGUI_MeshInfoDlg::activate | ( | ) | [private, slot] |
Activate dialog box.
Definition at line 1420 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI.EmitSignalDeactivateDialog(), SMESHGUI.GetSMESHGUI(), myTabWidget, SMESHGUI.SetActiveDialogBox(), and updateSelection().
Referenced by enterEvent().
{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this );
myTabWidget->setEnabled( true );
updateSelection();
}
| void SMESHGUI_MeshInfoDlg::deactivate | ( | ) | [private, slot] |
Deactivate dialog box.
Definition at line 1431 of file SMESHGUI_MeshInfo.cxx.
References myTabWidget, SMESHGUI.selectionMgr(), and updateInfo().
Referenced by SMESHGUI_MeshInfoDlg().
{
myTabWidget->setEnabled( false );
disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
}
| void SMESHGUI_MeshInfoDlg::enterEvent | ( | QEvent * | ) | [protected] |
Reactivate dialog box, when mouse pointer goes into it.
Definition at line 1341 of file SMESHGUI_MeshInfo.cxx.
References activate().
{
activate();
}
| void SMESHGUI_MeshInfoDlg::help | ( | ) | [private, slot] |
Show help page.
Definition at line 1390 of file SMESHGUI_MeshInfo.cxx.
References BaseInfo, myTabWidget, and SMESH.ShowHelpFile().
Referenced by keyPressEvent(), and SMESHGUI_MeshInfoDlg().
{
SMESH::ShowHelpFile( myTabWidget->currentIndex() == BaseInfo ?
"mesh_infos_page.html#advanced_mesh_infos_anchor" :
"mesh_infos_page.html#mesh_element_info_anchor" );
}
| void SMESHGUI_MeshInfoDlg::idChanged | ( | ) | [private, slot] |
Caled when users prints mesh element ID in the corresponding field.
Definition at line 1449 of file SMESHGUI_MeshInfo.cxx.
References ElemMode, SMESH_Actor.GetObject(), SMESH.GetViewWindow(), Handle(), SMESH_test.ids, myActor, myElemInfo, myID, myMode, and SMESHGUI_ElemInfo.showInfo().
Referenced by SMESHGUI_MeshInfoDlg(), and updateSelection().
{
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
if ( myActor && selector ) {
Handle(SALOME_InteractiveObject) IO = myActor->getIO();
TColStd_MapOfInteger ID;
QSet<long> ids;
QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
foreach ( QString tid, idTxt ) {
long id = tid.trimmed().toLong();
const SMDS_MeshElement* e = myMode->checkedId() == ElemMode ?
myActor->GetObject()->GetMesh()->FindElement( id ) :
myActor->GetObject()->GetMesh()->FindNode( id );
if ( e ) {
ID.Add( id );
ids << id;
}
}
selector->AddOrRemoveIndex( IO, ID, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->highlight( IO, true, true );
myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
}
}
| void SMESHGUI_MeshInfoDlg::keyPressEvent | ( | QKeyEvent * | e | ) | [protected] |
Process keyboard event.
| e | key press event |
Definition at line 1329 of file SMESHGUI_MeshInfo.cxx.
References help().
{
QDialog::keyPressEvent( e );
if ( !e->isAccepted() && e->key() == Qt::Key_F1 ) {
e->accept();
help();
}
}
| void SMESHGUI_MeshInfoDlg::modeChanged | ( | ) | [private, slot] |
Called when users switches between node / element modes.
Definition at line 1440 of file SMESHGUI_MeshInfo.cxx.
References myID, and updateSelection().
Referenced by SMESHGUI_MeshInfoDlg().
{
myID->clear();
updateSelection();
}
| void SMESHGUI_MeshInfoDlg::reject | ( | ) |
Perform clean-up actions on the dialog box closing.
Definition at line 1315 of file SMESHGUI_MeshInfo.cxx.
References SMESH.GetViewWindow(), SMESHGUI.selectionMgr(), and SMESH.SetPointRepresentation().
Referenced by SMESHGUI_MeshInfoDlg().
{
LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
selMgr->clearFilters();
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection );
QDialog::reject();
}
| void SMESHGUI_MeshInfoDlg::showInfo | ( | const Handle(SALOME_InteractiveObject)& | IO | ) |
Show mesh information.
| IO | interactive object |
Definition at line 1281 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.clear(), ElemMode, SMESH.FindActorByEntry(), SMESH.GetNameOfSelectedElements(), SMESH.GetNameOfSelectedNodes(), SMESH.GetViewWindow(), SMESH_test.ids, myActor, myBaseInfo, myElemInfo, myID, myMode, NodeMode, SMESHGUI_ElemInfo.setSource(), SMESHGUI_ElemInfo.showInfo(), and SMESHGUI_MeshInfo.showInfo().
Referenced by SMESHGUI.OnGUIEvent(), and updateInfo().
{
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( !CORBA::is_nil( obj ) ) {
myBaseInfo->showInfo( obj );
myActor = SMESH::FindActorByEntry( IO->getEntry() );
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
QString ID;
int nb = 0;
if ( myActor && selector ) {
nb = myMode->checkedId() == NodeMode ?
SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID );
}
myElemInfo->setSource( myActor ) ;
if ( nb > 0 ) {
myID->setText( ID.trimmed() );
QSet<long> ids;
QStringList idTxt = ID.split( " ", QString::SkipEmptyParts );
foreach ( ID, idTxt )
ids << ID.trimmed().toLong();
myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
}
else {
myID->clear();
myElemInfo->clear();
}
}
}
| void SMESHGUI_MeshInfoDlg::updateInfo | ( | ) | [private, slot] |
Show mesh information.
Definition at line 1400 of file SMESHGUI_MeshInfo.cxx.
References Handle(), SMESHGUI.selectionMgr(), and showInfo().
Referenced by deactivate(), and updateSelection().
{
SUIT_OverrideCursor wc;
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) IO = selected.First();
showInfo( IO );
}
// else {
// myBaseInfo->clear();
// myElemInfo->clear();
// }
}
| void SMESHGUI_MeshInfoDlg::updateSelection | ( | ) | [private, slot] |
Setup selection mode depending on the current dialog box state.
Definition at line 1349 of file SMESHGUI_MeshInfo.cxx.
References BaseInfo, SMESH.GetViewWindow(), idChanged(), myActor, myID, myMode, myTabWidget, NodeMode, SMESHGUI.selectionMgr(), SMESH.SetPointRepresentation(), and updateInfo().
Referenced by activate(), modeChanged(), and SMESHGUI_MeshInfoDlg().
{
LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters();
if ( myTabWidget->currentIndex() == BaseInfo ) {
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection );
}
else {
if ( myMode->checkedId() == NodeMode ) {
SMESH::SetPointRepresentation( true );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( NodeSelection );
}
else {
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( CellSelection );
}
}
QString oldID = myID->text().trimmed();
SMESH_Actor* oldActor = myActor;
myID->clear();
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
updateInfo();
if ( oldActor == myActor && myActor && !oldID.isEmpty() ) {
myID->setText( oldID );
idChanged();
}
}
SMESH_Actor* SMESHGUI_MeshInfoDlg.myActor [private] |
Definition at line 240 of file SMESHGUI_MeshInfo.h.
Referenced by idChanged(), showInfo(), and updateSelection().
SMESHGUI_MeshInfo* SMESHGUI_MeshInfoDlg.myBaseInfo [private] |
Definition at line 236 of file SMESHGUI_MeshInfo.h.
Referenced by showInfo(), and SMESHGUI_MeshInfoDlg().
SMESHGUI_ElemInfo* SMESHGUI_MeshInfoDlg.myElemInfo [private] |
Definition at line 239 of file SMESHGUI_MeshInfo.h.
Referenced by idChanged(), showInfo(), and SMESHGUI_MeshInfoDlg().
QLineEdit* SMESHGUI_MeshInfoDlg.myID [private] |
Definition at line 238 of file SMESHGUI_MeshInfo.h.
Referenced by idChanged(), modeChanged(), showInfo(), SMESHGUI_MeshInfoDlg(), and updateSelection().
QButtonGroup* SMESHGUI_MeshInfoDlg.myMode [private] |
Definition at line 237 of file SMESHGUI_MeshInfo.h.
Referenced by idChanged(), showInfo(), SMESHGUI_MeshInfoDlg(), and updateSelection().
QTabWidget* SMESHGUI_MeshInfoDlg.myTabWidget [private] |
Definition at line 235 of file SMESHGUI_MeshInfo.h.
Referenced by activate(), deactivate(), help(), SMESHGUI_MeshInfoDlg(), and updateSelection().