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

#include <xsystem_qtwindow.h>

Inherits adtf::ui::ant::IQtXSystem::IWindow.

Inherited by adtf::ui::ant::qt_ui_filter< adtf::filter::cDynamicFilter >, adtf::ui::ant::qt_ui_filter< adtf::filter::cFilter >, adtf::ui::ant::qt_ui_service< adtf::system::ant::cADTFService >, adtf::ui::riddler::qt_ui_filter< adtf::filter::cFilter >, adtf::ui::ant::qt_ui_filter< FILTERBASECLASS >, adtf::ui::ant::qt_ui_service< SERVICEBASECLASS >, adtf::ui::riddler::qt_ui_filter< FILTERBASECLASS >, adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >, adtf::ui::spider::cQtWindow, and adtf::ui::v1::cQtWindow.

Protected Member Functions

 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 Attributes

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.

See also
adtf::ui::riddler::IQtXSystem, Example Qt5 Video Display

Member Function Documentation

◆ Create()

tResult adtf::ui::ant::cQtWindow::Create ( const char * strWindowID,
QWidget & oParentWidget )
inlineoverrideprotectedvirtual

Callback which in called within the applications main th thread to create a window.

This Callback is a reaction on a IQtXSystem::CreateWindow call. You are able to initialize your own widget set to pParentWidget and create your display.

Parameters
[in]strWindowIDunique ID of the Window. The ID is to manage the different IWindow creations and has to be unique.
[in]oParentWidgetparent widget to add you own sub widgets to.
Returns
Return a standard result code. If an error is returned the creation of the window breaks and the return value is passed to the CreateWindow call.
See also
IQtXSystem::CreateWindow

Implements adtf::ui::ant::IQtXSystem::IWindow.

◆ CreateView()

virtual QWidget * adtf::ui::ant::cQtWindow::CreateView ( )
protectedpure virtual

Callback you have to implement and return a newly QWidget which will be embed to the oParentWidget of the Create.

Returns
Your widget to create.
See also
adtf::ui::ant::IQtXSystem::CreateWindow, adtf::ui::ant::IQtXSystem::IWindow::Create
Note
All widgets adjust theirs size to scaling changes automatically. Any metrics within a widget that should react to scale changes, have to calulate their size based on the widget font. A widget can react to scale changes by listening to the StyleChange-Event and recalulate sizes then:
bool myCustomWidget::event(QEvent* event)
{
if (event->type() == QEvent::StyleChange)
{
const QFontMetrics oFontMetrics(font());
int myCustomHeight = oFontMetrics.height() * 20; // this height is based on font height
// ...
}
return QWidget::event(event);
}
Note
Due to a Qt bug, ComboBoxes need a workaround for the popup to adjust to scaling changes. So if the text in a ComboBox list appears to be too small, just add one line after creation of the ComboBox:
QComboBox* myComboBox = new QComboBox();
myComboBox->setView(new QListView()); // just add this extra line to your code

◆ Destroy()

tResult adtf::ui::ant::cQtWindow::Destroy ( QWidget & oParentWidget)
inlineoverrideprotectedvirtual

Callback which in called within the applications main th thread to deliver a destroy message to the windows implementation.

This Callback is a reaction on a IQtXSystem::DestroyWindow call or any quit of the XSystem and can be used to cleanup. Qt is using reference counting on widget. Added widgets to oParentWidget are invalid after functions return.

Parameters
[in]oParentWidgetparent widget about to destroy.
Returns
Return a standard result code. If an error is returned the return value is passed to the DestroyWindow call.
See also
IQtXSystem::DestroyWindow

Implements adtf::ui::ant::IQtXSystem::IWindow.

◆ OnIdle()

tResult adtf::ui::ant::cQtWindow::OnIdle ( )
inlineoverrideprotectedvirtual

Callback for actions within a idle thread.

Use this for low priority activity. The default xsystem calls this roughly at a 100ms interval. To update your UI based on input data prefer OnTimer().

Remarks
Make sure to return, otherwise the applications main thread will block.
Returns
Standard Result Code.
See also
cQtWindow

Implements adtf::ui::ant::IQtXSystem::IWindow.

◆ OnTimer()

tResult adtf::ui::ant::cQtWindow::OnTimer ( )
inlineoverrideprotectedvirtual

Callback for actions within a steady timer. This function is called at a specific interval from within the GUI thread (default is 50ms).

Remarks
Make sure to return, otherwise the applications main thread will block.
Returns
Standard Result Code.
See also
cQtWindow

Implements adtf::ui::ant::IQtXSystem::IWindow.

◆ ReleaseView()

virtual void adtf::ui::ant::cQtWindow::ReleaseView ( )
protectedpure virtual

Callback you have to implement to cleanup while destroying of the parents window.

See also
IQtXSystem::DestroyWindow, IQtXSystem::IWindow::Destroy

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