#include <SMESHGUI_TransparencyDlg.h>

Public Slots | |
| void | ClickOnOk () |
| void | ClickOnHelp () |
| void | ValueHasChanged () |
| void | SetTransparency () |
| void | onSelectionChanged () |
Public Member Functions | |
| SMESHGUI_TransparencyDlg (SMESHGUI *) | |
| ~SMESHGUI_TransparencyDlg () | |
Private Member Functions | |
| void | keyPressEvent (QKeyEvent *) |
Private Attributes | |
| SMESHGUI * | mySMESHGUI |
| LightApp_SelectionMgr * | mySelectionMgr |
| SVTK_ViewWindow * | myViewWindow |
| QPushButton * | buttonOk |
| QPushButton * | buttonHelp |
| QLabel * | TextLabelOpaque |
| QLabel * | ValueLab |
| QLabel * | TextLabelTransparent |
| QSlider * | Slider1 |
| QString | myHelpFileName |
Definition at line 47 of file SMESHGUI_TransparencyDlg.h.
| SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg | ( | SMESHGUI * | theModule | ) |
Definition at line 68 of file SMESHGUI_TransparencyDlg.cxx.
References buttonHelp, buttonOk, ClickOnHelp(), ClickOnOk(), MARGIN, myHelpFileName, mySelectionMgr, mySMESHGUI, onSelectionChanged(), SetTransparency(), Slider1, SPACING, TextLabelOpaque, TextLabelTransparent, ValueHasChanged(), and ValueLab.
: QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myViewWindow( SMESH::GetViewWindow( theModule ) ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); setWindowTitle( tr( "SMESH_TRANSPARENCY_TITLE" ) ); setSizeGripEnabled( true ); QVBoxLayout* SMESHGUI_TransparencyDlgLayout = new QVBoxLayout( this ); SMESHGUI_TransparencyDlgLayout->setSpacing( SPACING ); SMESHGUI_TransparencyDlgLayout->setMargin( MARGIN ); /*************************************************************************/ QGroupBox* GroupC1 = new QGroupBox( this ); QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 ); GroupC1Layout->setSpacing( SPACING ); GroupC1Layout->setMargin( MARGIN ); TextLabelTransparent = new QLabel( tr( "SMESH_TRANSPARENCY_TRANSPARENT" ), GroupC1 ); TextLabelTransparent->setAlignment( Qt::AlignRight ); ValueLab = new QLabel( GroupC1 ); ValueLab->setAlignment( Qt::AlignCenter ); ValueLab->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); QFont fnt = ValueLab->font(); fnt.setBold( true ); ValueLab->setFont( fnt ); TextLabelOpaque = new QLabel( tr( "SMESH_TRANSPARENCY_OPAQUE" ), GroupC1 ); TextLabelOpaque->setAlignment( Qt::AlignLeft ); Slider1 = new QSlider( Qt::Horizontal, GroupC1 ); Slider1->setRange( 0, 100 ); Slider1->setSingleStep( 1 ); Slider1->setPageStep( 10 ); Slider1->setTickPosition( QSlider::TicksAbove ); Slider1->setTickInterval( 10 ); Slider1->setTracking( true ); Slider1->setFocusPolicy( Qt::NoFocus ); Slider1->setMinimumWidth( 300 ); GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); GroupC1Layout->addWidget( ValueLab, 0, 1 ); GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); GroupC1Layout->addWidget( Slider1, 1, 0, 1, 3 ); /*************************************************************************/ QGroupBox* GroupButtons = new QGroupBox( this ); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); GroupButtonsLayout->setSpacing( SPACING ); GroupButtonsLayout->setMargin( MARGIN ); buttonOk = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons ); buttonOk->setAutoDefault( true ); buttonOk->setDefault( true ); buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons ); buttonHelp->setAutoDefault( true ); GroupButtonsLayout->addWidget( buttonOk ); GroupButtonsLayout->addSpacing( 10 ); GroupButtonsLayout->addStretch(); GroupButtonsLayout->addWidget( buttonHelp ); /*************************************************************************/ SMESHGUI_TransparencyDlgLayout->addWidget( GroupC1 ); SMESHGUI_TransparencyDlgLayout->addWidget( GroupButtons ); // Initial state onSelectionChanged(); // signals and slots connections : after ValueHasChanged() connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); connect( Slider1, SIGNAL( valueChanged( int ) ), this, SLOT( SetTransparency() ) ); connect( Slider1, SIGNAL( sliderMoved( int ) ), this, SLOT( ValueHasChanged() ) ); connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ); connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); myHelpFileName = "transparency_page.html"; }
| SMESHGUI_TransparencyDlg::~SMESHGUI_TransparencyDlg | ( | ) |
Definition at line 154 of file SMESHGUI_TransparencyDlg.cxx.
{
}
| void SMESHGUI_TransparencyDlg::ClickOnHelp | ( | ) | [slot] |
Definition at line 171 of file SMESHGUI_TransparencyDlg.cxx.
References myHelpFileName, and mySMESHGUI.
Referenced by keyPressEvent(), and SMESHGUI_TransparencyDlg().
{
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_TransparencyDlg::ClickOnOk | ( | ) | [slot] |
Definition at line 162 of file SMESHGUI_TransparencyDlg.cxx.
Referenced by SMESHGUI_TransparencyDlg().
{
close();
}
| void SMESHGUI_TransparencyDlg::keyPressEvent | ( | QKeyEvent * | e | ) | [private] |
Definition at line 279 of file SMESHGUI_TransparencyDlg.cxx.
References ClickOnHelp().
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
}
}
| void SMESHGUI_TransparencyDlg::onSelectionChanged | ( | ) | [slot] |
Definition at line 231 of file SMESHGUI_TransparencyDlg.cxx.
References SMESH.FindActorByEntry(), Handle(), mySelectionMgr, myViewWindow, Slider1, and ValueHasChanged().
Referenced by SMESHGUI_TransparencyDlg().
{
if ( myViewWindow ) {
int opacity = 100;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
if ( aList.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
if ( !FirstIOS.IsNull() ) {
SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() );
if ( anActor )
opacity = int( anActor->GetOpacity() * 100. + 0.5 );
}
}
else if ( aList.Extent() > 1 ) {
SALOME_ListIteratorOfListIO It( aList );
int setOp = -1;
for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IO = It.Value();
if ( !IO.IsNull() ) {
SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if ( anActor ) {
int op = int( anActor->GetOpacity() * 100. + 0.5 );
if ( setOp < 0 )
setOp = op;
else if ( setOp != op ) {
setOp = 100;
break;
}
}
}
}
if ( setOp >= 0 )
opacity = setOp;
}
else {
}
Slider1->setValue( 100 - opacity );
}
ValueHasChanged();
}
| void SMESHGUI_TransparencyDlg::SetTransparency | ( | ) | [slot] |
Definition at line 197 of file SMESHGUI_TransparencyDlg.cxx.
References SMESH.FindActorByEntry(), Handle(), mySelectionMgr, myViewWindow, Slider1, and ValueHasChanged().
Referenced by SMESHGUI_TransparencyDlg().
{
if ( myViewWindow ) {
SUIT_OverrideCursor wc;
float opacity = ( 100 - Slider1->value() ) / 100.;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO It( aList );
for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IOS = It.Value();
SMESH_Actor* anActor = SMESH::FindActorByEntry( IOS->getEntry() );
if ( anActor )
anActor->SetOpacity( opacity );
}
myViewWindow->Repaint();
}
ValueHasChanged();
}
| void SMESHGUI_TransparencyDlg::ValueHasChanged | ( | ) | [slot] |
Definition at line 222 of file SMESHGUI_TransparencyDlg.cxx.
References Slider1, and ValueLab.
Referenced by onSelectionChanged(), SetTransparency(), and SMESHGUI_TransparencyDlg().
QPushButton* SMESHGUI_TransparencyDlg.buttonHelp [private] |
Definition at line 64 of file SMESHGUI_TransparencyDlg.h.
Referenced by SMESHGUI_TransparencyDlg().
QPushButton* SMESHGUI_TransparencyDlg.buttonOk [private] |
Definition at line 63 of file SMESHGUI_TransparencyDlg.h.
Referenced by SMESHGUI_TransparencyDlg().
QString SMESHGUI_TransparencyDlg.myHelpFileName [private] |
Definition at line 70 of file SMESHGUI_TransparencyDlg.h.
Referenced by ClickOnHelp(), and SMESHGUI_TransparencyDlg().
LightApp_SelectionMgr* SMESHGUI_TransparencyDlg.mySelectionMgr [private] |
Definition at line 60 of file SMESHGUI_TransparencyDlg.h.
Referenced by onSelectionChanged(), SetTransparency(), and SMESHGUI_TransparencyDlg().
SMESHGUI* SMESHGUI_TransparencyDlg.mySMESHGUI [private] |
Definition at line 59 of file SMESHGUI_TransparencyDlg.h.
Referenced by ClickOnHelp(), and SMESHGUI_TransparencyDlg().
SVTK_ViewWindow* SMESHGUI_TransparencyDlg.myViewWindow [private] |
Definition at line 61 of file SMESHGUI_TransparencyDlg.h.
Referenced by onSelectionChanged(), and SetTransparency().
QSlider* SMESHGUI_TransparencyDlg.Slider1 [private] |
Definition at line 68 of file SMESHGUI_TransparencyDlg.h.
Referenced by onSelectionChanged(), SetTransparency(), SMESHGUI_TransparencyDlg(), and ValueHasChanged().
QLabel* SMESHGUI_TransparencyDlg.TextLabelOpaque [private] |
Definition at line 65 of file SMESHGUI_TransparencyDlg.h.
Referenced by SMESHGUI_TransparencyDlg().
QLabel* SMESHGUI_TransparencyDlg.TextLabelTransparent [private] |
Definition at line 67 of file SMESHGUI_TransparencyDlg.h.
Referenced by SMESHGUI_TransparencyDlg().
QLabel* SMESHGUI_TransparencyDlg.ValueLab [private] |
Definition at line 66 of file SMESHGUI_TransparencyDlg.h.
Referenced by SMESHGUI_TransparencyDlg(), and ValueHasChanged().