Version: 6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Friends

SalomeApp_DataObject Class Reference

Implementation of the data object for use in CORBA-based SALOME modules.

#include <SalomeApp_DataObject.h>

Inheritance diagram for SalomeApp_DataObject:
Inheritance graph

Public Types

enum  { ValueId = EntryId + 1, IORId, RefEntryId }
 

Column id.

More...
enum  { EntryId = VisibilityId + 1 }
 

Column id.

More...
enum  ColorRole {
  Text, Base, Foreground, Background,
  Highlight, HighlightedText
}
 

Color role.

More...
enum  { NameId, VisibilityId }
 

Column id.

More...

Public Member Functions

 SalomeApp_DataObject (SUIT_DataObject *=0)
 Constructor.
 SalomeApp_DataObject (const _PTR(SObject)&, SUIT_DataObject *=0)
 Constructor.
virtual ~SalomeApp_DataObject ()
 Destructor.
virtual QString name () const
 Get data object name.
virtual QString entry () const
 Get object string identifier.
virtual QString text (const int=NameId) const
 Get object text data for the specified column.
virtual QPixmap icon (const int=NameId) const
 Get data object icon for the specified column.
virtual QColor color (const ColorRole, const int=NameId) const
 Get data object color for the specified column.
virtual QString toolTip (const int=NameId) const
 Get data object tooltip for the specified column.
virtual QFont font (const int=NameId) const
 Get font to be used for data object rendering in the item views.
virtual _PTR (SObject) object() const
bool isReference () const
 Check if the data object is a reference.
 _PTR (SObject) referencedObject() const
bool hasChildren () const
 Check if object has children.
bool expandable () const
 Check if the object is expandable (e.g. in the data tree view)
virtual bool isVisible () const
 Check if the object is visible.
virtual QString componentDataType () const
 Get component type.
virtual bool customSorting (const int=NameId) const
 Check if the specified column supports custom sorting.
virtual bool compare (const QVariant &, const QVariant &, const int=NameId) const
 Compares data from two items for sorting purposes.
virtual void insertChildAtTag (SalomeApp_DataObject *, int)
virtual void updateItem ()
virtual SUIT_DataObjectKeykey () const
 Get the data object unique key.
virtual SUIT_DataObjectcomponentObject () const
 Get the component object.
virtual int groupId () const
virtual QVariant customData (Qtx::CustomDataType type)
 return custom data for data object
virtual bool renameAllowed (const int=NameId) const
 Check if this object is can't be renamed in place.
virtual bool setName (const QString &)
 Set name of the this object.
CAM_Modulemodule () const
 Get CAM module.
virtual CAM_DataModeldataModel () const
 Get CAM data model.
SUIT_DataObjectroot () const
 Get the root object.
SUIT_DataObjectlastChild () const
 Get the last child object.
SUIT_DataObjectfirstChild () const
 Get the first child object.
int childCount () const
 Get the number of the child objects.
int childPos (const SUIT_DataObject *) const
 Get the index of the specified object in the child list.
SUIT_DataObjectchildObject (const int) const
 Get child object by the specified index.
int level () const
 Get the object level in the tree structure.
int position () const
 Get the position of the data object in its parent's children list.
SUIT_DataObjectnextBrother () const
 Get the next sibling data object in the children list.
SUIT_DataObjectprevBrother () const
 Get the previous sibling data object in the children list.
bool autoDeleteChildren () const
 Get "auto-delete children" flag.
virtual void setAutoDeleteChildren (const bool)
 Set "auto-delete children" flag.
virtual void children (DataObjectList &, const bool=false) const
 Get all children.
virtual DataObjectList children (const bool=false)
 Get all children. .
void appendChild (SUIT_DataObject *)
 Add new child object to the end of the children list.
virtual void insertChild (SUIT_DataObject *, int)
 Insert new child object to the list of the children.
virtual void removeChild (SUIT_DataObject *, const bool=false)
 Remove the specified child object reference.
bool replaceChild (SUIT_DataObject *, SUIT_DataObject *, const bool=false)
 Replace the specified child object by another object.
