![]() |
.Simulation
|
Extension of the QCustomPlot class that allows an implementation of the class with different event handlers. More...
#include <QCPExtended.h>
Public Member Functions | |
QCPExtended (QWidget *parent=NULL) | |
Constructor. | |
![]() | |
QCustomPlot (QWidget *parent=0) | |
Constructs a QCustomPlot and sets reasonable default values. More... | |
QString | title () const |
QFont | titleFont () const |
QColor | titleColor () const |
QRect | axisRect () const |
QRect | viewport () const |
Returns the viewport rect of this QCustomPlot instance. More... | |
int | marginLeft () const |
int | marginRight () const |
int | marginTop () const |
int | marginBottom () const |
bool | autoMargin () const |
QColor | color () const |
Qt::Orientations | rangeDrag () const |
Qt::Orientations | rangeZoom () const |
QCPAxis * | rangeDragAxis (Qt::Orientation orientation) |
Returns the range drag axis of the orientation provided. More... | |
QCPAxis * | rangeZoomAxis (Qt::Orientation orientation) |
Returns the range zoom axis of the orientation provided. More... | |
double | rangeZoomFactor (Qt::Orientation orientation) |
Returns the range zoom factor of the orientation provided. More... | |
QCP::AntialiasedElements | antialiasedElements () const |
QCP::AntialiasedElements | notAntialiasedElements () const |
bool | autoAddPlottableToLegend () const |
QPixmap | axisBackground () const |
bool | axisBackgroundScaled () const |
Qt::AspectRatioMode | axisBackgroundScaledMode () const |
const Interactions | interactions () const |
int | selectionTolerance () const |
QFont | selectedTitleFont () const |
QColor | selectedTitleColor () const |
bool | titleSelected () const |
bool | noAntialiasingOnDrag () const |
QCP::PlottingHints | plottingHints () const |
Qt::KeyboardModifier | multiSelectModifier () const |
void | setTitle (const QString &title) |
Sets the plot title which will be drawn centered at the top of the widget. More... | |
void | setTitleFont (const QFont &font) |
Sets the font of the plot title. More... | |
void | setTitleColor (const QColor &color) |
Sets the text color of the plot title. More... | |
void | setAxisRect (const QRect &arect) |
An alternative way to set the margins, by directly setting the wanted axis rect. More... | |
void | setMarginLeft (int margin) |
Sets the left margin manually. More... | |
void | setMarginRight (int margin) |
Sets the right margin manually. More... | |
void | setMarginTop (int margin) |
Sets the top margin manually. More... | |
void | setMarginBottom (int margin) |
Sets the bottom margin manually. More... | |
void | setMargin (int left, int right, int top, int bottom) |
Sets the margins manually. More... | |
void | setAutoMargin (bool enabled) |
Sets whether the margins are calculated automatically depeding on the sizes of the tick labels, axis labels, paddings etc. More... | |
void | setColor (const QColor &color) |
Sets the background color of the QCustomPlot widget. | |
void | setRangeDrag (Qt::Orientations orientations) |
Sets which axis orientation may be range dragged by the user with mouse interaction. More... | |
void | setRangeZoom (Qt::Orientations orientations) |
Sets which axis orientation may be zoomed by the user with the mouse wheel. More... | |
void | setRangeDragAxes (QCPAxis *horizontal, QCPAxis *vertical) |
Sets the axes whose range will be dragged when setRangeDrag enables mouse range dragging on the QCustomPlot widget. More... | |
void | setRangeZoomAxes (QCPAxis *horizontal, QCPAxis *vertical) |
Sets the axes whose range will be zoomed when setRangeZoom enables mouse wheel zooming on the QCustomPlot widget. More... | |
void | setRangeZoomFactor (double horizontalFactor, double verticalFactor) |
Sets how strong one rotation step of the mouse wheel zooms, when range zoom was activated with setRangeZoom. More... | |
void | setRangeZoomFactor (double factor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets both the horizontal and vertical zoom factor. | |
void | setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements) |
Sets which elements are forcibly drawn antialiased as an or combination of QCP::AntialiasedElement. More... | |
void | setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true) |
Sets whether the specified antialiasedElement is forcibly drawn antialiased. More... | |
void | setNotAntialiasedElements (const QCP::AntialiasedElements ¬AntialiasedElements) |
Sets which elements are forcibly drawn not antialiased as an or combination of QCP::AntialiasedElement. More... | |
void | setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true) |
Sets whether the specified notAntialiasedElement is forcibly drawn not antialiased. More... | |
void | setAutoAddPlottableToLegend (bool on) |
If set to true, adding a plottable (e.g. More... | |
void | setAxisBackground (const QPixmap &pm) |
Sets pm as the axis background pixmap. More... | |
void | setAxisBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Allows setting the background pixmap, whether it shall be scaled and how it shall be scaled in one call. More... | |
void | setAxisBackgroundScaled (bool scaled) |
Sets whether the axis background pixmap shall be scaled to fit the current axis rect or not. More... | |
void | setAxisBackgroundScaledMode (Qt::AspectRatioMode mode) |
If scaling of the axis background pixmap is enabled (setAxisBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap passed to setAxisBackground is preserved. More... | |
void | setInteractions (const Interactions &interactions) |
Sets the possible interactions of this QCustomPlot as an or-combination of Interaction enums. More... | |
void | setInteraction (const Interaction &interaction, bool enabled=true) |
Sets the single interaction of this QCustomPlot to enabled. More... | |
void | setSelectionTolerance (int pixels) |
Sets the tolerance that is used when deciding whether a click on the QCustomPlot surface selects an object (e.g. More... | |
void | setSelectedTitleFont (const QFont &font) |
This font is used to draw the title, when it is selected. More... | |
void | setSelectedTitleColor (const QColor &color) |
This color is used to draw the title, when it is selected. More... | |
void | setTitleSelected (bool selected) |
Sets whether the plot title is selected. More... | |
void | setNoAntialiasingOnDrag (bool enabled) |
Sets whether antialiasing is disabled for all elements while the user is dragging axes ranges. More... | |
void | setPlottingHints (const QCP::PlottingHints &hints) |
Sets the plotting hints for this QCustomPlot instance. More... | |
void | setPlottingHint (QCP::PlottingHint hint, bool enabled=true) |
Sets the specified plotting hint to enabled. More... | |
void | setMultiSelectModifier (Qt::KeyboardModifier modifier) |
Sets the keyboard modifier that will be recognized as multi-select-modifier. More... | |
QCPAbstractPlottable * | plottable (int index) |
Returns the plottable with index. More... | |
QCPAbstractPlottable * | plottable () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the last plottable, that was added with addPlottable. More... | |
bool | addPlottable (QCPAbstractPlottable *plottable) |
Adds the specified plottable to the plot and, if setAutoAddPlottableToLegend is enabled, to the legend. More... | |
bool | removePlottable (QCPAbstractPlottable *plottable) |
Removes the specified plottable from the plot and, if necessary, from the legend. More... | |
bool | removePlottable (int index) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the plottable by its index. | |
int | clearPlottables () |
Removes all plottables from the plot (and the legend, if necessary). More... | |
int | plottableCount () const |
Returns the number of currently existing plottables in the plot. More... | |
QList< QCPAbstractPlottable * > | selectedPlottables () const |
Returns a list of the selected plottables. More... | |
QCPAbstractPlottable * | plottableAt (const QPointF &pos, bool onlySelectable=false) const |
Returns the plottable at the pixel position pos. More... | |
bool | hasPlottable (QCPAbstractPlottable *plottable) const |
Returns whether this QCustomPlot instance contains the plottable. More... | |
QCPGraph * | graph (int index) const |
Returns the graph with index. More... | |
QCPGraph * | graph () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the last graph, that was created with addGraph. More... | |
QCPGraph * | addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0) |
Creates a new graph inside the plot. More... | |
bool | removeGraph (QCPGraph *graph) |
Removes the specified graph from the plot and, if necessary, from the legend. More... | |
bool | removeGraph (int index) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the graph by its index. | |
int | clearGraphs () |
Removes all graphs from the plot (and the legend, if necessary). More... | |
int | graphCount () const |
Returns the number of currently existing graphs in the plot. More... | |
QList< QCPGraph * > | selectedGraphs () const |
Returns a list of the selected graphs. More... | |
QCPAbstractItem * | item (int index) const |
Returns the item with index. More... | |
QCPAbstractItem * | item () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the last item, that was added with addItem. More... | |
bool | addItem (QCPAbstractItem *item) |
Adds the specified item to the plot. More... | |
bool | removeItem (QCPAbstractItem *item) |
Removes the specified item from the plot. More... | |
bool | removeItem (int index) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the item by its index. | |
int | clearItems () |
Removes all items from the plot. More... | |
int | itemCount () const |
Returns the number of currently existing items in the plot. More... | |
QList< QCPAbstractItem * > | selectedItems () const |
Returns a list of the selected items. More... | |
QCPAbstractItem * | itemAt (const QPointF &pos, bool onlySelectable=false) const |
Returns the item at the pixel position pos. More... | |
QCPLayer * | layer (const QString &name) const |
Returns the layer with the specified name. More... | |
QCPLayer * | layer (int index) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the layer by index. More... | |
QCPLayer * | currentLayer () const |
Returns the layer that is set as current layer (see setCurrentLayer). | |
bool | setCurrentLayer (const QString &name) |
Sets the layer with the specified name to be the current layer. More... | |
bool | setCurrentLayer (QCPLayer *layer) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the provided layer to be the current layer. More... | |
int | layerCount () const |
Returns the number of currently existing layers in the plot. More... | |
bool | addLayer (const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove) |
Adds a new layer to this QCustomPlot instance. More... | |
bool | removeLayer (QCPLayer *layer) |
Removes the specified layer and returns true on success. More... | |
bool | moveLayer (QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove) |
Moves the specified layer to the position relative to otherLayer. More... | |
QList< QCPAxis * > | selectedAxes () const |
Returns the axes that currently have selected parts, i.e. More... | |
QList< QCPLegend * > | selectedLegends () const |
Returns the legends (typically one or zero) that currently have selected parts, i.e. More... | |
void | setupFullAxesBox () |
Convenience function to make the top and right axes visible and assign them the following properties from their corresponding bottom/left axes: More... | |
bool | savePdf (const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0) |
Saves a PDF with the vectorized plot to the file fileName. More... | |
bool | savePng (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1) |
Saves a PNG image file to fileName on disc. More... | |
bool | saveJpg (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1) |
Saves a JPG image file to fileName on disc. More... | |
bool | saveBmp (const QString &fileName, int width=0, int height=0, double scale=1.0) |
Saves a BMP image file to fileName on disc. More... | |
bool | saveRastered (const QString &fileName, int width, int height, double scale, const char *format, int quality=-1) |
Saves the plot to a rastered image file fileName in the image format format. More... | |
Protected Slots | |
void | ShiftViewport (int value) |
Shifts the viewport of the graph along the x axis. More... | |
Protected Member Functions | |
void | SetBounds () |
Sets the new upper and lower bounds and replots. More... | |
![]() | |
virtual QSize | minimumSizeHint () const |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | resizeEvent (QResizeEvent *event) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | wheelEvent (QWheelEvent *event) |
virtual bool | handlePlottableSelection (QMouseEvent *event, bool additiveSelection, bool &modified) |
virtual bool | handleItemSelection (QMouseEvent *event, bool additiveSelection, bool &modified) |
virtual bool | handleAxisSelection (QMouseEvent *event, bool additiveSelection, bool &modified) |
virtual bool | handleTitleSelection (QMouseEvent *event, bool additiveSelection, bool &modified) |
virtual void | draw (QCPPainter *painter) |
virtual void | drawAxisBackground (QCPPainter *painter) |
void | updateAxisRect () |
bool | selectTestTitle (const QPointF &pos) const |
Protected Attributes | |
double | XLower_ |
double | XUpper_ |
double | YLower_ |
double | YUpper_ |
double | FullXUpper_ |
double | FullXLower_ |
double | FullYUpper_ |
double | FullYLower_ |
![]() | |
QString | mTitle |
QFont | mTitleFont |
QFont | mSelectedTitleFont |
QColor | mTitleColor |
QColor | mSelectedTitleColor |
QRect | mViewport |
QRect | mAxisRect |
int | mMarginLeft |
int | mMarginRight |
int | mMarginTop |
int | mMarginBottom |
bool | mAutoMargin |
bool | mAutoAddPlottableToLegend |
QColor | mColor |
QList< QCPAbstractPlottable * > | mPlottables |
QList< QCPGraph * > | mGraphs |
QList< QCPAbstractItem * > | mItems |
QList< QCPLayer * > | mLayers |
Qt::Orientations | mRangeDrag |
Qt::Orientations | mRangeZoom |
QCPAxis * | mRangeDragHorzAxis |
QCPAxis * | mRangeDragVertAxis |
QCPAxis * | mRangeZoomHorzAxis |
QCPAxis * | mRangeZoomVertAxis |
double | mRangeZoomFactorHorz |
double | mRangeZoomFactorVert |
bool | mDragging |
QCP::AntialiasedElements | mAntialiasedElements |
QCP::AntialiasedElements | mNotAntialiasedElements |
QPixmap | mAxisBackground |
bool | mAxisBackgroundScaled |
Qt::AspectRatioMode | mAxisBackgroundScaledMode |
Interactions | mInteractions |
int | mSelectionTolerance |
bool | mTitleSelected |
QRect | mTitleBoundingBox |
bool | mNoAntialiasingOnDrag |
QPixmap | mPaintBuffer |
QPoint | mDragStart |
QCPRange | mDragStartHorzRange |
QCPRange | mDragStartVertRange |
QPixmap | mScaledAxisBackground |
bool | mReplotting |
QCP::AntialiasedElements | mAADragBackup |
QCP::AntialiasedElements | mNotAADragBackup |
QCPLayer * | mCurrentLayer |
QCP::PlottingHints | mPlottingHints |
Qt::KeyboardModifier | mMultiSelectModifier |
Additional Inherited Members | |
![]() | |
enum | Interaction { iRangeDrag = 0x001, iRangeZoom = 0x002, iMultiSelect = 0x004, iSelectTitle = 0x008, iSelectPlottables = 0x010, iSelectAxes = 0x020, iSelectLegend = 0x040, iSelectItems = 0x080 } |
Defines the mouse interactions possible with QCustomPlot. More... | |
enum | LayerInsertMode { limBelow, limAbove } |
Defines how a layer should be inserted relative to a specified other layer. More... | |
![]() | |
void | deselectAll () |
Deselects everything in the QCustomPlot (plottables, items, axes, legend and title). More... | |
void | replot () |
Causes a complete replot (axes, labels, graphs, etc.) into the internal buffer. More... | |
void | rescaleAxes () |
Rescales the axes such that all plottables (e.g. More... | |
![]() | |
void | mouseDoubleClick (QMouseEvent *event) |
This signal is emitted when the QCustomPlot receives a mouse double click event. | |
void | mousePress (QMouseEvent *event) |
This signal is emitted when the QCustomPlot receives a mouse press event. More... | |
void | mouseMove (QMouseEvent *event) |
This signal is emitted when the QCustomPlot receives a mouse move event. More... | |
void | mouseRelease (QMouseEvent *event) |
This signal is emitted when the QCustomPlot receives a mouse release event. More... | |
void | mouseWheel (QWheelEvent *event) |
This signal is emitted when the QCustomPlot receives a mouse wheel event. More... | |
void | plottableClick (QCPAbstractPlottable *plottable, QMouseEvent *event) |
This signal is emitted when a plottable is clicked. More... | |
void | plottableDoubleClick (QCPAbstractPlottable *plottable, QMouseEvent *event) |
This signal is emitted when a plottable is double clicked. More... | |
void | itemClick (QCPAbstractItem *item, QMouseEvent *event) |
This signal is emitted when an item is clicked. More... | |
void | itemDoubleClick (QCPAbstractItem *item, QMouseEvent *event) |
This signal is emitted when an item is double clicked. More... | |
void | axisClick (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) |
This signal is emitted when an axis is clicked. More... | |
void | axisDoubleClick (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) |
This signal is emitted when an axis is double clicked. More... | |
void | legendClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event) |
This signal is emitted when a legend (item) is clicked. More... | |
void | legendDoubleClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event) |
This signal is emitted when a legend (item) is double clicked. More... | |
void | titleClick (QMouseEvent *event) |
This signal is emitted when the plot title is clicked. More... | |
void | titleDoubleClick (QMouseEvent *event) |
This signal is emitted when the plot title is double clicked. More... | |
void | selectionChangedByUser () |
This signal is emitted after the user has changed the selection in the QCustomPlot, e.g. More... | |
void | beforeReplot () |
This signal is emitted immediately before a replot takes place (caused by a call to the slot replot). More... | |
void | afterReplot () |
This signal is emitted immediately after a replot has taken place (caused by a call to the slot replot). More... | |
![]() | |
QCPAxis * | xAxis |
QCPAxis * | yAxis |
QCPAxis * | xAxis2 |
QCPAxis * | yAxis2 |
QCPLegend * | legend |
Extension of the QCustomPlot class that allows an implementation of the class with different event handlers.
The purpose of this extension is to provide extra slots and signals support that will not conflict with templating.
|
protected |
Sets the new upper and lower bounds and replots.
NOTE: This method should be called after adjusting bound member variables.
|
protectedslot |
Shifts the viewport of the graph along the x axis.
NOTE: "value" changes the value of the lower bound.