mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-14 18:27:27 +05:00
new methods:
1) selected - returns the selection ready to pass to dialog::selectObject 2) prefix - returns the int prefix for types corresponding to some groups (GEOM, SMESH, for example) 3) setDialogActive - allows to set dialog content enable or disable 4) slots onOk, onApply, onCancel - they will be connected automatically in startOperation if dialog has corresponding buttons
This commit is contained in:
parent
4e65ec6527
commit
3c9a866223
@ -35,10 +35,9 @@
|
|||||||
// name : SMESHGUI_Operation
|
// name : SMESHGUI_Operation
|
||||||
// Purpose : Constructor
|
// Purpose : Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* app )
|
SMESHGUI_Operation::SMESHGUI_Operation()
|
||||||
: SalomeApp_Operation( app )
|
: SalomeApp_Operation()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESHGUI_Operation::~SMESHGUI_Operation()
|
SMESHGUI_Operation::~SMESHGUI_Operation()
|
||||||
@ -116,6 +115,22 @@ SVTK_Selector* SMESHGUI_Operation::selector() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHGUI_Operation::startOperation()
|
void SMESHGUI_Operation::startOperation()
|
||||||
{
|
{
|
||||||
|
if( dlg() )
|
||||||
|
{
|
||||||
|
disconnect( dlg(), SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
|
||||||
|
disconnect( dlg(), SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
|
||||||
|
disconnect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );
|
||||||
|
|
||||||
|
if( dlg()->testButtonFlags( QtxDialog::OK ) )
|
||||||
|
connect( dlg(), SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
|
||||||
|
|
||||||
|
if( dlg()->testButtonFlags( QtxDialog::Apply ) )
|
||||||
|
connect( dlg(), SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
|
||||||
|
|
||||||
|
if( dlg()->testButtonFlags( QtxDialog::Cancel ) )
|
||||||
|
connect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );
|
||||||
|
}
|
||||||
|
|
||||||
SalomeApp_Operation::startOperation();
|
SalomeApp_Operation::startOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +190,7 @@ int SMESHGUI_Operation::typeById( const QString& str, const SelectedObjectType o
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pos = str.find( idChar() );
|
int pos = str.find( idChar() );
|
||||||
QString entry = str.left( pos-1 ),
|
QString entry = str.left( pos ),
|
||||||
_id = str.mid( pos+1 );
|
_id = str.mid( pos+1 );
|
||||||
bool ok;
|
bool ok;
|
||||||
int id = _id.toInt( &ok );
|
int id = _id.toInt( &ok );
|
||||||
@ -199,7 +214,7 @@ int SMESHGUI_Operation::typeById( const QString& str, const SelectedObjectType o
|
|||||||
// name : prefix
|
// name : prefix
|
||||||
// Purpose : Get prefix for module types
|
// Purpose : Get prefix for module types
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
int SMESHGUI_Operation::prefix( const QString& name ) const
|
int SMESHGUI_Operation::prefix( const QString& name )
|
||||||
{
|
{
|
||||||
if( name == "GEOM" )
|
if( name == "GEOM" )
|
||||||
return 100;
|
return 100;
|
||||||
@ -260,3 +275,78 @@ QChar SMESHGUI_Operation::idChar() const
|
|||||||
{
|
{
|
||||||
return '#';
|
return '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : setDialogActive
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_Operation::setDialogActive( const bool active )
|
||||||
|
{
|
||||||
|
SalomeApp_Operation::setDialogActive( active );
|
||||||
|
|
||||||
|
SMESHGUI_Dialog* d = dynamic_cast<SMESHGUI_Dialog*>( dlg() );
|
||||||
|
if( d )
|
||||||
|
d->setContentActive( active );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : studyDS
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
_PTR(Study) SMESHGUI_Operation::studyDS() const
|
||||||
|
{
|
||||||
|
SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study() );
|
||||||
|
if( s )
|
||||||
|
return s->studyDS();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : onOk
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_Operation::onOk()
|
||||||
|
{
|
||||||
|
if( onApply() )
|
||||||
|
commit();
|
||||||
|
else
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : onApply
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool SMESHGUI_Operation::onApply()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : onClose
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_Operation::onCancel()
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : commitOperation
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_Operation::commitOperation()
|
||||||
|
{
|
||||||
|
selectionMgr()->clearFilters();
|
||||||
|
SalomeApp_Operation::commitOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : abortOperation
|
||||||
|
// Purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_Operation::abortOperation()
|
||||||
|
{
|
||||||
|
selectionMgr()->clearFilters();
|
||||||
|
SalomeApp_Operation::abortOperation();
|
||||||
|
}
|
||||||
|
@ -13,9 +13,12 @@
|
|||||||
#define SMESHGUI_Operation_H
|
#define SMESHGUI_Operation_H
|
||||||
|
|
||||||
#include <SalomeApp_Operation.h>
|
#include <SalomeApp_Operation.h>
|
||||||
|
#include <SMESHGUI_Dialog.h>
|
||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
#include <SVTK_Selection.h>
|
#include <SVTK_Selection.h>
|
||||||
|
|
||||||
|
#include <SALOMEDSClient.hxx>
|
||||||
|
|
||||||
class SMESHGUI;
|
class SMESHGUI;
|
||||||
class SVTK_ViewWindow;
|
class SVTK_ViewWindow;
|
||||||
class SVTK_Selector;
|
class SVTK_Selector;
|
||||||
@ -32,9 +35,12 @@ class SMESHGUI_Operation : public SalomeApp_Operation
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_Operation( SalomeApp_Application* );
|
SMESHGUI_Operation();
|
||||||
virtual ~SMESHGUI_Operation();
|
virtual ~SMESHGUI_Operation();
|
||||||
|
|
||||||
|
static int prefix( const QString& );
|
||||||
|
// Return hard-coded prefix using to differ intersecting types
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -52,27 +58,33 @@ protected:
|
|||||||
const TColStd_MapOfInteger&, const bool );
|
const TColStd_MapOfInteger&, const bool );
|
||||||
|
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
|
virtual void commitOperation();
|
||||||
|
virtual void abortOperation();
|
||||||
virtual bool isReadyToStart();
|
virtual bool isReadyToStart();
|
||||||
|
|
||||||
SMESHGUI* getSMESHGUI() const;
|
SMESHGUI* getSMESHGUI() const;
|
||||||
SVTK_ViewWindow* viewWindow() const;
|
SVTK_ViewWindow* viewWindow() const;
|
||||||
SVTK_Selector* selector() const;
|
SVTK_Selector* selector() const;
|
||||||
|
|
||||||
|
_PTR(Study) studyDS() const;
|
||||||
|
|
||||||
|
|
||||||
virtual int prefix( const QString& ) const;
|
//! Get names, types and ids of selected objects
|
||||||
// Return hard-coded prefix using to differ intersecting types
|
virtual void selected( QStringList&, SMESHGUI_Dialog::TypesList&, QStringList& ) const;
|
||||||
|
|
||||||
virtual void selected( QStringList&, SalomeApp_Dialog::TypesList&, QStringList& ) const;
|
|
||||||
// Get names, types and ids of selected objects
|
|
||||||
|
|
||||||
virtual int typeById( const QString&, const SelectedObjectType ) const;
|
|
||||||
// Find type by id
|
|
||||||
|
|
||||||
virtual QChar idChar() const;
|
|
||||||
// Char using to divide <entry> and <id> in string id representation
|
|
||||||
// By default, '#'
|
|
||||||
|
|
||||||
|
//! Find type by id
|
||||||
|
virtual int typeById( const QString&, const SelectedObjectType ) const;
|
||||||
|
|
||||||
|
//! Char using to divide <entry> and <id> in string id representation. By default, '#'
|
||||||
|
virtual QChar idChar() const;
|
||||||
|
|
||||||
|
//! Set accroding dialog active or inactive
|
||||||
|
virtual void setDialogActive( const bool );
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void onOk();
|
||||||
|
virtual bool onApply();
|
||||||
|
virtual void onCancel();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user