ACF $AcfVersion:0$
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iqtgui::CGuiComponentBase Class Referenceabstract

Base class for classes implementing interface iqtgui::IGuiObject. More...

#include <CGuiComponentBase.h>

Inheritance diagram for iqtgui::CGuiComponentBase:
iqtgui::TMakeIconProviderCompWrap< ibase::TLocalizableWrap< icomp::CComponentBase > > iqtgui::IGuiObject iqtgui::TDesignSchemaHandlerWrap< Base > iqtgui::CIconProvider istd::IPolymorphic iqtgui::TGuiComponentBase< QWidget > iqtgui::TGuiComponentBase< QTextEdit > iqtgui::TGuiComponentBase< iview::CConsoleGui > iqtgui::TGuiComponentBase< QTextBrowser > iqtgui::TGuiComponentBase< QMdiArea > iqtgui::TGuiComponentBase< QDockWidget > iqtgui::TGuiComponentBase< QMainWindow > iqtgui::TGuiComponentBase< CSplashScreenCustom > iqtgui::TGuiComponentBase< QLabel > iqtgui::TGuiComponentBase< QTableView > iqtgui::TGuiComponentBase< QToolBar > iqtgui::TGuiComponentBase< ItemWidgetClass > iqtgui::CMultiPageGuiCompAttr iqtgui::TGuiComponentBase< WidgetType >

Classes

class  VisualStatus
 

Public Types

typedef TMakeIconProviderCompWrap< ibase::TLocalizableWrap< icomp::CComponentBase > > BaseClass
 
- Public Types inherited from iqtgui::TMakeIconProviderCompWrap< ibase::TLocalizableWrap< icomp::CComponentBase > >
typedef ibase::TLocalizableWrap< icomp::CComponentBaseBaseClass
 
- Public Types inherited from iqtgui::TDesignSchemaHandlerWrap< Base >
typedef Base BaseClass
 

Public Member Functions

 I_REGISTER_SUBELEMENT_INTERFACE_T (VisualStatus, IVisualStatus, ExtractVisualStatus)
 
 I_REGISTER_SUBELEMENT_INTERFACE_T (VisualStatus, istd::IChangeable, ExtractVisualStatus)
 
 I_REGISTER_SUBELEMENT_INTERFACE_T (VisualStatus, imod::IModel, ExtractVisualStatus)
 
 CGuiComponentBase ()
 
bool IsGuiShown () const
 
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.
 
- Public Member Functions inherited from iqtgui::TDesignSchemaHandlerWrap< Base >
 TDesignSchemaHandlerWrap ()
 
virtual void EnableDesignHandler (bool enable=true)
 If enabled, listen to the design schema change events from the application context.
 
- Public Member Functions inherited from iqtgui::CIconProvider
virtual QIcon GetIcon (const QString &iconName) const
 
virtual QString GetIconPath (const QString &iconName) const
 
virtual QString GetStyleSheetPath (const QString &styleSheetPath) const
 
QByteArray GetCurrentThemeId () const
 
void SetThemeId (const QByteArray &themeId)
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Member Functions

virtual void OnGuiDesignChanged ()
 
virtual void OnGuiShown ()
 Called from widget event filter when slave widget is shown.
 
virtual void OnGuiHidden ()
 Called from widget event filter when slave widget is hidden.
 
virtual bool OnKeyPressed (QKeyEvent *event)
 Called from widget event filter when key is pressed.
 
virtual void OnRetranslate ()
 Called when non-GUI elements (like commands) should be retranslated.
 
virtual void OnGuiRetranslate ()
 Called from widget event filter when GUI should be retranslated.
 
virtual void OnGuiCreated ()
 Called just after GUI is initialized.
 
virtual void OnGuiDestroyed ()
 Called just before GUI is released.
 
void SetStatusIcon (const QIcon &icon)
 Set status icon;.
 
void SetStatusText (const QString &text)
 Set status text;.
 
void SetDefaultVisualStatus ()
 
virtual void OnLanguageChanged () override
 
virtual void OnDesignSchemaChanged (const QByteArray &themeId) override
 
virtual bool eventFilter (QObject *sourcePtr, QEvent *eventPtr) override
 
virtual void OnComponentCreated () override
 
virtual void OnComponentDestroyed () override
 
