{
QList<kerPtr> ch;
- _PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) );
- for( ; it->More(); it->Next() )
- ch.append( it->Value() );
+ _PTR( GenericAttribute ) anAttr;
+ bool expandable = true;
+ if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) {
+ _PTR(AttributeExpandable) aAttrExp = anAttr;
+ expandable = aAttrExp->IsExpandable();
+ }
+
+ if ( expandable ) {
+ _PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) );
+ for ( ; it->More(); it->Next() )
+ ch.append( it->Value() );
+ }
+
return ch;
}
return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() );
}
+/*!
+ \brief Get font to be used for data object rendering in the item views
+ \param id column id
+ \return font to be used for the item rendering
+*/
+QFont SalomeApp_DataObject::font( const int id ) const
+{
+ QFont f = LightApp_DataObject::font( id );
+ if ( id == NameId ) {
+ if ( !expandable() && hasChildren() ) {
+ // set bold font to highlight the item which is non-expandable but has children
+ f.setBold( true );
+ }
+ }
+ return f;
+}
+
/*!
\brief Get component type.
\return component type
return obj;
}
+/*!
+ \brief Check if object has children
+ \return \c true if object has at least one child sub-object and \c false otherwise
+*/
+bool SalomeApp_DataObject::hasChildren() const
+{
+ bool ok = false;
+ _PTR(ChildIterator) it ( myObject->GetStudy()->NewChildIterator( myObject ) );
+ for ( ; it->More() && !ok; it->Next() ) {
+ _PTR(SObject) obj = it->Value();
+ if ( obj ) {
+ _PTR(SObject) refObj;
+ //if ( obj->ReferencedObject( refObj ) ) continue; // omit references
+ if ( obj->GetName() != "" ) ok = true;
+ }
+ }
+ return ok;
+}
+
+/*!
+ \brief Check if the object is expandable (e.g. in the data tree view)
+ \return \c true if object is expandable and \c false otherwise
+*/
+bool SalomeApp_DataObject::expandable() const
+{
+ bool exp = true;
+ _PTR(GenericAttribute) anAttr;
+ if ( myObject->FindAttribute( anAttr, "AttributeExpandable" ) ) {
+ _PTR(AttributeExpandable) aAttrExp = anAttr;
+ exp = aAttrExp->IsExpandable();
+ }
+ return exp;
+}
+
/*!
\brief Check if the specified column supports custom sorting.
\param id column id
virtual QPixmap icon( const int = NameId ) const;
virtual QColor color( const ColorRole, const int = NameId ) const;
virtual QString toolTip( const int = NameId ) const;
+ virtual QFont font( const int = NameId ) const;
virtual _PTR(SObject) object() const;
bool isReference() const;
_PTR(SObject) referencedObject() const;
+ bool hasChildren() const;
+ bool expandable() const;
virtual QString componentDataType() const;