BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::StatusStringReporter::StatusStringReporterImpl Struct Reference
Collaboration diagram for ModelView::StatusStringReporter::StatusStringReporterImpl:
[legend]

Public Member Functions

 StatusStringReporterImpl (StatusStringReporter *parent, QCustomPlot *custom_plot, callback_t callback, std::unique_ptr< StatusStringFormatterInterface > formatter)
 
void entering_the_area ()
 Notify client on entering axes area. More...
 
void leaving_the_area ()
 Notify client on leaving axes area. More...
 
void notify_client (const MousePosInfo &pos)
 Notify client about mouse move with formatted status string. More...
 

Public Attributes

callback_t callback
 
QCustomPlot * custom_plot {nullptr}
 
std::unique_ptr< StatusStringFormatterInterfacefmt
 
std::unique_ptr< MouseMoveReportermouse_reporter
 
StatusStringReporterparent {nullptr}
 
MousePosInfo prevPos
 

Detailed Description

Definition at line 23 of file statusstringreporter.cpp.

Constructor & Destructor Documentation

◆ StatusStringReporterImpl()

ModelView::StatusStringReporter::StatusStringReporterImpl::StatusStringReporterImpl ( StatusStringReporter parent,
QCustomPlot *  custom_plot,
callback_t  callback,
std::unique_ptr< StatusStringFormatterInterface formatter 
)
inline

Definition at line 31 of file statusstringreporter.cpp.

34  : parent(parent)
36  , callback(std::move(callback))
37  , fmt(std::move(formatter))
38  {
39  if (!custom_plot)
40  throw std::runtime_error("StatusStringReporter: not initialized custom plot.");
41 
42  auto on_mouse_move = [this](const MousePosInfo& pos) {
43  if (pos.in_axes_range) {
44  notify_client(pos);
47  } else {
50  }
51 
52  prevPos = pos;
53  };
54  mouse_reporter = std::make_unique<MouseMoveReporter>(custom_plot, on_mouse_move);
55  }
Aggregate to hold mouse position info in QCustomPlot context.
Definition: mouseposinfo.h:27
std::unique_ptr< StatusStringFormatterInterface > fmt
void entering_the_area()
Notify client on entering axes area.
void notify_client(const MousePosInfo &pos)
Notify client about mouse move with formatted status string.
void leaving_the_area()
Notify client on leaving axes area.

References ModelView::StatusStringReporter::StatusStringReporterImpl::custom_plot, ModelView::StatusStringReporter::StatusStringReporterImpl::entering_the_area(), ModelView::MousePosInfo::in_axes_range, ModelView::StatusStringReporter::StatusStringReporterImpl::leaving_the_area(), ModelView::StatusStringReporter::StatusStringReporterImpl::mouse_reporter, ModelView::StatusStringReporter::StatusStringReporterImpl::notify_client(), and ModelView::StatusStringReporter::StatusStringReporterImpl::prevPos.

Here is the call graph for this function:

Member Function Documentation

◆ entering_the_area()

void ModelView::StatusStringReporter::StatusStringReporterImpl::entering_the_area ( )
inline

Notify client on entering axes area.

Definition at line 74 of file statusstringreporter.cpp.

75  {
76  // for future improvements
77  }

Referenced by ModelView::StatusStringReporter::StatusStringReporterImpl::StatusStringReporterImpl().

◆ leaving_the_area()

void ModelView::StatusStringReporter::StatusStringReporterImpl::leaving_the_area ( )
inline

Notify client on leaving axes area.

Definition at line 66 of file statusstringreporter.cpp.

67  {
68  // notifying client with empty string as a sign that we have left the area
69  callback({});
70  }

References ModelView::StatusStringReporter::StatusStringReporterImpl::callback.

Referenced by ModelView::StatusStringReporter::StatusStringReporterImpl::StatusStringReporterImpl().

◆ notify_client()

void ModelView::StatusStringReporter::StatusStringReporterImpl::notify_client ( const MousePosInfo pos)
inline

Member Data Documentation

◆ callback

◆ custom_plot

QCustomPlot* ModelView::StatusStringReporter::StatusStringReporterImpl::custom_plot {nullptr}

◆ fmt

std::unique_ptr<StatusStringFormatterInterface> ModelView::StatusStringReporter::StatusStringReporterImpl::fmt

◆ mouse_reporter

std::unique_ptr<MouseMoveReporter> ModelView::StatusStringReporter::StatusStringReporterImpl::mouse_reporter

◆ parent

StatusStringReporter* ModelView::StatusStringReporter::StatusStringReporterImpl::parent {nullptr}

Definition at line 24 of file statusstringreporter.cpp.

◆ prevPos

MousePosInfo ModelView::StatusStringReporter::StatusStringReporterImpl::prevPos

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