ACF $AcfVersion:0$
Public Types | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
iqtgui::CHierarchicalCommand Class Reference

Implementation of hierarchical command based on QAction from Qt. More...

#include <CHierarchicalCommand.h>

Inheritance diagram for iqtgui::CHierarchicalCommand:
iprm::CEnableableParam iprm::CNameParam istd::THierarchicalBase< ibase::IHierarchicalCommand > iprm::IEnableableParam iprm::INameParam istd::TChangeDelegator< Base > iser::ISerializable iser::ISerializable istd::CChangeDelegator istd::IChangeable istd::IChangeable istd::IChangeDelegator istd::IPolymorphic istd::IPolymorphic istd::IChangeable istd::IPolymorphic

Public Types

typedef QAction BaseClass
 
typedef iprm::CEnableableParam BaseClass2
 
typedef iprm::CNameParam BaseClass3
 
- Public Types inherited from iprm::IEnableableParam
enum  ChangeFlags { CF_ENABLED = 0x089347 }
 Change notification flags. More...
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0 , CF_ALL_DATA , CF_ANY , CF_DESTROYING ,
  CF_DELEGATED , CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0 , SO_OBSERVE = 1 << 0 , SO_COPY = 1 << 1 , SO_CLONE = 1 << 2 ,
  SO_COMPARE = 1 << 3 , SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT , CM_WITHOUT_REFS , CM_WITH_REFS , CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 
typedef QMultiMap< QByteArray, QVariant > ChangeInfoMap
 
- Public Types inherited from iprm::INameParam
enum  ChangeFlags { CF_RENAME = 0x15345e0 }
 Data model change notification flags. More...
 
- Public Types inherited from istd::THierarchicalBase< ibase::IHierarchicalCommand >
typedef istd::TChangeDelegator< ibase::IHierarchicalCommandBaseClass
 
- Public Types inherited from istd::TChangeDelegator< Base >
typedef Base BaseClass
 
typedef CChangeDelegator BaseClass2
 
- Public Types inherited from istd::CChangeDelegator
typedef istd::IChangeable BaseClass
 

Public Member Functions

 CHierarchicalCommand (const QString &name="", int priority=100, int staticFlags=CF_GLOBAL_MENU, int groupId=GI_NORMAL, const QByteArray &commandId=QByteArray())
 
void SetPriority (int priority)
 
void SetStaticFlags (int flags)
 
void SetCommandId (const QByteArray &commandId)
 
void SetGroupId (int groupId)
 
void ResetChilds ()
 Reset list of children.
 
void InsertChild (CHierarchicalCommand *commandPtr, bool releaseFlag=false, int index=-1)
 Insert command to child list.
 
void RemoveChild (int index)
 Remove child at specified index.
 
void JoinLinkFrom (const ibase::IHierarchicalCommand *rootPtr)
 Joint the second root as links.
 
void SetVisuals (const QString &name, const QString &shortName, const QString &description, const QIcon &icon=QIcon())
 Set all visual elements of this command.
 
virtual int GetPriority () const override
 
virtual QByteArray GetCommandId () const override
 
virtual int GetGroupId () const override
 
virtual int GetStaticFlags () const override
 
virtual bool Execute (istd::IPolymorphic *contextPtr) override
 
virtual int GetChildsCount () const override
 
virtual ibase::ICommandGetChild (int index) const override
 
virtual void SetName (const QString &name) override
 Set the object name.
 
virtual bool SetEnabled (bool isEnabled=true) override
 Set the enabled state.
 
virtual bool Serialize (iser::IArchive &archive) override
 Load or store state of this object as a archive stream.
 
virtual int GetSupportedOperations () const override
 Get set of flags for supported operations.
 
virtual bool CopyFrom (const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
 Copy this object from another one.
 
virtual istd::IChangeableUniquePtr CloneMe (istd::IChangeable::CompatibilityMode mode=istd::IChangeable::CM_WITHOUT_REFS) const override
 Make a copy of this object.
 
virtual bool IsEqual (const istd::IChangeable &object) const override
 Compare this object with another object.
 
bool operator== (const CHierarchicalCommand &command) const
 
bool operator!= (const CHierarchicalCommand &command) const
 
CHierarchicalCommandoperator= (const CHierarchicalCommand &command)
 
- Public Member Functions inherited from iprm::CEnableableParam
 CEnableableParam (bool isEnabled=true)
 
virtual bool IsEnabled () const override
 Return true if something is enabled.
 
virtual bool IsEnablingAllowed () const override
 Return true if enabling/disabling is allowed.
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
 
- Public Member Functions inherited from iser::ISerializable
virtual quint32 GetMinimalVersion (int versionId) const
 Get minimal needed version to correct storing of this data.
 
- Public Member Functions inherited from istd::IChangeable
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction.
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction.
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes.
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 
- Public Member Functions inherited from iprm::CNameParam
virtual const QString & GetName () const override
 Get the object name.
 
virtual bool IsNameFixed () const override
 Return true if the name is fixed (non-editable).
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS) override
 Reset data to its default state.
 
