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

Component realizing static connection between GUI and model components. More...

#include <CModelEditorGuiComp.h>

Inheritance diagram for iqtgui::CModelEditorGuiComp:
icomp::CComponentBase iqtgui::IGuiObject imod::IModelEditor icomp::IComponent istd::IPolymorphic istd::IPolymorphic istd::IPolymorphic

Public Types

typedef icomp::CComponentBase BaseClass
 
- Public Types inherited from imod::IModelEditor
enum  ChangeFlags { CF_INIT_EDITOR = 0x3720694 }
 Data model change notification flags. More...
 

Public Member Functions

 CModelEditorGuiComp ()
 
virtual bool IsGuiCreated () const override
 Checks if the GUI has been initialized and created.
 
virtual bool CreateGui (QWidget *parentPtr) override
 Initializes the GUI and connects it to the parent widget.
 
virtual bool DestroyGui () override
 Releases GUI resources and disconnects from the parent.
 
virtual QWidget * GetWidget () const override
 Gets access to the internal QWidget object.
 
virtual void OnTryClose (bool *ignoredPtr=NULL) override
 Called when the application is attempting to close.
 
virtual void UpdateEditor (const istd::IChangeable::ChangeSet &changeSet) override
 Updates editor with model data.
 
virtual void UpdateModelFromEditor () const override
 Updates model from editor.
 
virtual bool IsReadOnly () const override
 Returns true if the model data can be changed.
 
virtual void SetReadOnly (bool state) override
 Set flag that the model data can be changed.
 
- Public Member Functions inherited from icomp::CComponentBase
 CComponentBase ()
 Create component and assign it to specific context.
 
virtual const icomp::IComponentGetParentComponent (bool ownerOnly=false) const override
 Get parent of this component.
 
virtual void * GetInterface (const istd::CClassInfo &interfaceType, const QByteArray &subId="") override
 Get access to specified component interface.
 
virtual IComponentContextSharedPtr GetComponentContext () const override
 Get access to component context describing all application-specified component information loaded from components registry.
 
virtual void SetComponentContext (const IComponentContextSharedPtr &contextPtr, const icomp::IComponent *parentPtr, bool isParentOwner) override
 Set component context of this component.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Member Functions

virtual void OnComponentCreated () override
 
virtual void OnComponentDestroyed () override
 
- Protected Member Functions inherited from icomp::CComponentBase
bool IsComponentActive () const
 Check if component is active.
 
virtual const icomp::IRealComponentStaticInfoGetComponentStaticInfo () const =0
 Get access to static info of this component.
 

Additional Inherited Members

- Static Protected Member Functions inherited from icomp::CComponentBase
static const icomp::IRealComponentStaticInfoInitStaticInfo (IComponent *componentPtr)
 
static QByteArray GetComponentId (const icomp::IComponentContext *componentContextPtr, const QByteArray &contextId=QByteArray())
 

Detailed Description

Component realizing static connection between GUI and model components.

It allows to use boundle of model and GUI-observer components as simple GUI object.

Definition at line 23 of file CModelEditorGuiComp.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 29 of file CModelEditorGuiComp.h.

Constructor & Destructor Documentation

◆ CModelEditorGuiComp()

iqtgui::CModelEditorGuiComp::CModelEditorGuiComp ( )

Member Function Documentation

◆ CreateGui()

virtual bool iqtgui::CModelEditorGuiComp::CreateGui ( QWidget *  parentPtr)
overridevirtual

Initializes the GUI and connects it to the parent widget.

This method creates and initializes all Qt widgets that form the GUI component. It should only be called once; subsequent calls should be ignored or return false. The created widgets become children of the specified parent widget.

Parameters
parentPtrPointer to the parent QWidget. The created GUI will be a child of this widget. Can be nullptr for top-level widgets.
Returns
true if initialization succeeded, false if it failed or was already created.
Note
After successful creation, IsGuiCreated() should return true.
This method should be idempotent - calling it multiple times should not create multiple GUI instances.
See also
DestroyGui(), IsGuiCreated(), GetWidget()

Implements iqtgui::IGuiObject.

◆ DestroyGui()

virtual bool iqtgui::CModelEditorGuiComp::DestroyGui ( )
overridevirtual

Releases GUI resources and disconnects from the parent.

This method destroys all Qt widgets created by CreateGui() and cleans up associated resources. After calling this method, IsGuiCreated() should return false, and GetWidget() should return nullptr or an invalid pointer.

