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

Public Member Functions

 CustomPlotSceneAdapterImpl (QCustomPlot *custom_plot)
 
double fromSceneX (double scene_x) const
 
double fromSceneY (double scene_y) const
 
double toSceneX (double customplot_x) const
 
double toSceneY (double customplot_y) const
 
QRectF viewportRectangle () const
 

Public Attributes

std::unique_ptr< QMetaObject::Connection > conn_to_customplot
 
QCustomPlot * custom_plot {nullptr}
 

Detailed Description

Definition at line 21 of file customplotsceneadapter.cpp.

Constructor & Destructor Documentation

◆ CustomPlotSceneAdapterImpl()

ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::CustomPlotSceneAdapterImpl ( QCustomPlot *  custom_plot)
inline

Member Function Documentation

◆ fromSceneX()

double ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::fromSceneX ( double  scene_x) const
inline

Definition at line 39 of file customplotsceneadapter.cpp.

40  {
41  return custom_plot ? custom_plot->xAxis->pixelToCoord(scene_x) : scene_x;
42  }

References ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::custom_plot.

◆ fromSceneY()

double ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::fromSceneY ( double  scene_y) const
inline

Definition at line 44 of file customplotsceneadapter.cpp.

45  {
46  return custom_plot ? custom_plot->yAxis->pixelToCoord(scene_y) : scene_y;
47  }

References ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::custom_plot.

◆ toSceneX()

double ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::toSceneX ( double  customplot_x) const
inline

Definition at line 29 of file customplotsceneadapter.cpp.

30  {
31  return custom_plot ? custom_plot->xAxis->coordToPixel(customplot_x) : customplot_x;
32  }

References ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::custom_plot.

Referenced by ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::viewportRectangle().

◆ toSceneY()

double ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::toSceneY ( double  customplot_y) const
inline

Definition at line 34 of file customplotsceneadapter.cpp.

35  {
36  return custom_plot ? custom_plot->yAxis->coordToPixel(customplot_y) : customplot_y;
37  }

References ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::custom_plot.

Referenced by ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::viewportRectangle().

◆ viewportRectangle()

QRectF ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::viewportRectangle ( ) const
inline

Definition at line 49 of file customplotsceneadapter.cpp.

50  {
51  if (!custom_plot)
52  return {};
53 
54  auto xrange = custom_plot->xAxis->range();
55  auto yrange = custom_plot->yAxis->range();
56 
57  return QRectF(toSceneX(xrange.lower), toSceneY(yrange.upper),
58  toSceneX(xrange.upper) - toSceneX(xrange.lower),
59  toSceneY(yrange.lower) - toSceneY(yrange.upper));
60  }

References ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::custom_plot, ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::toSceneX(), and ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::toSceneY().

Here is the call graph for this function:

Member Data Documentation

◆ conn_to_customplot

std::unique_ptr<QMetaObject::Connection> ModelView::CustomPlotSceneAdapter::CustomPlotSceneAdapterImpl::conn_to_customplot

◆ custom_plot


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