virtual bool IsEqual (const IChangeable &object) const override
 
- Public Member Functions inherited from istd::THierarchicalBase< ibase::IHierarchicalCommand >
 THierarchicalBase ()
 
virtual void SetParentPtr (typename Base::InterfaceType *parentPtr)
 
virtual int GetHierarchicalFlags () const override
 
virtual typename Base::InterfaceType * GetParent () const override
 
- Public Member Functions inherited from istd::TChangeDelegator< Base >
 TChangeDelegator ()
 
 TChangeDelegator (istd::IChangeable *slavePtr)
 
virtual void OnBeginChanges () override
 Callback function for begin change event.
 
virtual void OnEndChanges (const istd::IChangeable::ChangeSet &changeSet) override
 Callback function for end change event.
 
- Public Member Functions inherited from istd::CChangeDelegator
 CChangeDelegator ()
 
 CChangeDelegator (istd::IChangeable *slavePtr)
 
virtual void SetSlavePtr (istd::IChangeable *slavePtr) override
 Sets the slave object pointer for change delegation.
 
virtual istd::IChangeableGetSlavePtr () const override
 Gets the slave object pointer.
 

Protected Slots

void OnTriggered ()
 

Protected Member Functions

int FindTheSameCommand (const ibase::IHierarchicalCommand &command) const
 Find the same command in child list.
 
int FindInsertingIndex (int priority) const
 Find index where element with specified priority should be inserted.
 

Additional Inherited Members

- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes.
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set.
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set.
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set.
 
- Protected Attributes inherited from iprm::CNameParam
QString m_name
 
- Protected Attributes inherited from istd::THierarchicalBase< ibase::IHierarchicalCommand >
typename Base::InterfaceType * m_parentPtr
 

Detailed Description

Implementation of hierarchical command based on QAction from Qt.

Definition at line 30 of file CHierarchicalCommand.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 39 of file CHierarchicalCommand.h.

◆ BaseClass2

Definition at line 40 of file CHierarchicalCommand.h.

◆ BaseClass3

Definition at line 41 of file CHierarchicalCommand.h.

Constructor & Destructor Documentation

◆ CHierarchicalCommand()

iqtgui::CHierarchicalCommand::CHierarchicalCommand ( const QString &  name = "",
int  priority = 100,
int  staticFlags = CF_GLOBAL_MENU,
int  groupId = GI_NORMAL,
const QByteArray &  commandId = QByteArray() 
)
explicit

Member Function Documentation

◆ CloneMe()

virtual istd::IChangeableUniquePtr iqtgui::CHierarchicalCommand::CloneMe ( istd::IChangeable::CompatibilityMode  mode = istd::IChangeable::CM_WITHOUT_REFS) const
overridevirtual

Make a copy of this object.

Returns
new instance or NULL, if this operation is not supported.

Reimplemented from iprm::CEnableableParam.

◆ CopyFrom()

virtual bool iqtgui::CHierarchicalCommand::CopyFrom ( const istd::IChangeable object,
CompatibilityMode  mode = CM_WITHOUT_REFS 
)
overridevirtual

Copy this object from another one.

Default implementation in istd::IChangeable does nothing.

Reimplemented from istd::IChangeable.

◆ Execute()

virtual bool iqtgui::CHierarchicalCommand::Execute ( istd::IPolymorphic contextPtr)
overridevirtual

◆ FindInsertingIndex()

int iqtgui::CHierarchicalCommand::FindInsertingIndex ( int  priority) const
protected

Find index where element with specified priority should be inserted.

◆ FindTheSameCommand()

int iqtgui::CHierarchicalCommand::FindTheSameCommand ( const ibase::IHierarchicalCommand command) const
protected

Find the same command in child list.

Parameters
commandcommand will be used as search template.
Returns
index of found child or negative value, if no child is found.

◆ GetChild()

virtual ibase::ICommand * iqtgui::CHierarchicalCommand::GetChild ( int  index) const
overridevirtual

◆ GetChildsCount()

virtual int iqtgui::CHierarchicalCommand::GetChildsCount ( ) const
overridevirtual

◆ GetCommandId()

virtual QByteArray iqtgui::CHierarchicalCommand::GetCommandId ( ) const
overridevirtual

◆ GetGroupId()

virtual int iqtgui::CHierarchicalCommand::GetGroupId ( ) const
overridevirtual

◆ GetPriority()

virtual int iqtgui::CHierarchicalCommand::GetPriority ( ) const
overridevirtual

◆ GetStaticFlags()

