mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI );
mySelectionActivated = false;
myParamValue = "";
+ myEmptyText = "";
+ myEmptyStyleSheet ="";
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
myObjNameLineEdit = new QLineEdit(this);
myObjNameLineEdit->setReadOnly(true);
+ myObjNameLineEdit->setStyleSheet(myEmptyStyleSheet);
aHBox->addWidget( mySelButton );
aHBox->addWidget( myObjNameLineEdit );
void StdMeshersGUI_ObjectReferenceParamWdg::SetObject(CORBA::Object_ptr obj)
{
myObjects.clear();
- myObjNameLineEdit->setText( "" );
+ myObjNameLineEdit->setText( myEmptyText );
+ myObjNameLineEdit->setStyleSheet(myEmptyStyleSheet);
myParamValue = "";
_PTR(SObject) sobj;
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();
}
}
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();
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();
}
//================================================================================
}
}
}
+
+void StdMeshersGUI_ObjectReferenceParamWdg::SetDefaultText(QString defaultText, QString styleSheet)
+{
+ myEmptyText = defaultText;
+ myEmptyStyleSheet = styleSheet;
+ myObjNameLineEdit->setText( myEmptyText );
+ myObjNameLineEdit->setStyleSheet( myEmptyStyleSheet);
+}
\ No newline at end of file
{ return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
+
+ void SetDefaultText(QString defaultText="", QString styleSheet="");
public slots:
/*!
* one is activated
*/
void selectionActivated();
+ void contentModified();
private slots:
void onSelectionDone();
QLineEdit* myObjNameLineEdit;
QPushButton* mySelButton;
QString myParamValue;
+ QString myEmptyText;
+ QString myEmptyStyleSheet;
};
#endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H