BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Provides subscribe/unsubscribe mechanism for any QObject to track time of life of SessionItem. Mainly intended for SessionItemWidget.
Definition at line 26 of file SessionItemController.h.
Public Types | |
using | callback_t = std::function< void(void)> |
Public Member Functions | |
SessionItemController (QObject *prt) | |
~SessionItemController () override | |
SessionItem * | currentItem () |
void | setItem (SessionItem *item) |
void | setSubscribeCallback (callback_t fun) |
void | setUnsubscribeCallback (callback_t fun) |
void | subscribe () |
Subscribe parent to item's signals. More... | |
void | unsubscribe () |
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item destruction. More... | |
Private Member Functions | |
void | onControllerDestroy () |
void | onItemDestroy () |
void | subscribeParent () |
void | unsubscribeParent () |
Calls additional callback on un. More... | |
Private Attributes | |
SessionItem * | m_item |
bool | m_parent_subscribed |
callback_t | m_subscribe_callback |
callback_t | m_unsubscribe_callback |
using SessionItemController::callback_t = std::function<void(void)> |
Definition at line 29 of file SessionItemController.h.
|
explicit |
Definition at line 18 of file SessionItemController.cpp.
|
override |
Definition at line 26 of file SessionItemController.cpp.
References onControllerDestroy().
SessionItem * SessionItemController::currentItem | ( | ) |
Definition at line 48 of file SessionItemController.cpp.
References m_item.
Referenced by SessionItemWidget::currentItem().
|
private |
Definition at line 95 of file SessionItemController.cpp.
References m_item, SessionItem::mapper(), and ModelMapper::unsubscribe().
Referenced by ~SessionItemController().
|
private |
Definition at line 88 of file SessionItemController.cpp.
References m_item, m_parent_subscribed, and unsubscribeParent().
Referenced by setItem().
void SessionItemController::setItem | ( | SessionItem * | item | ) |
Definition at line 31 of file SessionItemController.cpp.
References m_item, SessionItem::mapper(), onItemDestroy(), ModelMapper::setOnItemDestroy(), unsubscribe(), and ModelMapper::unsubscribe().
Referenced by SessionItemWidget::setItem().
void SessionItemController::setSubscribeCallback | ( | callback_t | fun | ) |
Definition at line 53 of file SessionItemController.cpp.
References m_subscribe_callback.
Referenced by SessionItemWidget::SessionItemWidget().
void SessionItemController::setUnsubscribeCallback | ( | callback_t | fun | ) |
Definition at line 58 of file SessionItemController.cpp.
References m_unsubscribe_callback.
Referenced by SessionItemWidget::SessionItemWidget().
void SessionItemController::subscribe | ( | ) |
Subscribe parent to item's signals.
Definition at line 65 of file SessionItemController.cpp.
References m_item, m_parent_subscribed, and subscribeParent().
Referenced by SessionItemWidget::setItem(), and SessionItemWidget::showEvent().
|
private |
Definition at line 103 of file SessionItemController.cpp.
References m_parent_subscribed, and m_subscribe_callback.
Referenced by subscribe().
void SessionItemController::unsubscribe | ( | ) |
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item destruction.
Definition at line 77 of file SessionItemController.cpp.
References m_item, m_parent_subscribed, SessionItem::mapper(), ModelMapper::unsubscribe(), and unsubscribeParent().
Referenced by SessionItemWidget::hideEvent(), and setItem().
|
private |
Calls additional callback on un.
Definition at line 113 of file SessionItemController.cpp.
References m_parent_subscribed, and m_unsubscribe_callback.
Referenced by onItemDestroy(), and unsubscribe().
|
private |
Definition at line 52 of file SessionItemController.h.
Referenced by currentItem(), onControllerDestroy(), onItemDestroy(), setItem(), subscribe(), and unsubscribe().
|
private |
Definition at line 53 of file SessionItemController.h.
Referenced by onItemDestroy(), subscribe(), subscribeParent(), unsubscribe(), and unsubscribeParent().
|
private |
Definition at line 50 of file SessionItemController.h.
Referenced by setSubscribeCallback(), and subscribeParent().
|
private |
Definition at line 51 of file SessionItemController.h.
Referenced by setUnsubscribeCallback(), and unsubscribeParent().