ADTF  3.18.2
xsystem_qtwindow.h
Go to the documentation of this file.
1 
8 /*
9  * This file depends on Qt which is licensed under LGPLv3.
10  * See ADTF_DIR/3rdparty/qt5 and doc/license for detailed information.
11  */
12 #pragma once
13 #include "qtxsystem_intf.h"
14 
15 #include <adtfbase/configuration.h>
16 
17 #include <qwidget.h>
18 #include <qlayout.h>
19 
20 namespace adtf
21 {
22 namespace ui
23 {
24 namespace ant
25 {
26 
27 #ifdef CreateWindow
28  #undef CreateWindow
29 #endif
30 
40 {
41 protected:
45  cQtWindow() = default;
49  virtual ~cQtWindow() = default;
50 
58  virtual QWidget* CreateView() = 0;
63  virtual void ReleaseView() = 0;
64 
67 
68  tResult Create(const char* strWindowID, QWidget& oParentWidget) override
69  {
70  QWidget* pView = CreateView();
72  QLayout* pLayout = oParentWidget.layout();
73  if (pLayout == nullptr)
74  {
75  pLayout = new QHBoxLayout(&oParentWidget);
76  pLayout->setMargin(0);
77  }
78 
79  pLayout->addWidget(pView);
81  if (strTitle.IsEmpty())
82  {
83  strTitle = strWindowID;
84  }
85  QWidget* pDockedWindowParent = oParentWidget.parentWidget();
86  if (nullptr != pDockedWindowParent)
87  {
88  pDockedWindowParent->setWindowTitle(QString(strTitle));
89  }
90 
92  }
93  tResult Destroy(QWidget& /* oParentWidget */) override
94  {
95  ReleaseView();
97  }
98 
99  tResult OnIdle() override
100  {
102  }
103 
104  tResult OnTimer() override
105  {
107  }
108 };
109 
110 } // namespace ant
111 
112 namespace spider
113 {
114 
124 class cQtWindow : public ant::cQtWindow,
127 {
128 public:
133  QString GetStateIdentifier() const override
134  {
135  return {};
136  }
141  void OnLoadState([[maybe_unused]] const QString& strStateFolder) override
142  {
143  }
144 
149  void OnSaveState([[maybe_unused]] const QString& strStateFolder) const override
150  {
151  }
152 
156  QString GetHelpLink() const override
157  {
158  return {};
159  }
160 
161 protected:
169  {
170  m_bWindowStateEnabled = true;
171  }
176  bool IsWindowStateEnabled() const
177  {
178  return m_bWindowStateEnabled;
179  }
180 
181 private:
183  bool m_bWindowStateEnabled = false;
184 };
185 
186 } // namespace spider
187 
188 using spider::cQtWindow;
189 
190 }
191 }
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
Property Variable template for the given T.
IWindow interface defintion for to.
Basic IWindow implementation.
virtual void ReleaseView()=0
Callback you have to implement to cleanup while destroying of the parents window.
tResult OnIdle() override
Callback for actions within a idle thread.
cQtWindow()=default
default CTOR
adtf::base::property_variable< adtf::util::cString > m_strTitle
title property variable will be set while window creating
virtual ~cQtWindow()=default
default DTOR
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 w...
virtual QWidget * CreateView()=0
Callback you have to implement and return a newly QWidget which will be embed to the oParentWidget of...
tResult OnTimer() override
Callback for actions within a steady timer.
Window state callback interface.
The window info interface to return a link to the windows documentation page.
Basic IWindow implementation.
void OnSaveState([[maybe_unused]] const QString &strStateFolder) const override
Callback function to save the internal window state to the given folder strStateFolder.
QString GetHelpLink() const override
Returns a filesystem help link to the windows documentation page.
bool m_bWindowStateEnabled
State for enabled window state.
QString GetStateIdentifier() const override
Returns The user defined window state identifier.
void OnLoadState([[maybe_unused]] const QString &strStateFolder) override
Callback function to load the internal window state from the given folder strStateFolder.
void EnableWindowState()
Enables the Window state callbacks.
Copyright © Audi Electronics Venture GmbH.
void maybe_unused(T &&)
Mimics C++17 attribute maybe_unused to silence compiler warnings on potentially unused enitities.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.