SGSolve
|
A customized version of QCustomPlot. More...
#include <sgcustomplot.hpp>
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. | |
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.
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.
|
inlineprivatevirtual |
Reimplement hasHeighForWidth.
Indicates that heightForWidth has been reimplemented.
|
inlineprivatevirtual |
Reimplement heightForWidth.
Suggests a square aspect ratio.
|
inlineprotected |
Reimplement resizeEvent.
Calls adjust ranges before calling QCustomPlot::resizeEvent.
void SGCustomPlot::setRanges | ( | const QCPRange & | xrange, |
const QCPRange & | yrange | ||
) |
Sets the nominal ranges.
Constructor.
|
inlineprivateslot |
Slot for showing context menu.
Creates a context menu and shows the actions for saving PDF/PNG files.
|
private |
Nominal X range.
|
private |
Nominal Y range.
|
private |
Save file path.
< Stores the last location used to save a picture.
|
private |
Real X range.
|
private |
Real Y range.
|
private |
The graph title.