virtual QWidget * CreateQtWidget (QWidget *parentPtr)=0
 Create slave widget object.
 
- Protected Member Functions inherited from iqtgui::CIconProvider
virtual QIcon CreateIcon (const QString &iconName) const
 

Protected Attributes

imod::TModelWrap< VisualStatusm_visualStatus
 

Detailed Description

Base class for classes implementing interface iqtgui::IGuiObject.

Definition at line 26 of file CGuiComponentBase.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 32 of file CGuiComponentBase.h.

Constructor & Destructor Documentation

◆ CGuiComponentBase()

iqtgui::CGuiComponentBase::CGuiComponentBase ( )

Member Function Documentation

◆ CreateGui()

virtual bool iqtgui::CGuiComponentBase::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.

Reimplemented in iqtgui::TRestorableGuiWrap< CMultiPageGuiCompBase >, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QMainWindow > >, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QMdiArea > >, and iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QWidget > >.

◆ CreateQtWidget()

virtual QWidget * iqtgui::CGuiComponentBase::CreateQtWidget ( QWidget *  parentPtr)
protectedpure virtual

◆ DestroyGui()

virtual bool iqtgui::CGuiComponentBase::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.

Reimplemented in iqtgui::TRestorableGuiWrap< CMultiPageGuiCompBase >, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QMainWindow > >, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QMdiArea > >, and iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QWidget > >.

◆ eventFilter()

virtual bool iqtgui::CGuiComponentBase::eventFilter ( QObject *  sourcePtr,
QEvent *  eventPtr 
)
overrideprotectedvirtual

◆ GetWidget()

QWidget * iqtgui::CGuiComponentBase::GetWidget ( ) const
inlineoverridevirtual

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.

Definition at line 186 of file CGuiComponentBase.h.

◆ I_REGISTER_SUBELEMENT_INTERFACE_T() [1/3]

iqtgui::CGuiComponentBase::I_REGISTER_SUBELEMENT_INTERFACE_T ( VisualStatus  ,
imod::IModel  ,
ExtractVisualStatus   
)

◆ I_REGISTER_SUBELEMENT_INTERFACE_T() [2/3]

iqtgui::CGuiComponentBase::I_REGISTER_SUBELEMENT_INTERFACE_T ( VisualStatus  ,
istd::IChangeable  ,
ExtractVisualStatus   
)

◆ I_REGISTER_SUBELEMENT_INTERFACE_T() [3/3]

iqtgui::CGuiComponentBase::I_REGISTER_SUBELEMENT_INTERFACE_T ( VisualStatus  ,
IVisualStatus  ,
ExtractVisualStatus   
)

◆ IsGuiCreated()

virtual bool iqtgui::CGuiComponentBase::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.

◆ IsGuiShown()

bool iqtgui::CGuiComponentBase::IsGuiShown ( ) const
inline

Definition at line 178 of file CGuiComponentBase.h.

◆ OnComponentCreated()

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

◆ OnComponentDestroyed()

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

◆ OnDesignSchemaChanged()

virtual void iqtgui::CGuiComponentBase::OnDesignSchemaChanged ( const QByteArray &  themeId)
overrideprotectedvirtual

◆ OnGuiCreated()

virtual void iqtgui::CGuiComponentBase::OnGuiCreated ( )
protectedvirtual

Called just after GUI is initialized.

