BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::AxisTitleController::AxisTitleControllerImpl Struct Reference

Public Member Functions

 AxisTitleControllerImpl (QCPAxis *axis)
 
void updateAxisFromItem (TextItem *item)
 

Public Attributes

QCPAxis * m_axis {nullptr}
 

Detailed Description

Definition at line 22 of file axistitlecontroller.cpp.

Constructor & Destructor Documentation

◆ AxisTitleControllerImpl()

ModelView::AxisTitleController::AxisTitleControllerImpl::AxisTitleControllerImpl ( QCPAxis *  axis)
inline

Definition at line 25 of file axistitlecontroller.cpp.

25  : m_axis(axis)
26  {
27  if (!axis)
28  throw std::runtime_error("AxisTitleController: axis is not initialized.");
29  }

Member Function Documentation

◆ updateAxisFromItem()

void ModelView::AxisTitleController::AxisTitleControllerImpl::updateAxisFromItem ( TextItem item)
inline

Definition at line 31 of file axistitlecontroller.cpp.

32  {
33  auto font = m_axis->labelFont();
34  font.setPointSize(item->property<int>(TextItem::P_SIZE));
35  font.setFamily(QString::fromStdString(item->property<std::string>(TextItem::P_FONT)));
36  m_axis->setLabel(QString::fromStdString(item->property<std::string>(TextItem::P_TEXT)));
37  m_axis->setLabelFont(font);
38 
39  m_axis->parentPlot()->replot();
40  }
T property(const std::string &tag) const
Returns data stored in property item.
Definition: sessionitem.h:181

References ModelView::ItemListenerBase::item(), ModelView::AxisTitleController::AxisTitleControllerImpl::m_axis, ModelView::TextItem::P_FONT, ModelView::TextItem::P_SIZE, ModelView::TextItem::P_TEXT, and ModelView::SessionItem::property().

Here is the call graph for this function:

Member Data Documentation

◆ m_axis

QCPAxis* ModelView::AxisTitleController::AxisTitleControllerImpl::m_axis {nullptr}

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