title: Access QCustomPlot Variable
body: <p><strong>In Short:</strong> </p>
  
  <p>I need to access a QCustomPlot variable in a WidgetClass. But I can't because it's private in that context. How is this accomplished?</p>
  
  <p><strong>What I have done:</strong></p>
  
  <p>I have a class that creates a graph and a widget class that calls the graph class 
  My QCustomPlot variable is a private variable that is being declared in the graph class, but  I need to access this variable in the Widget Class. </p>
  
  <p>I have a generate_graphs slot that gets data and passes the data to the graph class and from there the graph is created. I am saving to a png, so I need to access the graph variable with this data, the variable is passed data in the WidgetClass which then calls the graph class, which generates the graph. </p>
  
  <p>The graph class variable (in the Widget Class) is declared like so: <code>GraphWidget* graph</code>
  I try to access the QCustomPlot variable in that slot like this: <code>graph-&gt;QCustomPlot-&gt;savePNG()</code>
  I keep getting an error that says <code>QCustomPlot* GraphWidget::QCustomPlot is private within this context</code></p>
  
  <p>I then created a function to just return the <code>GraphWidget* graph</code> so I could access that variable in the graph class. Instead so I could access the QCustomPlot variable without it being private in that context. This caused errors because it needs to be passed a <code>GraphWidget* graph</code> which is not declared in the GraphWidget class. </p>