SGSolve
SGCustomPlot Class Reference

A customized version of QCustomPlot. More...

#include <sgcustomplot.hpp>

Inheritance diagram for SGCustomPlot:
Collaboration diagram for SGCustomPlot:

Signals

void inspectPoint (SGPoint point, int state, bool isDetailPlot)
 Signal to inspect the given point.
 
void simulateEquilibrium (SGPoint point, int state, bool isDetailPlot)
 Signal to simulate the given equilibrium forwards.
 

Public Member Functions

 SGCustomPlot ()
 Constructor.
 
 SGCustomPlot (int _state, bool _isDetailPlot)
 Constructor. More...
 
QCPPlotTitle * getTitle ()
 Returns the title.
 
void adjustRanges ()
 Updates ranges when window is resized.
 
void setRanges (const QCPRange &xrange, const QCPRange &yrange)
 Sets the nominal ranges. More...
 
const QCPRange & getNominalXRange () const
 Returns the nominal X range.
 
const QCPRange & getNominalYRange () const
 Returns the nominal Y range.
 
void equalizeAxesScales ()
 Normalize ranges.
 
void setState (int newState)
 Sets the state associated with the plot.
 
int getState () const
 Gets the state associated with the plot.
 

Protected Member Functions

void resizeEvent (QResizeEvent *event)
 Reimplement resizeEvent. More...
 

Private Slots

void ShowContextMenu (const QPoint &pos)
 Slot for showing context menu. More...
 
void pointInspected ()
 Point inspected.
 
void simulationRequested ()
 
void savePDF ()
 Saves graph as a PDF.
 
void savePNG ()
 Saves graph as a PNG.
 

Private Member Functions

virtual int heightForWidth (int w) const
 Reimplement heightForWidth. More...
 
virtual bool hasHeightForWidth () const
 Reimplement hasHeighForWidth. More...
 
virtual QSize minimumSizeHint () const
 Custom minimum size.
 

Private Attributes

int state
 Indicates the state that this plot is associated with.
 
bool isDetailPlot
 Indicates if this is the detail plot.
 
QCPPlotTitle * title
 
QCPRange nominalXRange
 
QCPRange nominalYRange
 
QCPRange realXRange
 
QCPRange realYRange
 
QString path
 Save file path. More...
 
QAction * inspectPointAction
 Inspect a point.
 
QAction * simulateAction
 Action for forward simulating.
 
QAction * savePNGAction
 Pointer to the QAction for saving PNG files.
 
QAction * savePDFAction
 Pointer to the QAction for saving PDF files.
 
QPoint lastContextPos
 Stores the last location at which a context menu was requested.
 

Detailed Description

A customized version of QCustomPlot.

This class inherits from QCustomPlot and adds functionality for controling ranges to maintain the desired aspect ratio. It also adds functionality for right-clicking on the plot to bring up a context menu. This menu has various options, some of which pertain to the payoffs closest to where the user clicked. In particular, there are signals for saving copys of the plots, for "inspecting" a given payoff vector, and for initializing the SGSimulationHandler to forward simulate the equilibrium that generates the given payoffs.

Constructor & Destructor Documentation

◆ SGCustomPlot()

SGCustomPlot::SGCustomPlot ( int  _state,
bool  _isDetailPlot 
)

Constructor.

Sets the state and whether or not is the detailPlot. Also initializes the plot and connect slots to actions.

Member Function Documentation

◆ hasHeightForWidth()

virtual bool SGCustomPlot::hasHeightForWidth ( ) const
inlineprivatevirtual

Reimplement hasHeighForWidth.

Indicates that heightForWidth has been reimplemented.

◆ heightForWidth()

virtual int SGCustomPlot::heightForWidth ( int  w) const
inlineprivatevirtual

Reimplement heightForWidth.

Suggests a square aspect ratio.

◆ resizeEvent()

void SGCustomPlot::resizeEvent ( QResizeEvent *  event)
inlineprotected

Reimplement resizeEvent.

Calls adjust ranges before calling QCustomPlot::resizeEvent.

◆ setRanges()

void SGCustomPlot::setRanges ( const QCPRange &  xrange,
const QCPRange &  yrange 
)

Sets the nominal ranges.

Constructor.

◆ ShowContextMenu

void SGCustomPlot::ShowContextMenu ( const QPoint &  pos)
inlineprivateslot

Slot for showing context menu.

Creates a context menu and shows the actions for saving PDF/PNG files.

Member Data Documentation

◆ nominalXRange

QCPRange SGCustomPlot::nominalXRange
private

Nominal X range.

◆ nominalYRange

QCPRange SGCustomPlot::nominalYRange
private

Nominal Y range.

◆ path

QString SGCustomPlot::path
private

Save file path.

< Stores the last location used to save a picture.

◆ realXRange

QCPRange SGCustomPlot::realXRange
private

Real X range.

◆ realYRange

QCPRange SGCustomPlot::realYRange
private

Real Y range.

◆ title

QCPPlotTitle* SGCustomPlot::title
private

The graph title.


The documentation for this class was generated from the following files: