![]() |
NDEVR
API Documentation
|
Provides a way to lazily initialize widgets when needed but still pass them to container dialogs. More...
Public Member Functions | |
| WidgetInit (QWidget *widget) | |
| Constructs a WidgetInit with an already-created widget. | |
| WidgetInit (std::function< QWidget *()> init) | |
| Constructs a WidgetInit with a lazy-initialization function. | |
| virtual QWidget * | getWidget () |
| Returns the widget, creating it lazily if it has not been initialized yet. | |
Protected Attributes | |
| const std::function< QWidget *()> | m_create_widget |
| The factory function for lazy widget creation. | |
| QWidget * | m_widget = nullptr |
| The cached widget pointer. | |
Provides a way to lazily initialize widgets when needed but still pass them to container dialogs.
Useful for adding things to Settings dialogs or other large structures where they may never be initialized.
Definition at line 12 of file WidgetInit.h.
|
inline |
Constructs a WidgetInit with a lazy-initialization function.
| [in] | init | The function that creates the widget on first access. |
Definition at line 17 of file WidgetInit.h.
References m_create_widget.
|
inline |
Constructs a WidgetInit with an already-created widget.
| [in] | widget | The pre-existing widget. |
Definition at line 22 of file WidgetInit.h.
References m_widget.
|
inlinevirtual |
Returns the widget, creating it lazily if it has not been initialized yet.
Definition at line 27 of file WidgetInit.h.
References m_create_widget, and m_widget.