Returns
true if the operation succeeded, false if it failed or GUI was not created.
Note
It's safe to call this method even if the GUI was not created; it should simply return false in that case.
After calling this method, CreateGui() can be called again to recreate the GUI if needed.
See also
CreateGui(), IsGuiCreated()

Implements iqtgui::IGuiObject.

◆ GetWidget()

virtual QWidget * iqtgui::CModelEditorGuiComp::GetWidget ( ) const
overridevirtual

Gets access to the internal QWidget object.

Returns a pointer to the main QWidget that represents this GUI component. This widget can be used for layout management, showing/hiding, or other Qt-specific operations.

Returns
Pointer to the internal QWidget, or nullptr if GUI is not created.
Note
The returned pointer is owned by this IGuiObject instance. The caller should not delete it.
The pointer becomes invalid after DestroyGui() is called.
See also
CreateGui(), IsGuiCreated()

Implements iqtgui::IGuiObject.

◆ IsGuiCreated()

virtual bool iqtgui::CModelEditorGuiComp::IsGuiCreated ( ) const
overridevirtual

Checks if the GUI has been initialized and created.

This method returns true after CreateGui() has been successfully called and before DestroyGui() is called. It can be used to verify the GUI state before performing operations that require an active GUI.

Returns
true if the GUI is created and initialized, false otherwise.
See also
CreateGui(), DestroyGui()

Implements iqtgui::IGuiObject.

◆ IsReadOnly()

virtual bool iqtgui::CModelEditorGuiComp::IsReadOnly ( ) const
overridevirtual

Returns true if the model data can be changed.

Implements imod::IModelEditor.

◆ OnComponentCreated()

virtual void iqtgui::CModelEditorGuiComp::OnComponentCreated ( )
overrideprotectedvirtual

Reimplemented from icomp::CComponentBase.

◆ OnComponentDestroyed()

virtual void iqtgui::CModelEditorGuiComp::OnComponentDestroyed ( )
overrideprotectedvirtual

Reimplemented from icomp::CComponentBase.

◆ OnTryClose()

virtual void iqtgui::CModelEditorGuiComp::OnTryClose ( bool *  ignoredPtr = NULL)
overridevirtual

Called when the application is attempting to close.

This method is invoked before the application closes, giving the GUI component a chance to prevent the close operation (e.g., to save unsaved data, show confirmation dialogs, or perform cleanup operations).

Parameters
ignoredPtrOptional pointer to a boolean flag. If not nullptr and the component wants to prevent closing (e.g., user cancels a save dialog), the implementation should set *ignoredPtr to true. If nullptr, the close operation cannot be prevented.
Note
If ignoredPtr is nullptr, the implementation must not try to prevent closing and should only perform necessary cleanup.
This method may be called multiple times if the close is initially prevented but later attempted again.
// Example implementation
virtual void OnTryClose(bool* ignoredPtr)
{
if (m_hasUnsavedData) {
if (ignoredPtr) {
// Show save dialog
int result = QMessageBox::question(GetWidget(),
"Unsaved Changes",
"Do you want to save your changes?",
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
if (result == QMessageBox::Save) {
SaveData();
} else if (result == QMessageBox::Cancel) {
*ignoredPtr = true; // Prevent closing
return;
}
}
}
// Perform cleanup if needed
}
virtual QWidget * GetWidget() const override
Gets access to the internal QWidget object.
virtual void OnTryClose(bool *ignoredPtr=NULL) override
Called when the application is attempting to close.
See also
DestroyGui()

Implements iqtgui::IGuiObject.

◆ SetReadOnly()

virtual void iqtgui::CModelEditorGuiComp::SetReadOnly ( bool  state)
overridevirtual

Set flag that the model data can be changed.

Returns
true, if this feature is supported.

Implements imod::IModelEditor.

◆ UpdateEditor()

virtual void iqtgui::CModelEditorGuiComp::UpdateEditor ( const istd::IChangeable::ChangeSet changeSet)
overridevirtual

Updates editor with model data.

This method will be called only if GUI is connected.

Parameters
changeSetthe same as changeSet in istd::IChangeable.

Implements imod::IModelEditor.

◆ UpdateModelFromEditor()

virtual void iqtgui::CModelEditorGuiComp::UpdateModelFromEditor ( ) const
overridevirtual

Updates model from editor.

This method will be called only if GUI is connected and model is attached.

Implements imod::IModelEditor.


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