ADTF Qt5
Loading...
Searching...
No Matches
adtf::ui::cQtWindow Class Reference

#include <xsystem_qtwindow.h>

Inherits adtf::ui::ant::cQtWindow, adtf::ui::v1::IQtXSystem::IWindowState, and adtf::ui::spider::IQtXSystem::IHelp.

Public Member Functions

QString GetStateIdentifier () const
 
virtual void OnLoadState (const QString &strStateFolder)
 
void OnLoadState (const QString &strStateFolder, uint32_t ui32LoadStateFlags) override
 
virtual void OnSaveState (const QString &strStateFolder) const
 
void OnSaveState (const QString &strStateFolder, uint32_t ui32SaveStateFlags) const override
 
QString GetHelpLink () const override
 

Protected Member Functions

void EnableWindowState ()
 Enables the Window state callbacks. We recommend to use this only within your filters CTOR.
 
void SetWindowCreationFlags (uint32_t ui32WindowCreationFlags)
 
void SetWindowCreationFlag (v1::IQtXSystem::eWindowCreationFlags eWindowCreationFlag, bool bOn)
 
uint32_t GetWindowCreationFlags () const
 
- Protected Member Functions inherited from adtf::ui::ant::cQtWindow
 cQtWindow ()=default
 default CTOR
 
virtual ~cQtWindow ()=default
 default DTOR
 
virtual QWidget * CreateView ()=0
 
virtual void ReleaseView ()=0
 
tResult Create (const char *strWindowID, QWidget &oParentWidget) override
 Callback which in called within the applications main th thread to create a window.
 
tResult Destroy (QWidget &) override
 Callback which in called within the applications main th thread to deliver a destroy message to the windows implementation.
 
tResult OnIdle () override
 
tResult OnTimer () override
 
- Protected Member Functions inherited from adtf::ui::v1::IQtXSystem::IWindowState
 ~IWindowState ()=default
 protected DTOR
 
- Protected Member Functions inherited from adtf::ui::spider::IQtXSystem::IHelp
 ~IHelp ()=default
 protected DTOR
 

Additional Inherited Members

- Public Types inherited from adtf::ui::v1::IQtXSystem::IWindowState
enum  StateFlags : uint32_t { Content = 0x01 , Layout = 0x02 , Interactive = 0x04 }
 State flags indicating the reason of the call and folder location within OnLoadState and OnSaveState. More...
 
- Protected Attributes inherited from adtf::ui::ant::cQtWindow
adtf::base::property_variable< adtf::util::cString > m_strTitle
 title property variable will be set while window creating
 

Detailed Description

Basic IWindow implementation. This implementation is used to provide callbacks on creation and destroying widget while IWindow::Create call.

The Create method will call the CreateView first and embed your created widget to the oParentWidget. Additionally it will implement the v1::IQtXSystem::IWindowState and the spider::IQtXSystem::IHelp interface.

See also
adtf::ui::v1::IQtXSystem, v1::IQtXSystem::IWindowState, Example Qt5 Video Display

Member Function Documentation

◆ EnableWindowState()

void adtf::ui::v1::cQtWindow::EnableWindowState ( )
inlineprotected

Enables the Window state callbacks. We recommend to use this only within your filters CTOR.

See also
adtf::ui::v1::IQtXSystem::IWindowState

◆ GetHelpLink()

QString adtf::ui::v1::cQtWindow::GetHelpLink ( ) const
inlineoverridevirtual

Returns a filesystem help link to the windows documentation page.

Return values
emptyThe link will be ignored.
not-emptyThe filesystem help link to the windows documentation page.

Implements adtf::ui::spider::IQtXSystem::IHelp.

◆ GetStateIdentifier()

QString adtf::ui::v1::cQtWindow::GetStateIdentifier ( ) const
inlinevirtual

Returns The user defined window state identifier.

Returns
The state identifier.
See also
adtf::ui::riddler::qt_ui_filter::GetStateIdentifier, adtf::ui::riddler::qt_ui_service::GetStateIdentifier
Remarks
This callback will be only served if EnableWindowState or SetWindowCreationFlags (osborn::IQtXSystem::WCF_HasWindowState) call is made before!

Implements adtf::ui::v1::IQtXSystem::IWindowState.

◆ GetWindowCreationFlags()

uint32_t adtf::ui::v1::cQtWindow::GetWindowCreationFlags ( ) const
inlineprotected

Returns the window flags for v1::IQtXSystem::CreateWindow call.

◆ OnLoadState() [1/2]

virtual void adtf::ui::v1::cQtWindow::OnLoadState ( const QString & strStateFolder)
inlinevirtual

