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

Public Member Functions

 PenControllerImpl (QCPGraph *graph)
 
void update_graph_from_item (PenItem *item)
 

Public Attributes

QCPGraph * m_graph {nullptr}
 

Detailed Description

Definition at line 32 of file pencontroller.cpp.

Constructor & Destructor Documentation

◆ PenControllerImpl()

ModelView::PenController::PenControllerImpl::PenControllerImpl ( QCPGraph *  graph)
inline

Definition at line 34 of file pencontroller.cpp.

34  : m_graph(graph)
35  {
36  if (!m_graph)
37  throw std::runtime_error("Error in PenController: uninitialised graph.");
38  }

References ModelView::PenController::PenControllerImpl::m_graph.

Member Function Documentation

◆ update_graph_from_item()

void ModelView::PenController::PenControllerImpl::update_graph_from_item ( PenItem item)
inline

Definition at line 40 of file pencontroller.cpp.

41  {
42  QColor color(QString::fromStdString(item->colorName()));
43  auto pencombo = item->property<ComboProperty>(PenItem::P_STYLE);
44  auto penwidth = item->property<int>(PenItem::P_WIDTH);
45 
46  QPen pen;
47  pen.setColor(color);
48  pen.setStyle(getQtPenFromComboIndex(pencombo));
49  pen.setWidth(penwidth);
50  m_graph->setPen(pen);
51 
52  m_graph->parentPlot()->replot();
53  }
Custom property to define list of string values with multiple selections.
Definition: comboproperty.h:27
std::string colorName() const
Returns color name in #RRGGBB format.
T property(const std::string &tag) const
Returns data stored in property item.
Definition: sessionitem.h:181

References ModelView::ItemListenerBase::item(), ModelView::PenController::PenControllerImpl::m_graph, ModelView::PenItem::P_STYLE, ModelView::PenItem::P_WIDTH, and ModelView::SessionItem::property().

Here is the call graph for this function:

Member Data Documentation

◆ m_graph

QCPGraph* ModelView::PenController::PenControllerImpl::m_graph {nullptr}

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