BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The ItemComboWidget class combines stack of widgets with QComboBox controller to switch between widgets. It is used in the case when one SessionItem can be presented with different widgets.
For example, in JobDatafieldWidget the results of the job can be presented with either IntensityDataWidget or FitDataWidget, depending from the JobView's activity type. For the presentation the special value of an empty string can be used which results in an empty widget being shown (with the toolbar hidden). In this case the current item can also be nullptr
and this presentation needs not to be listed in the (active)PresentationList functions.
Definition at line 38 of file ItemComboWidget.h.
Public Types | |
using | factory_function_t = std::function< SessionItemWidget *()> |
Public Member Functions | |
ItemComboWidget (QWidget *parent=nullptr) | |
virtual QList< QAction * > | actionList () |
SessionItem * | currentItem () |
const SessionItem * | currentItem () const |
void | registerWidget (const QString &presentationType, factory_function_t) |
void | setItem (SessionItem *item) override |
virtual void | setPresentation (const QString &presentationType) |
Sets stack to show widget corresponding to given presentation. More... | |
void | setToolbarVisible (bool value) |
Protected Member Functions | |
virtual QStringList | activePresentationList (SessionItem *item) |
Returns list of active presentations for given item. Active presentation is the one which is present in QComboBox selector and can be selected. For example, if JobItem is fittable, the list will contain "FitComparisonWidgetName". More... | |
void | hideEvent (QHideEvent *) override |
virtual QString | itemPresentation () const |
Presentation which should be shown for current item. More... | |
virtual QStringList | presentationList (SessionItem *item) |
Returns full list of presentations available for given item. More... | |
QString | selectedPresentation () const |
Presentation selected in combo selector. More... | |
void | showEvent (QShowEvent *) override |
void | subscribeToItem () override |
virtual void | unsubscribeFromItem () |
Private Slots | |
void | onComboChanged (const QString &name) |
Private Member Functions | |
void | setSizeToCurrentWidget () |
Resizes QStackedWidget to currently active page. More... | |
Private Attributes | |
QWidget * | m_blankWidget |
SessionItemController * | m_itemController |
QMap< QString, SessionItemWidget * > | m_presentationTypeToWidget |
QStackedWidget * | m_stackedWidget |
ItemComboToolbar * | m_toolbar |
IFactory< QString, SessionItemWidget > | m_widgetFactory |
using ItemComboWidget::factory_function_t = std::function<SessionItemWidget*()> |
Definition at line 42 of file ItemComboWidget.h.
|
explicit |
Definition at line 21 of file ItemComboWidget.cpp.
References ItemComboToolbar::comboChanged(), m_blankWidget, m_stackedWidget, m_toolbar, onComboChanged(), and setToolbarVisible().
|
virtualinherited |
Reimplemented in IntensityDataProjectionsWidget, SpecularDataWidget, SpecularDataCanvas, FitComparisonWidget1D, FitComparisonWidget, IntensityDataWidget, IntensityDataCanvas, SpecularDataImportWidget, RealDataPresenter, and RealDataMaskWidget.
Definition at line 36 of file SessionItemWidget.cpp.
Referenced by setPresentation().
|
protectedvirtual |
Returns list of active presentations for given item. Active presentation is the one which is present in QComboBox selector and can be selected. For example, if JobItem is fittable, the list will contain "FitComparisonWidgetName".
Reimplemented in JobResultsPresenter, and RealDataPresenter.
Definition at line 100 of file ItemComboWidget.cpp.
Referenced by presentationList(), setPresentation(), and subscribeToItem().
|
inherited |
Definition at line 41 of file SessionItemWidget.cpp.
Referenced by FitFlowWidget::fitSuiteItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataWidget::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), ColorMap::intensityItem(), JobResultsPresenter::itemPresentation(), FitParameterWidget::jobItem(), ParameterTuningWidget::jobItem(), RunFitControlWidget::jobItem(), FitComparisonWidget::jobItem(), FitComparisonWidget1D::jobItem(), IntensityDataPropertyWidget::jobItem(), SpecularDataPropertyWidget::jobItem(), SpecularDataImportWidget::realDataItem(), setPresentation(), JobResultsPresenter::setPresentation(), SpecularDataImportWidget::specularDataItem(), SpecularDataCanvas::specularDataItem(), SpecularDataWidget::specularDataItem(), SpecularPlot::specularItem(), subscribeToItem(), ProjectionsPlot::unsubscribeFromChildren(), and Plot1D::viewItem().
|
inherited |
Definition at line 46 of file SessionItemWidget.cpp.
References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.
|
overrideprotectedinherited |
Definition at line 56 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().
|
protectedvirtual |
Presentation which should be shown for current item.
Reimplemented in JobResultsPresenter.
Definition at line 115 of file ItemComboWidget.cpp.
References selectedPresentation().
Referenced by setItem(), and subscribeToItem().
|
privateslot |
Definition at line 134 of file ItemComboWidget.cpp.
References selectedPresentation(), and setPresentation().
Referenced by ItemComboWidget().
|
protectedvirtual |
Returns full list of presentations available for given item.
Reimplemented in JobResultsPresenter.
Definition at line 108 of file ItemComboWidget.cpp.
References activePresentationList().
Referenced by subscribeToItem().
void ItemComboWidget::registerWidget | ( | const QString & | presentationType, |
factory_function_t | f | ||
) |
Definition at line 44 of file ItemComboWidget.cpp.
References m_widgetFactory.
Referenced by JobResultsPresenter::JobResultsPresenter(), and RealDataPresenter::RealDataPresenter().
|
protected |
Presentation selected in combo selector.
Definition at line 122 of file ItemComboWidget.cpp.
References ItemComboToolbar::currentPresentation(), and m_toolbar.
Referenced by itemPresentation(), JobResultsPresenter::itemPresentation(), and onComboChanged().
|
overridevirtual |
Reimplemented from SessionItemWidget.
Reimplemented in JobResultsPresenter.
Definition at line 88 of file ItemComboWidget.cpp.
References itemPresentation(), m_blankWidget, m_stackedWidget, SessionItemWidget::setItem(), and setToolbarVisible().
Referenced by JobResultsPresenter::setItem().
|
virtual |
Sets stack to show widget corresponding to given presentation.
Reimplemented in JobResultsPresenter.
Definition at line 50 of file ItemComboWidget.cpp.
References SessionItemWidget::actionList(), activePresentationList(), SessionItemWidget::currentItem(), m_blankWidget, m_presentationTypeToWidget, m_stackedWidget, m_toolbar, m_widgetFactory, ItemComboToolbar::setActionList(), SessionItemWidget::setItem(), ItemComboToolbar::setPresentation(), setSizeToCurrentWidget(), and setToolbarVisible().
Referenced by onComboChanged(), JobResultsPresenter::setPresentation(), and subscribeToItem().
|
private |
Resizes QStackedWidget to currently active page.
Definition at line 141 of file ItemComboWidget.cpp.
References m_stackedWidget.
Referenced by setPresentation().
void ItemComboWidget::setToolbarVisible | ( | bool | value | ) |
Definition at line 83 of file ItemComboWidget.cpp.
References m_toolbar.
Referenced by ItemComboWidget(), setItem(), and setPresentation().
|
overrideprotectedinherited |
Definition at line 51 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::subscribe().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 127 of file ItemComboWidget.cpp.
References activePresentationList(), SessionItemWidget::currentItem(), itemPresentation(), m_toolbar, presentationList(), setPresentation(), and ItemComboToolbar::setPresentationList().
|
inlineprotectedvirtualinherited |
Reimplemented in ProjectionsPlot, IntensityDataProjectionsWidget, ColorMap, SpecularPlot, Plot1D, FitFlowWidget, FitComparisonWidget1D, FitComparisonWidget, RealDataMaskWidget, and RunFitControlWidget.
Definition at line 44 of file SessionItemWidget.h.
Referenced by SessionItemWidget::SessionItemWidget().
|
private |
Definition at line 70 of file ItemComboWidget.h.
Referenced by ItemComboWidget(), setItem(), and setPresentation().
|
privateinherited |
Definition at line 49 of file SessionItemWidget.h.
Referenced by SessionItemWidget::SessionItemWidget(), SessionItemWidget::currentItem(), SessionItemWidget::hideEvent(), SessionItemWidget::setItem(), and SessionItemWidget::showEvent().
|
private |
Definition at line 69 of file ItemComboWidget.h.
Referenced by setPresentation().
|
private |
Definition at line 67 of file ItemComboWidget.h.
Referenced by ItemComboWidget(), setItem(), setPresentation(), and setSizeToCurrentWidget().
|
private |
Definition at line 66 of file ItemComboWidget.h.
Referenced by ItemComboWidget(), selectedPresentation(), setPresentation(), setToolbarVisible(), and subscribeToItem().
|
private |
Definition at line 68 of file ItemComboWidget.h.
Referenced by registerWidget(), and setPresentation().