Callback function to load the internal window state from the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnLoadState(const QString& strStateFolder)
{
const auto strUISettingsFile = strStateFolder + "/my_ui_view.settings";
if (QFileInfo(strLayoutFile).exists())
{
QSettings oSettings(strUISettingsFile, QSettings::IniFormat);
oSettings.beginGroup("my_window");
// read your state from the UI View Settings as created within OnSaveState
oSettings.endGroup();
}
else
{
if (!is_window_state_folder_on_runlevel_change(strStateFolder))
{
THROW_ERROR_DESC(ERR_INVALID_FILE, "UI View Settings file not found: %s",
strLayoutFile.toStdString().c_str());
}
}
}
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
Remarks
If no UI View Settings file is found you may throw ERR_INVALID_FILE, unless the state folder was recently created, while initializing the very first time on runlevel changes.
throw ERR_CANCEL to indicate the loading was cancelled on purpose.
This callback will be only served if EnableWindowState or SetWindowCreationFlags (osborn::IQtXSystem::WCF_HasWindowState) call is made before!
This method is deprecated, but still provided due to legacy reasons. Use the v1::IQtXSystem::IWindowState::OnLoadState version with state flags.

◆ OnLoadState() [2/2]

void adtf::ui::v1::cQtWindow::OnLoadState ( const QString & strStateFolder,
uint32_t ui32LoadStateFlags )
inlineoverridevirtual

Callback function to load the internal window state from the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnLoadState(const QString& strStateFolder, uint32_t ui32LoadStateFlags)
{
const auto strUISettingsFile = strStateFolder + "/my_ui_view.settings";
if (QFileInfo(strUISettingsFile).exists())
{
QSettings oSettings(strUISettingsFile, QSettings::IniFormat);
oSettings.beginGroup("my_window");
// read your state from the UI View Settings file as created within OnSaveState
oSettings.endGroup();
}
else
{
if (ui32LoadStateFlags & Interactive)
{
THROW_ERROR_DESC(ERR_INVALID_FILE, "UI View Settings file not found: %s",
strUISettingsFile.toStdString().c_str());
}
}
}
@ Interactive
State folder was created on export/import actions by user interaction.
Definition qtxsystem_intf.h:453
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
[in]ui32LoadStateFlagsFlags indicating the reason of the call and folder location. Only the StateFlags::Interactive indicates an user interactions with the view. An exception during this interaction will result in a error message box, while all other calls will and only log the tResult error.
Remarks
If no UI View Settings file is found you may throw ERR_INVALID_FILE, unless the state folder was recently created, while initializing the very first time on runlevel changes. The exception will be ignored in this case.
Use StateFlags to check reason of call on ui32LoadStateFlags.
throw ERR_CANCEL to indicate the loading was cancelled on purpose.
See also
StateFlags
Remarks
This callback will be only served if EnableWindowState or SetWindowCreationFlags (osborn::IQtXSystem::WCF_HasWindowState) call is made before!

Implements adtf::ui::v1::IQtXSystem::IWindowState.

◆ OnSaveState() [1/2]

virtual void adtf::ui::v1::cQtWindow::OnSaveState ( const QString & strStateFolder) const
inlinevirtual

Callback function to save the internal window state to the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnSaveState(const QString& strStateFolder) const
{
QSettings oSettings(strStateFolder + "/my_ui_view.settings", QSettings::IniFormat);
oSettings.beginGroup("my_window");
// save your window state to the UI View Settings file.
oSettings.endGroup();
}
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
Remarks
You may throw within a tResult to indicate an error during saving. An ERR_CANCLED indicates the saving was cancelled on purpose.
This callback will be only served if EnableWindowState or SetWindowCreationFlags (osborn::IQtXSystem::WCF_HasWindowState) call is made before!

◆ OnSaveState() [2/2]

void adtf::ui::v1::cQtWindow::OnSaveState ( const QString & strStateFolder,
uint32_t ui32SaveStateFlags ) const
inlineoverridevirtual

Callback function to save the internal window state to the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnSaveState(const QString& strStateFolder,[[maybe_unused]] uint32_t ui32SaveStateFlags) const
{
QSettings oSettings(strStateFolder + "/my_ui_view.settings", QSettings::IniFormat);
oSettings.beginGroup("my_window");
// save your window state to the UI View Settings file.
oSettings.endGroup();
}
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
[in]ui32SaveStateFlagsFlags indicating the reason of the call and folder location.
Remarks
You may throw within a tResult to indicate an error during saving. An ERR_CANCLED indicates the saving was cancelled on purpose.
See also
StateFlags
Remarks
This callback will be only served if EnableWindowState call is made before!

Implements adtf::ui::v1::IQtXSystem::IWindowState.

◆ SetWindowCreationFlag()

void adtf::ui::v1::cQtWindow::SetWindowCreationFlag ( v1::IQtXSystem::eWindowCreationFlags eWindowCreationFlag,
bool bOn )
inlineprotected

Switches additional window flags for v1::IQtXSystem::CreateWindow call on or off.

Parameters
eWindowCreationFlagFlag to set or unset for window creation (see osborn::IQtXSystem::eWindowCreationFlags).
bOntrue to enable the flag, false to disable the flag.
Remarks
This method and the resulting flags are only considered before IQtXSystem::CreateWindow call.

◆ SetWindowCreationFlags()

void adtf::ui::v1::cQtWindow::SetWindowCreationFlags ( uint32_t ui32WindowCreationFlags)
inlineprotected

Resets the window flags for v1::IQtXSystem::CreateWindow call.

Parameters
ui32WindowCreationFlagsFlags to set for window creation (see osborn::IQtXSystem::eWindowCreationFlags).
Remarks
This method and the resulting flags are only considered before IQtXSystem::CreateWindow call.

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