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

Public Member Functions

 GraphCanvasImpl ()
 
QCustomPlot * customPlot ()
 
void setViewportToContent ()
 Updates viewport. More...
 
void setViewportToContent (double left, double top, double right, double bottom)
 Updates viewport. More...
 

Public Attributes

QCustomPlot * custom_plot {nullptr}
 
std::unique_ptr< StatusStringReporterreporter
 
StatusLabelstatus_label {nullptr}
 
std::unique_ptr< GraphViewportPlotControllerviewport_controller
 

Detailed Description

Definition at line 48 of file graphcanvas.cpp.

Constructor & Destructor Documentation

◆ GraphCanvasImpl()

ModelView::GraphCanvas::GraphCanvasImpl::GraphCanvasImpl ( )
inline

Definition at line 54 of file graphcanvas.cpp.

54  : custom_plot(new QCustomPlot), status_label(new StatusLabel)
55  {
56  viewport_controller = std::make_unique<GraphViewportPlotController>(custom_plot);
57 
58  auto on_mouse_move = [this](const std::string& str) {
59  status_label->setText(QString::fromStdString(str));
60  };
61  reporter = CreateGraphReporter(custom_plot, on_mouse_move);
62  }
Shows a single line of text on a white background.
Definition: statuslabel.h:29
void setText(const QString &text)
Definition: statuslabel.cpp:31
std::unique_ptr< StatusStringReporter > CreateGraphReporter(QCustomPlot *custom_plot, std::function< void(const std::string &)> callback)
Creates reporter for status string in QCustomPlot containing graphs.
std::unique_ptr< StatusStringReporter > reporter
Definition: graphcanvas.cpp:51
std::unique_ptr< GraphViewportPlotController > viewport_controller
Definition: graphcanvas.cpp:50

References ModelView::CreateGraphReporter(), ModelView::GraphCanvas::GraphCanvasImpl::custom_plot, ModelView::GraphCanvas::GraphCanvasImpl::reporter, ModelView::StatusLabel::setText(), ModelView::GraphCanvas::GraphCanvasImpl::status_label, and ModelView::GraphCanvas::GraphCanvasImpl::viewport_controller.

Here is the call graph for this function:

Member Function Documentation

◆ customPlot()

QCustomPlot* ModelView::GraphCanvas::GraphCanvasImpl::customPlot ( )
inline

Definition at line 80 of file graphcanvas.cpp.

80 { return custom_plot; }

References ModelView::GraphCanvas::GraphCanvasImpl::custom_plot.

◆ setViewportToContent() [1/2]

void ModelView::GraphCanvas::GraphCanvasImpl::setViewportToContent ( )
inline

Updates viewport.

Definition at line 65 of file graphcanvas.cpp.

66  {
67  if (!viewport_controller->currentItem())
68  return;
69  viewport_controller->currentItem()->setViewportToContent();
70  }

References ModelView::GraphCanvas::GraphCanvasImpl::viewport_controller.

◆ setViewportToContent() [2/2]

void ModelView::GraphCanvas::GraphCanvasImpl::setViewportToContent ( double  left,
double  top,
double  right,
double  bottom 
)
inline

Updates viewport.

Definition at line 73 of file graphcanvas.cpp.

74  {
75  if (!viewport_controller->currentItem())
76  return;
77  viewport_controller->currentItem()->setViewportToContent(left, top, right, bottom);
78  }

References ModelView::GraphCanvas::GraphCanvasImpl::viewport_controller.

Member Data Documentation

◆ custom_plot

QCustomPlot* ModelView::GraphCanvas::GraphCanvasImpl::custom_plot {nullptr}

◆ reporter

std::unique_ptr<StatusStringReporter> ModelView::GraphCanvas::GraphCanvasImpl::reporter

◆ status_label

StatusLabel* ModelView::GraphCanvas::GraphCanvasImpl::status_label {nullptr}

◆ viewport_controller

std::unique_ptr<GraphViewportPlotController> ModelView::GraphCanvas::GraphCanvasImpl::viewport_controller

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