From: eap Date: Tue, 20 Dec 2016 12:53:36 +0000 (+0300) Subject: IMP23371: [CEA 1441] Define the faces where we impose the boundary layer from the... X-Git-Tag: V8_3_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dca6c871d2836c5f501367c26d81454a3010b262;p=modules%2Fsmesh.git IMP23371: [CEA 1441] Define the faces where we impose the boundary layer from the dialog box of MG-Hybrid --- diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index 0ba304086..03eeb4082 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -72,30 +73,36 @@ StdMeshersGUI_SubShapeSelectorWdg ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum subShType, - const bool toShowList ): + const bool toShowList, + const bool toShowActivateBtn ): QWidget( parent ), myMaxSize( -1 ), myPreviewActor( 0 ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); - QGridLayout* edgesLayout = new QGridLayout( this ); - edgesLayout->setMargin( MARGIN ); - edgesLayout->setSpacing( SPACING ); + QGridLayout* layout = new QGridLayout( this ); + layout->setMargin( MARGIN ); + layout->setSpacing( SPACING ); if ( toShowList ) { - myListWidget = new QListWidget( this ); - myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); - myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); + QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); + myListWidget = new QListWidget( this ); + myActivateButton = new QPushButton( iconSelect, "", this ); + myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); + myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); myListWidget->setSelectionMode( QListWidget::ExtendedSelection ); myListWidget->setMinimumWidth(300); + myListWidget->setWrapping(true); + myActivateButton->setCheckable( true ); } else { - myListWidget = 0; - myAddButton = 0; - myRemoveButton = 0; + myListWidget = 0; + myActivateButton = 0; + myAddButton = 0; + myRemoveButton = 0; } myInfoLabel = new QLabel( this ); myPrevButton = new QPushButton( "<<", this ); @@ -103,21 +110,27 @@ StdMeshersGUI_SubShapeSelectorWdg if ( myListWidget ) { - edgesLayout->addWidget(myListWidget, 0, 0, 3, 3); - edgesLayout->addWidget(myAddButton, 0, 3); - edgesLayout->addWidget(myRemoveButton, 1, 3); - edgesLayout->addWidget(myInfoLabel, 3, 0, 1, 3); - edgesLayout->addWidget(myPrevButton, 4, 0); - edgesLayout->addWidget(myNextButton, 4, 2); - - edgesLayout->setRowStretch(2, 5); - edgesLayout->setColumnStretch(1, 5); + int row = 0; + layout->addWidget(myListWidget, row, 0, 3+toShowActivateBtn, 3); + if ( toShowActivateBtn ) + layout->addWidget( myActivateButton, row++, 3 ); + else + myActivateButton->hide(); + layout->addWidget(myAddButton, row, 3); + layout->addWidget(myRemoveButton, ++row, 3); + ++row; + layout->addWidget(myInfoLabel, ++row, 0, 1, 3); + layout->addWidget(myPrevButton, ++row, 0); + layout->addWidget(myNextButton, row, 2); + + layout->setRowStretch(row-2, 5); + layout->setColumnStretch(1, 5); } else // show only Prev and Next buttons { - edgesLayout->addWidget(myInfoLabel, 0, 0, 1, 2); - edgesLayout->addWidget(myPrevButton, 1, 0); - edgesLayout->addWidget(myNextButton, 1, 1); + layout->addWidget(myInfoLabel, 0, 0, 1, 2); + layout->addWidget(myPrevButton, 1, 0); + layout->addWidget(myNextButton, 1, 1); } //myInfoLabel->setMinimumWidth(300); //myInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); @@ -187,6 +200,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::init() myRemoveButton->setEnabled( false ); connect( myListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); + connect( myActivateButton, SIGNAL( toggled(bool) ), SLOT( ActivateSelection(bool))); connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd())); connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove())); } @@ -248,6 +262,15 @@ void StdMeshersGUI_SubShapeSelectorWdg::ShowPreview( bool visible) void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate ) { + // adjust state of myActivateButton + if ( myActivateButton && + myActivateButton != sender() && + myActivateButton->isChecked() != toActivate ) + { + myActivateButton->toggle(); + return; + } + if ( !mySelectionMgr ) return; if ( toActivate ) @@ -258,6 +281,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate ) { disconnect(mySelectionMgr, 0, this, 0 ); } + + if ( sender() == myActivateButton ) + ShowPreview( toActivate ); } //================================================================================ diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h index adf62f1d6..577d31041 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h @@ -52,7 +52,8 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget public: StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0, TopAbs_ShapeEnum subShType = TopAbs_EDGE, - const bool toShowList = true); + const bool toShowList = true, + const bool toShowActivateBtn = false); ~StdMeshersGUI_SubShapeSelectorWdg(); SMESH::long_array_var GetListOfIDs(); @@ -80,6 +81,8 @@ public: vtkRenderer* GetRenderer() { return myRenderer; } SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; } void ClearSelected(); + +public slots: void ActivateSelection( bool ); signals: @@ -114,6 +117,7 @@ private: vtkRenderer* myRenderer; QListWidget* myListWidget; + QPushButton* myActivateButton; QPushButton* myAddButton; QPushButton* myRemoveButton; QLabel* myInfoLabel;