mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 08:50:33 +05:00
Add default text and style sheet for StdMeshersGUI_ObjectReferenceParamWdg
This commit is contained in:
parent
96cbac2048
commit
41d66a815f
@ -110,6 +110,8 @@ void StdMeshersGUI_ObjectReferenceParamWdg::init()
|
||||
mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI );
|
||||
mySelectionActivated = false;
|
||||
myParamValue = "";
|
||||
myEmptyText = "";
|
||||
myEmptyStyleSheet ="";
|
||||
|
||||
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
|
||||
QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
@ -120,6 +122,7 @@ void StdMeshersGUI_ObjectReferenceParamWdg::init()
|
||||
|
||||
myObjNameLineEdit = new QLineEdit(this);
|
||||
myObjNameLineEdit->setReadOnly(true);
|
||||
myObjNameLineEdit->setStyleSheet(myEmptyStyleSheet);
|
||||
|
||||
aHBox->addWidget( mySelButton );
|
||||
aHBox->addWidget( myObjNameLineEdit );
|
||||
@ -190,7 +193,8 @@ void StdMeshersGUI_ObjectReferenceParamWdg::AvoidSimultaneousSelection
|
||||
void StdMeshersGUI_ObjectReferenceParamWdg::SetObject(CORBA::Object_ptr obj)
|
||||
{
|
||||
myObjects.clear();
|
||||
myObjNameLineEdit->setText( "" );
|
||||
myObjNameLineEdit->setText( myEmptyText );
|
||||
myObjNameLineEdit->setStyleSheet(myEmptyStyleSheet);
|
||||
myParamValue = "";
|
||||
|
||||
_PTR(SObject) sobj;
|
||||
@ -199,8 +203,10 @@ void StdMeshersGUI_ObjectReferenceParamWdg::SetObject(CORBA::Object_ptr obj)
|
||||
if ( sobj ) {
|
||||
std::string name = sobj->GetName();
|
||||
myObjNameLineEdit->setText( name.c_str() );
|
||||
myObjNameLineEdit->setStyleSheet("");
|
||||
myObjects.push_back( CORBA::Object::_duplicate( obj ));
|
||||
myParamValue = sobj->GetID().c_str();
|
||||
emit contentModified();
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,9 +220,11 @@ void StdMeshersGUI_ObjectReferenceParamWdg::SetObject(CORBA::Object_ptr obj)
|
||||
void StdMeshersGUI_ObjectReferenceParamWdg::SetObjects(SMESH::string_array_var& objects)
|
||||
{
|
||||
myObjects.clear();
|
||||
myObjNameLineEdit->setText( "" );
|
||||
myObjNameLineEdit->setText( myEmptyText );
|
||||
myObjNameLineEdit->setStyleSheet(myEmptyStyleSheet);
|
||||
myParamValue = "";
|
||||
|
||||
bool selChanged = false;
|
||||
|
||||
for ( unsigned i = 0; i < objects->length(); ++i )
|
||||
{
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
@ -225,15 +233,21 @@ void StdMeshersGUI_ObjectReferenceParamWdg::SetObjects(SMESH::string_array_var&
|
||||
if ( !CORBA::is_nil( anObj )) {
|
||||
std::string name = aSObj->GetName();
|
||||
QString text = myObjNameLineEdit->text();
|
||||
if ( !text.isEmpty() )
|
||||
if ( text != myEmptyText )
|
||||
text += " ";
|
||||
else
|
||||
text = "";
|
||||
text += name.c_str();
|
||||
myObjNameLineEdit->setText( text );
|
||||
myObjNameLineEdit->setStyleSheet("");
|
||||
myObjects.push_back( anObj );
|
||||
myParamValue += " ";
|
||||
myParamValue += objects[i];
|
||||
selChanged = true;
|
||||
}
|
||||
}
|
||||
if (selChanged)
|
||||
emit contentModified();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -272,3 +286,11 @@ void StdMeshersGUI_ObjectReferenceParamWdg::onSelectionDone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StdMeshersGUI_ObjectReferenceParamWdg::SetDefaultText(QString defaultText, QString styleSheet)
|
||||
{
|
||||
myEmptyText = defaultText;
|
||||
myEmptyStyleSheet = styleSheet;
|
||||
myObjNameLineEdit->setText( myEmptyText );
|
||||
myObjNameLineEdit->setStyleSheet( myEmptyStyleSheet);
|
||||
}
|
@ -79,6 +79,8 @@ public:
|
||||
{ return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
|
||||
|
||||
void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
|
||||
|
||||
void SetDefaultText(QString defaultText="", QString styleSheet="");
|
||||
|
||||
public slots:
|
||||
/*!
|
||||
@ -98,6 +100,7 @@ signals:
|
||||
* one is activated
|
||||
*/
|
||||
void selectionActivated();
|
||||
void contentModified();
|
||||
|
||||
private slots:
|
||||
void onSelectionDone();
|
||||
@ -119,6 +122,8 @@ private:
|
||||
QLineEdit* myObjNameLineEdit;
|
||||
QPushButton* mySelButton;
|
||||
QString myParamValue;
|
||||
QString myEmptyText;
|
||||
QString myEmptyStyleSheet;
|
||||
};
|
||||
|
||||
#endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
|
||||
|
Loading…
Reference in New Issue
Block a user