tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
this, SLOT(OnSwitchSelectionMode()));
- // Defenition of the actions for the "Navigation" tool bar
+ // Definition of the actions for the "Navigation" tool bar
registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
void VisuGUI::createPanels()
{
- myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
- myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
- myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
-
- QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
- for( ; it != itEnd; ++it )
- {
- if( VisuGUI_Panel* aPanel = it.value() )
- {
- aPanel->hide();
- GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
- }
+ myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
+ myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
+ myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
+
+ VisuGUI_Panel* aPanel;
+ foreach( aPanel, myPanels ) {
+ getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
+ aPanel->setVisible( false );
}
}
setMenuShown( false );
setToolShown( false );
- QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
- for( ; it != itEnd; ++it )
- {
- if( VisuGUI_Panel* aPanel = it.value() )
- aPanel->hide();
- }
-
// Unset actions accelerator keys
action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
int addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize );
private:
- QMap< PanelId, VisuGUI_Panel* > myPanels;
- VisuGUI_Slider* mySlider;
- VisuGUI_Sweep* mySweep;
+ QMap<int,VisuGUI_Panel*> myPanels;
+ VisuGUI_Slider* mySlider;
+ VisuGUI_Sweep* mySweep;
- LightApp_Displayer* myDisplayer;
- VISU::TViewToPrs3d myScalarBarsMap;
+ LightApp_Displayer* myDisplayer;
+ VISU::TViewToPrs3d myScalarBarsMap;
};
#endif
//****************************************************************
//****************************************************************
//****************************************************************
-VisuGUI_ClippingPanel::VisuGUI_ClippingPanel(VisuGUI* theModule)
- : VisuGUI_Panel(tr("TITLE"), theModule, VISU::GetDesktop(theModule), ApplyBtn | HelpBtn ),
- myModule(theModule),
+VisuGUI_ClippingPanel::VisuGUI_ClippingPanel( VisuGUI* theModule, QWidget* theParent )
+ : VisuGUI_Panel( tr( "TITLE" ), theModule, theParent, ApplyBtn | HelpBtn ),
myPlaneDlg(0),
myViewWindow(0),
myIsApplied(true)
{
+ setWindowTitle( tr( "TITLE" ) );
+ setObjectName( tr( "TITLE" ) );
+
QVBoxLayout* aMainLayout = new QVBoxLayout(mainFrame());
// List of presentations
{
Q_OBJECT
public:
- VisuGUI_ClippingPanel(VisuGUI* theModule);
+ VisuGUI_ClippingPanel(VisuGUI* theModule, QWidget* theParent = 0);
~VisuGUI_ClippingPanel();
void init();
QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
VISU::Prs3d_i* getPrs(QString theEntry);
- VisuGUI* myModule;
-
QListWidget* myPrsList;
QTableWidget* myPlanesList;
#include <LightApp_SelectionMgr.h>
-VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) :
+VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent ) :
VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ),
myActor( 0 )
{
+ setWindowTitle( tr( "WINDOW_TITLE" ) );
+ setObjectName( tr( "WINDOW_TITLE" ) );
+
QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() );
myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() );
aTopLayout->addWidget( myGrp );
- SalomeApp_Application* anApp =
- dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
}
VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel()
anIsManifoldEdges,
anIsNonManifoldEdges );
- float aColoring = myActor->GetFeatureEdgesColoring();
+ //float aColoring = myActor->GetFeatureEdgesColoring();
myAngleSpinBox->setValue( anAngle );
myFeatureEdgesCB->setChecked( anIsFeatureEdges );
void VisuGUI_FeatureEdgesPanel::onClose()
{
- close();
+ // hide();
VisuGUI_Panel::onClose();
}
onHelp();
}
}
+
+void VisuGUI_FeatureEdgesPanel::onModuleActivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleActivated();
+}
+
+void VisuGUI_FeatureEdgesPanel::onModuleDeactivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleDeactivated();
+}
Q_OBJECT
public:
- VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+ VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent = 0 );
virtual ~VisuGUI_FeatureEdgesPanel ();
protected:
virtual void keyPressEvent( QKeyEvent* theEvent );
virtual void showEvent( QShowEvent* theEvent );
+protected slots:
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
private slots:
virtual void onApply();
virtual void onClose();
\brief Frame inserted in viewport with redefined sizeHint method
in order to avoid unreasonable increasing of viewport size
*/
-class VisuGUI_Panel::MainFrame : public QFrame
+class VisuGUI_Panel::MainFrame : public QWidget
{
public:
/*!
\param theParent parent widget
*/
MainFrame( QWidget* theParent = 0 )
- : QFrame( theParent )
+ : QWidget( theParent )
{
}
/*!
\brief Constructor creates panels look and feel
- \param theName name of the panel
+ \param theName panel title
+ \param theModule parent VISU GUI module
\param theParent parent widget
+ \param theBtns panel buttons
*/
-VisuGUI_Panel::VisuGUI_Panel( const QString& theName,
- const VisuGUI* theModule,
- QWidget* theParent,
- const int theBtns )
- : QtxDockWidget( theName, theParent ),
+VisuGUI_Panel::VisuGUI_Panel( const QString& theName,
+ VisuGUI* theModule,
+ QWidget* theParent,
+ const int theBtns )
+ : QtxDockWidget( true, theParent ),
myModule( theModule ),
myOK( 0 ),
myApply( 0 ),
myClose( 0 ),
myHelp( 0 )
{
+ setObjectName( theName );
+
QWidget* aGrp = new QWidget( this );
setWidget( aGrp );
// Create scroll view
myView = new QScrollArea( aGrp );
+ myView->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
// Create main frame
myMainFrame = new MainFrame( myView );
- myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
myView->setWidget( myMainFrame );
myView->setAlignment( Qt::AlignCenter );
myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 );
// Create buttons
- QWidget* aBtnWg = new QWidget( aGrp );
- QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
+ QHBoxLayout* aBtnWgLayout = new QHBoxLayout;
+ aBtnWgLayout->setMargin( 0 );
aBtnWgLayout->addStretch();
if( theBtns & OKBtn )
{
- myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg );
+ myOK = new QPushButton( tr( "BUT_OK" ), aGrp );
aBtnWgLayout->addWidget( myOK );
connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) );
}
if( theBtns & ApplyBtn )
{
- myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg );
+ myApply = new QPushButton( tr( "BUT_APPLY" ), aGrp );
aBtnWgLayout->addWidget( myApply );
connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) );
}
if( theBtns & CloseBtn )
{
- myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg );
+ myClose = new QPushButton( tr( "BUT_CLOSE" ), aGrp );
aBtnWgLayout->addWidget( myClose );
connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) );
}
if( theBtns & HelpBtn )
{
- myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg );
+ myHelp = new QPushButton( tr( "BUT_HELP" ), aGrp );
aBtnWgLayout->addWidget( myHelp );
connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
}
// fill layout
QVBoxLayout* aLay = new QVBoxLayout( aGrp );
- aLay->setContentsMargins( 0, 0, 0, 0 );
+ aLay->setMargin( 2 );
aLay->addWidget( myView, 1 );
- aLay->addWidget( aBtnWg );
+ aLay->addLayout( aBtnWgLayout );
+
+ connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) );
+ connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) );
}
/*!
{
if ( myClose )
myClose->setFocus();
+ hide();
}
/*!
panels should use it as parent
\return QFrame* object
*/
-QFrame* VisuGUI_Panel::mainFrame()
+QWidget* VisuGUI_Panel::mainFrame()
{
return myMainFrame;
}
+
+void VisuGUI_Panel::onModuleActivated()
+{
+ widget()->setHidden( false );
+}
+
+void VisuGUI_Panel::onModuleDeactivated()
+{
+ widget()->setHidden( true );
+}
#include <QtxDockWidget.h>
-class QFrame;
class QScrollArea;
class QPushButton;
public:
VisuGUI_Panel( const QString& theName,
- const VisuGUI* theModule,
- QWidget* theParent,
- const int theBtns = AllBtn );
+ VisuGUI* theModule,
+ QWidget* theParent = 0,
+ const int theBtns = AllBtn );
virtual ~VisuGUI_Panel();
virtual bool isValid( QString& theMessage );
virtual void onClose();
virtual void onHelp();
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
protected:
- QFrame* mainFrame();
+ QWidget* mainFrame();
protected:
QScrollArea* myView;
- QFrame* myMainFrame;
+ QWidget* myMainFrame;
QPushButton* myOK;
QPushButton* myApply;
QPushButton* myClose;
QPushButton* myHelp;
- const VisuGUI* myModule;
+ VisuGUI* myModule;
};
#endif
}
};
-VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent ) :
- VisuGUI_Panel( tr("WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
+VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent ) :
+ VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
myPreferencesDlg( 0 )
{
+ setWindowTitle( tr( "WINDOW_TITLE" ) );
+ setObjectName( tr( "WINDOW_TITLE" ) );
+
QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
QWidget* aNamePane = new QWidget (mainFrame());
TopLayout->addWidget( aPrefBtn );
- SalomeApp_Application* anApp =
- dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
connect( this, SIGNAL( selectionModeChanged( int ) ), myModule, SLOT( OnSwitchSelectionMode( int ) ) );
void VisuGUI_SelectionPanel::closeEvent( QCloseEvent* theEvent )
{
- onClose();
+ //onClose();
VisuGUI_Panel::closeEvent(theEvent);
}
case GaussPointSelection:
break;
default:
- close();
+ hide();
return;
}
void VisuGUI_SelectionPanel::onClose()
{
- close();
+ //hide();
VisuGUI_Panel::onClose();
}
onHelp();
}
}
+
+void VisuGUI_SelectionPanel::onModuleActivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleActivated();
+}
+
+void VisuGUI_SelectionPanel::onModuleDeactivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleDeactivated();
+}
enum ColumnId { Cell = 0, Point, X, Y, Z, I, J, K, Scalar, Vector };
public:
- VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+ VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent = 0 );
virtual ~VisuGUI_SelectionPanel ();
public:
void setSelectionMode( int theId );
+protected slots:
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
protected:
virtual void keyPressEvent( QKeyEvent* theEvent );
virtual void showEvent( QShowEvent* theEvent );