Reimplemented in CTextEditorComp, ifilegui::CFilePersistenceGuiComp, iloggui::CLogGuiComp, iqt2d::CExtendedConsoleGuiComp, iqt2d::CMultiBitmapViewComp, iqt2d::CSceneConnectorGuiComp, iqt2d::CViewProviderGuiComp, iqtdoc::CDocumentMetaInfoEditorComp, iqtdoc::CHtmlHelpGuiComp, iqtdoc::CMainWindowGuiComp, iqtdoc::CMultiDocumentWorkspaceGuiComp, iqtdoc::CSingleDocumentWorkspaceGuiComp, iqtgui::CAboutWidgetGuiComp, iqtgui::CCalendarGuiComp, iqtgui::CCommandsToolBarGuiComp, iqtgui::CComposedGuiComp, iqtgui::CDockWidgetGuiComp, iqtgui::CMultiPageGuiCompBase, iqtgui::CProgressManagerGuiComp, iqtgui::CSimpleMainWindowGuiComp, iqtgui::CSplashScreenGuiComp, iqtgui::CStatusGuiComp, iqtgui::CTabContainerGuiComp, iqtgui::CToolBarGuiCompBase, iqtgui::CToolBarWidgetGuiComp, iqtgui::CVersionInfoGuiComp, iqtgui::TGuiObserverWrap< iqtgui::CComposedGuiComp, imod::TSingleModelObserverBase< iprm::IParamsSet > >, iqtgui::TGuiObserverWrap< iqtgui::TDesignerGuiCompBase< UI, QWidget >, imod::TSingleModelObserverBase< Model > >, iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QLabel >, imod::TSingleModelObserverBase< istd::IInformationProvider > >, iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QTextEdit >, imod::TSingleModelObserverBase< idoc::ITextDocument > >, iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QWidget >, imod::TSingleModelObserverBase< idoc::IDocumentMetaInfo > >, iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QWidget >, imod::TSingleModelObserverBase< iimg::IMultiBitmapProvider > >, iqtgui::TGuiObserverWrap< TGuiComponentBase< ItemWidgetClass >, imod::TSingleModelObserverBase< ibase::IQtItemModelProvider > >, iqtgui::TGuiObserverWrap< TGuiComponentBase< QTableView >, imod::TSingleModelObserverBase< ibase::IQtItemModelProvider > >, iqtgui::TItemModelEditorCompBase< ItemWidgetClass >, and iqtprm::CExtComposedParamsSetGuiComp.

◆ OnGuiDesignChanged()

virtual void iqtgui::CGuiComponentBase::OnGuiDesignChanged ( )
protectedvirtual

◆ OnGuiDestroyed()

virtual void iqtgui::CGuiComponentBase::OnGuiDestroyed ( )
protectedvirtual

◆ OnGuiHidden()

virtual void iqtgui::CGuiComponentBase::OnGuiHidden ( )
protectedvirtual

◆ OnGuiRetranslate()

virtual void iqtgui::CGuiComponentBase::OnGuiRetranslate ( )
protectedvirtual

◆ OnGuiShown()

virtual void iqtgui::CGuiComponentBase::OnGuiShown ( )
protectedvirtual

◆ OnKeyPressed()

virtual bool iqtgui::CGuiComponentBase::OnKeyPressed ( QKeyEvent *  event)
protectedvirtual

Called from widget event filter when key is pressed.

Returns
if event was consumed returns true, otherwise false.

◆ OnLanguageChanged()

virtual void iqtgui::CGuiComponentBase::OnLanguageChanged ( )
overrideprotectedvirtual

◆ OnRetranslate()

virtual void iqtgui::CGuiComponentBase::OnRetranslate ( )
protectedvirtual

Called when non-GUI elements (like commands) should be retranslated.

Reimplemented in CTextEditorComp, iqtdoc::CMainWindowGuiComp, iqtdoc::CMultiDocumentWorkspaceGuiComp, and iqtgui::CSimpleMainWindowGuiComp.

◆ OnTryClose()

virtual void iqtgui::CGuiComponentBase::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 void OnTryClose(bool *ignoredPtr=NULL) override
Called when the application is attempting to close.
virtual QWidget * GetWidget() const override
Gets access to the internal QWidget object.
See also
DestroyGui()

Implements iqtgui::IGuiObject.

Reimplemented in iqtdoc::CMultiDocumentWorkspaceGuiComp, iqtdoc::CSingleDocumentWorkspaceGuiComp, iqtgui::CMultiPageGuiCompBase, and iqtgui::CSimpleMainWindowGuiComp.

◆ SetDefaultVisualStatus()

void iqtgui::CGuiComponentBase::SetDefaultVisualStatus ( )
protected

◆ SetStatusIcon()

void iqtgui::CGuiComponentBase::SetStatusIcon ( const QIcon &  icon)
protected

Set status icon;.

◆ SetStatusText()

void iqtgui::CGuiComponentBase::SetStatusText ( const QString &  text)
protected

Set status text;.

Member Data Documentation

◆ m_visualStatus

imod::TModelWrap<VisualStatus> iqtgui::CGuiComponentBase::m_visualStatus
protected

Definition at line 148 of file CGuiComponentBase.h.


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