void reparentChildren (const SUIT_DataObject *)
 Change the parent for all children from specified object to this one.
virtual SUIT_DataObjectparent () const
 Get the parent object.
virtual void setParent (SUIT_DataObject *)
 Change the parent object.
virtual void assignParent (SUIT_DataObject *)
void insertChildAtPos (SUIT_DataObject *obj, int position)
 Insert new child object into the list of the children (faster version of insertChild without signal).
bool modified ()
void setModified (bool modified)
virtual QString statusTip (const int=NameId) const
 Get data object status tip for the specified column.
virtual QString whatsThis (const int=NameId) const
 Get data object "what's this" information for the specified column.
virtual int alignment (const int=NameId) const
 Get data object text alignment for the specified column.
virtual bool isDragable () const
 Check if the object is draggable.
virtual bool isDropAccepted (SUIT_DataObject *obj)
 Check if the drop operation fo this object is possible.
virtual bool isEnabled () const
 Check if this object is enabled.
virtual bool isSelectable () const
 Check if this object is selectable.
virtual bool isCheckable (const int=NameId) const
 Check if this object is checkable for the specified column.
virtual bool isOn (const int=NameId) const
 Get the checked state of the object (if it is checkable) for the specified column.
virtual void setOn (const bool, const int=NameId)
 Set the checked state of the object (if it is checkable) for the specified column.
virtual bool isOpen () const
 Get the "opened" state of the object.
virtual void setOpen (const bool)
 Set the "opened" state of the object.
virtual void update ()
 Updates necessary internal fields of data object.
void deleteLater ()
 Schedule this object for the late deleting.
void dump (const int indent=2) const
 Dump the object tree recursively to the standard output.

Static Public Member Functions

static Signalsignal ()
 Get global signal handler.
static bool connect (const char *, QObject *, const char *)
 Connect to the signal handlerx.
static bool disconnect (const char *, QObject *, const char *)
 Disconnect from the signal handler.

Protected Attributes

QString myCompDataType
SUIT_DataObjectmyCompObject

Private Member Functions

QString ior (const _PTR(SObject)&) const
 Get data object IOR.
QString entry (const _PTR(SObject)&) const
 Get data object entry identifier.
QString value (const _PTR(SObject)&) const
 Get data object value.
 _PTR (SObject) myObject

Friends

class SUIT_DataObject::Signal

Member Enumeration Documentation

anonymous enum
Enumerator:
ValueId 

value column

IORId 

IOR column.

RefEntryId 

reference entry column

anonymous enum [inherited]
Enumerator:
EntryId 

entry column

enum SUIT_DataObject::ColorRole [inherited]
Enumerator:
Text 

editor foreground (text) color

Base 

editor background color

Foreground 

foreground (text) color

Background 

background color

Highlight 

highlight background color

HighlightedText 

highlighted foreground (text) color

anonymous enum [inherited]
Enumerator:
NameId 

name column

VisibilityId 

visibility state column


Constructor & Destructor Documentation

SalomeApp_DataObject::SalomeApp_DataObject ( SUIT_DataObject parent = 0)
Parameters:
parentparent data object
SalomeApp_DataObject::SalomeApp_DataObject ( const _PTR(SObject)&  sobj,
SUIT_DataObject parent = 0 
)
Parameters:
sobjSALOMEDS object
parentparent data object
SalomeApp_DataObject::~SalomeApp_DataObject ( ) [virtual]

Member Function Documentation

QString SalomeApp_DataObject::name ( ) const [virtual]
Returns:
object name

Reimplemented from SUIT_DataObject.

Reimplemented in SalomeApp_ModuleObject, and SalomeApp_RootObject.

References _PTR(), and isReference().

QString SalomeApp_DataObject::entry ( ) const [virtual]
Returns:
object ID

Reimplemented from LightApp_DataObject.

Reimplemented in SalomeApp_RootObject.

QString SalomeApp_DataObject::text ( const int  id = NameId) const [virtual]

This method returns the data according to the specufied column id:

  • NameId : object name (by calling name() method)
  • EntryId : object entry (by calling entry() method)
  • ValueId : object value
  • IORId : object IOR
  • RefEntryId : object reference entry
Parameters:
idcolumn id
Returns:
object text data

Reimplemented from LightApp_DataObject.

Reimplemented in SalomeApp_RootObject.

References LightApp_DataObject.componentObject(), entry(), ior(), IORId, isReference(), RefEntryId, value(), and ValueId.

QPixmap SalomeApp_DataObject::icon ( const int  id = NameId) const [virtual]
Parameters:
idcolumn id
Returns:
object icon for the specified column

Reimplemented from SUIT_DataObject.

Reimplemented in SalomeApp_ModuleObject, and SalomeApp_RootObject.

References _PTR(), componentDataType(), QtxResourceMgr.loadPixmap(), SUIT_DataObject.NameId, and SUIT_DataObject.root().

QColor SalomeApp_DataObject::color ( const ColorRole  role,
const int  id = NameId 
) const [virtual]
Parameters:
rolecolor role
idcolumn id (not used)
Returns:
object color for the specified column

Reimplemented from SUIT_DataObject.

Reimplemented in SalomeApp_RootObject.

References _PTR(), test_table.c, SUIT_DataObject.color(), SUIT_DataObject.Foreground, SUIT_DataObject.Highlight, SUIT_DataObject.HighlightedText, isReference(), and SUIT_DataObject.Text.

QString SalomeApp_DataObject::toolTip ( const int  = NameId) const [virtual]
QFont SalomeApp_DataObject::font ( const int  id = NameId) const [virtual]
Parameters:
idcolumn id
Returns:
font to be used for the item rendering

Reimplemented from SUIT_DataObject.

References expandable(), hasChildren(), and SUIT_DataObject.NameId.

virtual SalomeApp_DataObject._PTR ( SObject  ) const [virtual]
bool SalomeApp_DataObject::isReference ( ) const
Returns:
true if this data object actually refers to another one

References _PTR().

SalomeApp_DataObject._PTR ( SObject  ) const
bool SalomeApp_DataObject::hasChildren ( ) const
Returns:
true if object has at least one child sub-object and false otherwise

References _PTR(), and PyInterp.obj.

bool SalomeApp_DataObject::expandable ( ) const [virtual]
Returns:
true if object is expandable and false otherwise

Reimplemented from SUIT_DataObject.

References _PTR().

bool SalomeApp_DataObject::isVisible ( ) const [virtual]
Returns:
true if this object is displayable or false otherwise

Reimplemented from LightApp_DataObject.

References _PTR(), isReference(), and name().

QString SalomeApp_DataObject::componentDataType ( ) const [virtual]
Returns:
component type

Reimplemented from LightApp_DataObject.

References _PTR(), LightApp_DataObject.componentObject(), and LightApp_DataObject.myCompDataType.

bool SalomeApp_DataObject::customSorting ( const int  id = NameId) const [virtual]
Parameters:
idcolumn id
Returns:
true if column sorting should be customized
See also:
compare()

Reimplemented from LightApp_DataObject.

References LightApp_DataObject.EntryId, and RefEntryId.

bool SalomeApp_DataObject::compare ( const QVariant &  left,
const QVariant &  right,
const int  id = NameId 
) const [virtual]

This method is called only for those columns for which customSorting() method returns true.

Parameters:
leftfirst data to compare
rightsecond data to compare
idcolumn id
Returns:
result of the comparison
See also:
customSorting()

Reimplemented from LightApp_DataObject.

References LightApp_DataObject.EntryId, and RefEntryId.

void SalomeApp_DataObject::insertChildAtTag ( SalomeApp_DataObject obj,
int  tag 
) [virtual]
void SalomeApp_DataObject::updateItem ( ) [virtual]
QString SalomeApp_DataObject::ior ( const _PTR(SObject)&  obj) const [private]
Parameters:
objdata object
Returns:
data object IOR or null string if IOR is empty

References _PTR().