virtual int iqtgui::CHierarchicalCommand::GetStaticFlags ( ) const
overridevirtual

◆ GetSupportedOperations()

virtual int iqtgui::CHierarchicalCommand::GetSupportedOperations ( ) const
overridevirtual

Get set of flags for supported operations.

See also
SupportedOperations

Reimplemented from istd::IChangeable.

◆ InsertChild()

void iqtgui::CHierarchicalCommand::InsertChild ( CHierarchicalCommand commandPtr,
bool  releaseFlag = false,
int  index = -1 
)

Insert command to child list.

Please note, this pointer is not owned by this container and will not be removed.

Parameters
commandPtrpointer to child command instance. It cannot be NULL.
releaseFlagif true, command instance will be automatically removed.
indexindex position of command to be inserted. Negative value indicate end of collection. Please note, that position can be other in merged tree.

◆ IsEqual()

virtual bool iqtgui::CHierarchicalCommand::IsEqual ( const istd::IChangeable object) const
overridevirtual

Compare this object with another object.

Parameters
objectObject to be compared
Returns
true if the objects are identical and false otherwise.

Reimplemented from istd::IChangeable.

◆ JoinLinkFrom()

void iqtgui::CHierarchicalCommand::JoinLinkFrom ( const ibase::IHierarchicalCommand rootPtr)

Joint the second root as links.

Parameters
rootPtrpointer to root of commands tree. It cannot be NULL.

◆ OnTriggered

void iqtgui::CHierarchicalCommand::OnTriggered ( )
protectedslot

◆ operator!=()

bool iqtgui::CHierarchicalCommand::operator!= ( const CHierarchicalCommand command) const

◆ operator=()

CHierarchicalCommand & iqtgui::CHierarchicalCommand::operator= ( const CHierarchicalCommand command)

◆ operator==()

bool iqtgui::CHierarchicalCommand::operator== ( const CHierarchicalCommand command) const

◆ RemoveChild()

void iqtgui::CHierarchicalCommand::RemoveChild ( int  index)

Remove child at specified index.

◆ ResetChilds()

void iqtgui::CHierarchicalCommand::ResetChilds ( )

Reset list of children.

◆ Serialize()

virtual bool iqtgui::CHierarchicalCommand::Serialize ( iser::IArchive archive)
overridevirtual

Load or store state of this object as a archive stream.

Type of operation is depending on archive type.

See also
iser::IArchive

Reimplemented from iprm::CEnableableParam.

◆ SetCommandId()

void iqtgui::CHierarchicalCommand::SetCommandId ( const QByteArray &  commandId)

◆ SetEnabled()

virtual bool iqtgui::CHierarchicalCommand::SetEnabled ( bool  isEnabled = true)
overridevirtual

Set the enabled state.

Changes whether the parameter is enabled or disabled.

Parameters
isEnabledNew enable state. true to enable, false to disable.
Returns
true if the state change was allowed and successful, false otherwise.
Note
Returns false if IsEnablingAllowed() returns false.
Triggers CF_ENABLED notification on successful change.
// Enable
if (param.SetEnabled(true))
{
qDebug() << "Successfully enabled";
}
// Disable
if (param.SetEnabled(false))
{
qDebug() << "Successfully disabled";
}
// Toggle
param.SetEnabled(!param.IsEnabled());
See also
IsEnabled, IsEnablingAllowed, CF_ENABLED

Reimplemented from iprm::CEnableableParam.

◆ SetGroupId()

void iqtgui::CHierarchicalCommand::SetGroupId ( int  groupId)

◆ SetName()

virtual void iqtgui::CHierarchicalCommand::SetName ( const QString &  name)
overridevirtual

Set the object name.

Changes the name of this parameter.

Parameters
nameNew name value.
Note
If IsNameFixed() returns true, setting the name may be restricted.
Triggers CF_RENAME notification on change.
if (!nameParam.IsNameFixed())
{
nameParam.SetName("New Name");
}
See also
GetName, IsNameFixed, CF_RENAME

Reimplemented from iprm::CNameParam.

◆ SetPriority()

void iqtgui::CHierarchicalCommand::SetPriority ( int  priority)

◆ SetStaticFlags()

void iqtgui::CHierarchicalCommand::SetStaticFlags ( int  flags)

◆ SetVisuals()

void iqtgui::CHierarchicalCommand::SetVisuals ( const QString &  name,
const QString &  shortName,
const QString &  description,
const QIcon &  icon = QIcon() 
)

Set all visual elements of this command.

This method is designed to use in OnRetranslate() implementation and that's why it uses Qt QString.

Parameters
namegeneral name, used in menus.
shortNameshort version of name used in toolbars.
descriptiondescription used as tool tip.
iconicon shown in menus and toolbars.

The documentation for this class was generated from the following file: