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

CAM_ModuleObject Class Reference

CAM data model root object. More...

#include <CAM_DataObject.h>

Inheritance diagram for CAM_ModuleObject:
Inheritance graph

Public Types

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

Color role.

More...
enum  { NameId, VisibilityId }
 

Column id.

More...

Public Member Functions

 CAM_ModuleObject (SUIT_DataObject *=0)
 Constructor.
 CAM_ModuleObject (CAM_DataModel *, SUIT_DataObject *=0)
 Constructor.
virtual ~CAM_ModuleObject ()
 Destructor.
virtual QString name () const
 Get root object name.
QPixmap icon (const int=NameId) const
 Get data object icon for the specified column.
QString toolTip (const int=NameId) const
 Get data object tooltip for the specified column.
virtual CAM_DataModeldataModel () const
 Get data model.
virtual void setDataModel (CAM_DataModel *)
 Set data model.
CAM_Modulemodule () const
 Get CAM module.
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 text (const int=NameId) const
 Get object text data for the specified column.
virtual QColor color (const ColorRole, const int=NameId) const
 Get data object color for the specified column.
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 QFont font (const int=NameId) const
 Get data object font for the specified column.
virtual int alignment (const int=NameId) const
 Get data object text alignment for the specified column.
virtual bool expandable () const
virtual bool isVisible () const
 Check if the object is visible.
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 renameAllowed (const int=NameId) const
 Check if this object is can't be renamed in place.
virtual bool setName (const QString &name)
 Set name of the this object.
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.
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 SUIT_DataObjectKeykey () const
 Get the object unique indentification key.
virtual int groupId () const
 return unique group identificator
virtual QVariant customData (Qtx::CustomDataType)
 return custom data for 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.

Private Attributes

CAM_DataModelmyDataModel

Friends

class SUIT_DataObject::Signal

Detailed Description

This class is intended for optimized access to CAM_DataModel instance from CAM_DataObject instances.

To take advantage of this class in a specific application, custom data model root object class should be derived from both CAM_ModuleObject and application-specific DataObject implementation using virtual inheritance.


Member Enumeration Documentation

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

CAM_ModuleObject::CAM_ModuleObject ( SUIT_DataObject parent = 0)
Parameters:
parentparent data object
CAM_ModuleObject::CAM_ModuleObject ( CAM_DataModel data,
SUIT_DataObject parent = 0 
)
Parameters:
datadata model
parentparent data object
CAM_ModuleObject::~CAM_ModuleObject ( ) [virtual]

Does nothing.


Member Function Documentation

QString CAM_ModuleObject::name ( ) const [virtual]

If the data model is set, this method returns module name. Otherwise returns empty string.

Returns:
root object name

Reimplemented from SUIT_DataObject.

Reimplemented in LightApp_ModuleObject, and SalomeApp_ModuleObject.

References CAM_DataModel.module(), CAM_Module.moduleName(), and myDataModel.

QPixmap CAM_ModuleObject::icon ( const int  id = NameId) const [virtual]

The parameter id specifies the column identificator

Parameters:
idcolumn id
Returns:
object icon for the specified column

Reimplemented from SUIT_DataObject.

Reimplemented in LightApp_ModuleObject, and SalomeApp_ModuleObject.

References dataModel(), CAM_DataModel.module(), CAM_DataObject.module(), CAM_Module.moduleIcon(), SUIT_DataObject.NameId, and Qtx.scaleIcon().

QString CAM_ModuleObject::toolTip ( const int  = NameId) const [virtual]

The parameter id specifies the column identificator

Parameters:
idcolumn id
Returns:
object tooltip for the specified column

Reimplemented from SUIT_DataObject.

Reimplemented in LightApp_ModuleObject, and SalomeApp_ModuleObject.

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

CAM_DataModel * CAM_ModuleObject::dataModel ( ) const [virtual]
Returns:
data model pointer or 0 if it is not set

Reimplemented from CAM_DataObject.

References myDataModel.

void CAM_ModuleObject::setDataModel ( CAM_DataModel dm) [virtual]
Parameters:
dmdata model

References myDataModel.

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

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

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::text ( const int  id = NameId) const [virtual, inherited]

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

Column with id = 0 (NameId) is supposed to be used to get the object name (as it does the default implementation).

Parameters:
idcolumn id
Returns:
object text data

Reimplemented in LightApp_DataObject, SalomeApp_DataObject, and SalomeApp_RootObject.

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

QColor SUIT_DataObject::color ( const ColorRole  ,
const int  = NameId 
) const [virtual, inherited]

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

The parameter id specifies the column identificator

Parameters:
rolecolor role
idcolumn id
Returns:
object color for the specified column

Reimplemented in SalomeApp_DataObject, and SalomeApp_RootObject.

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
QFont SUIT_DataObject::font ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns application default font.

The parameter id specifies the column identificator

Parameters:
idcolumn id
Returns:
object font for the specified column

Reimplemented in SalomeApp_DataObject.

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::expandable ( ) const [virtual, inherited]

Reimplemented in SalomeApp_DataObject.

bool SUIT_DataObject::isVisible ( ) const [virtual, inherited]

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

Returns:
true if this object is displayable or false otherwise

Reimplemented in LightApp_DataObject, and SalomeApp_DataObject.

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::renameAllowed ( const int  = 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 in LightApp_DataObject.

bool SUIT_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 in LightApp_DataObject, and SALOME_PYQT_DataObjectLight.

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]
bool SUIT_DataObject::customSorting ( const int  = NameId) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false ("Name" column does not require custom sorting).

Parameters:
idcolumn id
Returns:
true if column sorting should be customized
See also:
compare()

Reimplemented in LightApp_DataObject, and SalomeApp_DataObject.

bool SUIT_DataObject::compare ( const QVariant &  ,
const QVariant &  ,
const int  = NameId 
) const [virtual, inherited]

This method can be re-implemented in the subclasses. Default implementation returns false ("Name" column does not require custom sorting).

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 in LightApp_DataObject, and SalomeApp_DataObject.

SUIT_DataObjectKey * SUIT_DataObject::key ( ) const [virtual, inherited]

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

Returns:
object key

Reimplemented in LightApp_DataObject.

int SUIT_DataObject::groupId ( ) const [virtual, inherited]

Groups of data objects are used for column information search. Each column of data model has one or several registered group id If object has the same group id as one of registered, the information will be shown; the custom id of column will be passed into data() method in order to identify column from point of view of data object

Reimplemented in LightApp_DataObject.

QVariant SUIT_DataObject::customData ( Qtx::CustomDataType  ) [virtual, inherited]

Reimplemented in LightApp_DataObject.

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

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