QString SalomeApp_DataObject::entry ( const _PTR(SObject)&  obj) const [private]
Parameters:
objdata object
Returns:
data object entry identifier or empty object does not have entry
QString SalomeApp_DataObject::value ( const _PTR(SObject)&  obj) const [private]
Parameters:
objdata object
Returns:
data object value or empty string if there is no value associated to the object

References _PTR(), and SUIT_DataObject.root().

SalomeApp_DataObject._PTR ( SObject  ) [private]
SUIT_DataObjectKey * LightApp_DataObject::key ( ) const [virtual, inherited]
Returns:
data object key

Reimplemented from SUIT_DataObject.

References LightApp_DataObject.entry().

SUIT_DataObject * LightApp_DataObject::componentObject ( ) const [virtual, inherited]
Returns:
component data object

References LightApp_DataObject.myCompObject, SUIT_DataObject.parent(), and SUIT_DataObject.root().

int LightApp_DataObject::groupId ( ) const [virtual, inherited]
QVariant LightApp_DataObject::customData ( Qtx::CustomDataType  type) [virtual, inherited]

Reimplemented from SUIT_DataObject.

References LightApp_DataObject.EntryId, and Qtx.IdType.

bool LightApp_DataObject::renameAllowed ( const int  id = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false (all objects can not be renamed).

Parameters:
idcolumn id
Returns:
true if the item can be renamed by the user in place (e.g. in the Object browser)

Reimplemented from SUIT_DataObject.

References SUIT_Study.application(), LightApp_DataObject.entry(), CAM_DataObject.module(), SUIT_DataObject.NameId, LightApp_Application.renameAllowed(), LightApp_Module.renameAllowed(), SUIT_DataObject.root(), and LightApp_RootObject.study().

bool LightApp_DataObject::setName ( const QString &  name) [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false.

Returns:
true if rename operation finished successfully, false otherwise.

Reimplemented from SUIT_DataObject.

Reimplemented in SALOME_PYQT_DataObjectLight.

References SUIT_Study.application(), LightApp_DataObject.entry(), CAM_DataObject.module(), LightApp_Application.renameObject(), LightApp_Module.renameObject(), SUIT_DataObject.root(), and LightApp_RootObject.study().

CAM_Module * CAM_DataObject::module ( ) const [inherited]
Returns:
parent module object pointer

References CAM_DataObject.dataModel(), and CAM_DataModel.module().

CAM_DataModel * CAM_DataObject::dataModel ( ) const [virtual, inherited]
Returns:
data model or 0 if it is not set
See also:
CAM_ModuleObject class

Reimplemented in CAM_ModuleObject.

References CAM_DataObject.dataModel(), and SUIT_DataObject.parent().

SUIT_DataObject * SUIT_DataObject::root ( ) const [inherited]
Returns:
root object of the data tree

References SUIT_DataObject.parent(), and SUIT_DataObject.root().

SUIT_DataObject * SUIT_DataObject::lastChild ( ) const [inherited]
Returns:
last child object or 0 if there are no children
See also:
firstChild()

References SUIT_DataObject.myChildren.

SUIT_DataObject * SUIT_DataObject::firstChild ( ) const [inherited]
Returns:
first child object or 0 if there are no children
See also:
lastChild()

References SUIT_DataObject.myChildren.

int SUIT_DataObject::childCount ( ) const [inherited]
Returns:
number of the children

References SUIT_DataObject.myChildren.

int SUIT_DataObject::childPos ( const SUIT_DataObject obj) const [inherited]
Parameters:
objchild object
Returns:
subobject position or -1 if it does not belong to this object

References SUIT_DataObject.myChildren.

SUIT_DataObject * SUIT_DataObject::childObject ( const int  idx) const [inherited]
Parameters:
idxchild object index
Returns:
child object or 0 if index is out of range

References SUIT_DataObject.myChildren.

int SUIT_DataObject::level ( ) const [inherited]

Root object has level 0.

Returns:
object level.

References SUIT_DataObject.parent().

int SUIT_DataObject::position ( ) const [inherited]
Returns:
data object position

References SUIT_DataObject.childPos(), and SUIT_DataObject.myParent.

SUIT_DataObject * SUIT_DataObject::nextBrother ( ) const [inherited]
Returns:
child object or 0 if there is no next sibling
See also:
prevBrother()

References SUIT_DataObject.childObject(), SUIT_DataObject.childPos(), and SUIT_DataObject.myParent.

SUIT_DataObject * SUIT_DataObject::prevBrother ( ) const [inherited]
Returns:
child object or 0 if there is no previous sibling
See also:
nextBrother()

References SUIT_DataObject.childObject(), SUIT_DataObject.childPos(), and SUIT_DataObject.myParent.

bool SUIT_DataObject::autoDeleteChildren ( ) const [inherited]
Returns:
true if the object should delete all its children on destroying
See also:
setAutoDeleteChildren()

References SUIT_DataObject.myAutoDel.

void SUIT_DataObject::setAutoDeleteChildren ( const bool  on) [virtual, inherited]

If this flag is on (default), the object will delete all its children on destroying.

Parameters:
onnew flag value
See also:
autoDeleteChildren()

References SUIT_DataObject.myAutoDel.

void SUIT_DataObject::children ( DataObjectList lst,
const bool  rec = false 
) const [virtual, inherited]

If parameter rec is true then function collects all the children recursively.

Parameters:
lstreturning list of children
recif true collect all children recursively

References SUIT_DataObject.myChildren.

DataObjectList SUIT_DataObject::children ( const bool  rec = false) [virtual, inherited]

If parameter rec is true then function collects all the children recursively.

Parameters:
recif true collect all children recursively
Returns:
list of children

References SUIT_DataObject.children().

void SUIT_DataObject::appendChild ( SUIT_DataObject obj) [inherited]
Parameters:
objchild object being added

References SUIT_DataObject.insertChild(), and SUIT_DataObject.myChildren.

void SUIT_DataObject::insertChild ( SUIT_DataObject obj,
int  position 
) [virtual, inherited]
Parameters:
objchild object being added
positionchild position

Reimplemented in LightApp_ModuleObject.

References SUIT_DataObject.Signal.emitInserted(), SUIT_DataObject.myChildren, SUIT_DataObject.position(), SUIT_DataObject.setParent(), and SUIT_DataObject.signal().

void SUIT_DataObject::removeChild ( SUIT_DataObject obj,
const bool  del = false 
) [virtual, inherited]
Parameters:
objchild object being removed
delif true, the child object is destroyed

References SUIT_DataObject.deleteLater(), SUIT_DataObject.Signal.emitRemoved(), SUIT_DataObject.myChildren, SUIT_DataObject.setParent(), and SUIT_DataObject.signal().

bool SUIT_DataObject::replaceChild ( SUIT_DataObject src,
SUIT_DataObject trg,
const bool  del = false 
) [inherited]
Parameters:
srcchild object being replaced
trgnew child object
delif true, the previous object is destroyed
Returns:
true if the object has been replaced

References SUIT_DataObject.childPos(), SUIT_DataObject.deleteLater(), SUIT_DataObject.insertChild(), and SUIT_DataObject.removeChild().

void SUIT_DataObject::reparentChildren ( const SUIT_DataObject obj) [inherited]
Parameters:
objobject which children to be reparented

References SUIT_DataObject.children().

SUIT_DataObject * SUIT_DataObject::parent ( ) const [virtual, inherited]
Returns:
parent object or 0 if this is top-level item

References SUIT_DataObject.myParent.

void SUIT_DataObject::setParent ( SUIT_DataObject p) [virtual, inherited]
void SUIT_DataObject::assignParent ( SUIT_DataObject p) [virtual, inherited]
void SUIT_DataObject::insertChildAtPos ( SUIT_DataObject obj,
int  position 
) [inherited]
Parameters:
objchild object being added
positionchild position

References SUIT_DataObject.assignParent(), SUIT_DataObject.myChildren, and SUIT_DataObject.position().

bool SUIT_DataObject.modified ( ) [inherited]
void SUIT_DataObject.setModified ( bool  modified) [inherited]
QString SUIT_DataObject::statusTip ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns null string.

The parameter id specifies the column identificator

Parameters:
idcolumn id
Returns:
object status tip for the specified column
QString SUIT_DataObject::whatsThis ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns null string.

The parameter id specifies the column identificator

Parameters:
idcolumn id
Returns:
object "what's this" information for the specified column
int SUIT_DataObject::alignment ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns default alignment which is Qt:AlignLeft.

The parameter id specifies the column identificator (to display, for example, in the tree view widget).

Parameters:
idcolumn id
Returns:
object text alignment flags for the specified column
bool SUIT_DataObject::isDragable ( ) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false (all objects could not be dragged).

Returns:
true if it is possible to drag this object
bool SUIT_DataObject::isDropAccepted ( SUIT_DataObject obj) [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false (drop operation is not allowed).

Parameters:
objobject being dropped
Returns:
true if it is possible to drop an object obj to this object
bool SUIT_DataObject::isEnabled ( ) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns true (all objects are enabled).

Returns:
true if the user can interact with the item
bool SUIT_DataObject::isSelectable ( ) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns true (all objects are selectable).

Returns:
true if the item can be selected
bool SUIT_DataObject::isCheckable ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false (all objects are not checkable).

Parameters:
idcolumn id
Returns:
true if the item can be checked or unchecked by the user
See also:
isOn(), setOn()
bool SUIT_DataObject::isOn ( const int  id = NameId) const [virtual, inherited]

Default implementation supports the checked state for the first ("Name") column only.

Parameters:
idcolumn id
Returns:
checked state of the object for the specified column
See also:
setOn(), isCheckable()

References SUIT_DataObject.myCheck, and SUIT_DataObject.NameId.

void SUIT_DataObject::setOn ( const bool  on,
const int  id = NameId 
) [virtual, inherited]

Default implementation supports the checked state for the first ("Name") column only.

Parameters:
onnew checked state of the object for the specified column
idcolumn id
See also:
isOn(), isCheckable()

References SUIT_DataObject.myCheck, and SUIT_DataObject.NameId.

bool SUIT_DataObject::isOpen ( ) const [virtual, inherited]
Returns:
"opened" state of the object
See also:
setOpen()

References SUIT_DataObject.myOpen.

void SUIT_DataObject::setOpen ( const bool  on) [virtual, inherited]
Parameters:
onnew "opened" state of the object
See also:
isOpen()

References SUIT_DataObject.myOpen.

void SUIT_DataObject::update ( ) [virtual, inherited]
SUIT_DataObject::Signal * SUIT_DataObject::signal ( ) [static, inherited]
Returns:
the only instance of the signal handler

References SUIT_DataObject.mySignal.

bool SUIT_DataObject::connect ( const char *  sig,
QObject reciever,
const char *  slot 
) [static, inherited]
Parameters:
sigsignal name
recieversignal receiver object
slotslot name
Returns:
true if connection is successfull

References SUIT_DataObject.signal().

bool SUIT_DataObject::disconnect ( const char *  sig,
QObject reciever,
const char *  slot 
) [static, inherited]
Parameters:
sigsignal name
recieversignal receiver object
slotslot name
Returns:
true if disconnection is successfull

References SUIT_DataObject.signal().

void SUIT_DataObject::deleteLater ( ) [inherited]

The object will be deleted when control returns to the event loop. Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.

References SUIT_DataObject.Signal.deleteLater(), SUIT_DataObject.parent(), SUIT_DataObject.removeChild(), and SUIT_DataObject.signal().

void SUIT_DataObject::dump ( const int  indent = 2) const [inherited]
Parameters:
indentcurrent indentation level

References SUIT_DataObject.myChildren, and SUIT_DataObject.name().


Friends And Related Function Documentation

friend class SUIT_DataObject::Signal [friend, inherited]

Field Documentation

QString LightApp_DataObject.myCompDataType [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS