![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
The abstract base class for all objects that form the layout system. More...
#include <qcustomplot.h>


Public Types | |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
| enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
Public Member Functions | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| SizeConstraintRect | sizeConstraintRect () const |
| QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | minimumSizeHint () const |
| virtual QSize | maximumSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Member Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| virtual | ~QCPLayerable () |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| ~QCPLayerable () | |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
Protected Member Functions | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | mousePressEvent (QMouseEvent *event) |
| virtual void | mouseMoveEvent (QMouseEvent *event) |
| virtual void | mouseReleaseEvent (QMouseEvent *event) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
| virtual void | wheelEvent (QWheelEvent *event) |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Member Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Protected Attributes | |
| QCPLayout * | mParentLayout |
| QSize | mMinimumSize |
| QSize | mMaximumSize |
| SizeConstraintRect | mSizeConstraintRect |
| QRect | mRect |
| QRect | mOuterRect |
| QMargins | mMargins |
| QMargins | mMinimumMargins |
| QCP::MarginSides | mAutoMargins |
| QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
Protected Attributes inherited from QCPLayerable | |
| bool | mVisible |
| QCustomPlot * | mParentPlot |
| QPointer< QCPLayerable > | mParentLayerable |
| QCPLayer * | mLayer |
| bool | mAntialiased |
Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
| void | layerChanged (QCPLayer *newLayer) |
The abstract base class for all objects that form the layout system.
This is an abstract base class. As such, it can't be instantiated directly, rather use one of its subclasses.
A Layout element is a rectangular object which can be placed in layouts. It has an outer rect (QCPLayoutElement::outerRect) and an inner rect (QCPLayoutElement::rect). The difference between outer and inner rect is called its margin. The margin can either be set to automatic or manual (setAutoMargins) on a per-side basis. If a side is set to manual, that margin can be set explicitly with setMargins and will stay fixed at that value. If it's set to automatic, the layout element subclass will control the value itself (via calculateAutoMargin).
Layout elements can be placed in layouts (base class QCPLayout) like QCPLayoutGrid. The top level layout is reachable via QCustomPlot::plotLayout, and is a QCPLayoutGrid. Since QCPLayout itself derives from QCPLayoutElement, layouts can be nested.
Thus in QCustomPlot one can divide layout elements into two categories: The ones that are invisible by themselves, because they don't draw anything. Their only purpose is to manage the position and size of other layout elements. This category of layout elements usually use QCPLayout as base class. Then there is the category of layout elements which actually draw something. For example, QCPAxisRect, QCPLegend and QCPTextElement are of this category. This does not necessarily mean that the latter category can't have child layout elements. QCPLegend for instance, actually derives from QCPLayoutGrid and the individual legend items are child layout elements in the grid layout.
This is an abstract base class. As such, it can't be instantiated directly, rather use one of its subclasses.
A Layout element is a rectangular object which can be placed in layouts. It has an outer rect (QCPLayoutElement::outerRect) and an inner rect (QCPLayoutElement::rect). The difference between outer and inner rect is called its margin. The margin can either be set to automatic or manual (setAutoMargins) on a per-side basis. If a side is set to manual, that margin can be set explicitly with setMargins and will stay fixed at that value. If it's set to automatic, the layout element subclass will control the value itself (via calculateAutoMargin).
Layout elements can be placed in layouts (base class QCPLayout) like QCPLayoutGrid. The top level layout is reachable via QCustomPlot::plotLayout, and is a QCPLayoutGrid. Since QCPLayout itself derives from QCPLayoutElement, layouts can be nested.
Thus in QCustomPlot one can divide layout elements into two categories: The ones that are invisible by themselves, because they don't draw anything. Their only purpose is to manage the position and size of other layout elements. This category of layout elements usually use QCPLayout as base class. Then there is the category of layout elements which actually draw something. For example, QCPAxisRect, QCPLegend and QCPPlotTitle are of this category. This does not necessarily mean that the latter category can't have child layout elements. QCPLegend for instance, actually derives from QCPLayoutGrid and the individual legend items are child layout elements in the grid layout.
Definition at line 1409 of file qcustomplot.h.
Defines to which rect of a layout element the size constraints that can be set via setMinimumSize and setMaximumSize apply. The outer rect (outerRect) includes the margins (e.g. in the case of a QCPAxisRect the axis labels), whereas the inner rect (rect) does not.
| Enumerator | |
|---|---|
| scrInnerRect | Minimum/Maximum size constraints apply to inner rect. |
| scrOuterRect | Minimum/Maximum size constraints apply to outer rect, thus include layout element margins |
Definition at line 1448 of file qcustomplot.h.
Defines the phases of the update process, that happens just before a replot. At each phase, update is called with the according UpdatePhase value.
Definition at line 1429 of file qcustomplot.h.
Defines the phases of the update process, that happens just before a replot. At each phase, update is called with the according UpdatePhase value.
Definition at line 826 of file qcustomplot.h.
|
explicit |
Creates an instance of QCPLayoutElement and sets default values.
Definition at line 3135 of file qcustomplot.cpp.
|
virtual |
Definition at line 3149 of file qcustomplot.cpp.
References mParentLayout, QCP::msAll, setMarginGroup(), and QCPLayout::take().
|
explicit |
|
virtual |
|
inlineprotectedvirtual |
Implements QCPLayerable.
Reimplemented in QCPColorScale, QCPPlotTitle, QCPLegend, QCPAbstractLegendItem, QCPAxisRect, QCPColorScale, QCPTextElement, QCPLegend, QCPAbstractLegendItem, and QCPAxisRect.
Definition at line 1516 of file qcustomplot.h.
|
inlineprotectedvirtual |
Implements QCPLayerable.
Reimplemented in QCPColorScale, QCPPlotTitle, QCPLegend, QCPAbstractLegendItem, QCPAxisRect, QCPColorScale, QCPTextElement, QCPLegend, QCPAbstractLegendItem, and QCPAxisRect.
Definition at line 897 of file qcustomplot.h.
|
inline |
Definition at line 1465 of file qcustomplot.h.
|
inline |
Definition at line 846 of file qcustomplot.h.
|
protectedvirtual |
Reimplemented in QCPAxisRect, and QCPAxisRect.
Definition at line 3505 of file qcustomplot.cpp.
References QCP::getMarginValue(), mMargins, and mMinimumMargins.
Referenced by update().
|
protectedvirtual |
Reimplemented in QCPAxisRect, and QCPAxisRect.
|
inlineprotectedvirtual |
Implements QCPLayerable.
Reimplemented in QCPAbstractLegendItem, QCPAbstractLegendItem, QCPPlotTitle, QCPLegend, QCPPlottableLegendItem, QCPAxisRect, QCPTextElement, QCPLegend, QCPPlottableLegendItem, and QCPAxisRect.
Definition at line 1520 of file qcustomplot.h.
|
inlineprotectedvirtual |
Implements QCPLayerable.
Reimplemented in QCPAbstractLegendItem, QCPAbstractLegendItem, QCPPlotTitle, QCPLegend, QCPPlottableLegendItem, QCPAxisRect, QCPTextElement, QCPLegend, QCPPlottableLegendItem, and QCPAxisRect.
Definition at line 900 of file qcustomplot.h.
|
virtual |
Returns a list of all child elements in this layout element. If recursive is true, all sub-child elements are included in the list, too.
Reimplemented in QCPAxisRect, QCPLayoutGrid, QCPLayout, QCPAxisRect, QCPLayoutGrid, and QCPLayout.
Definition at line 3449 of file qcustomplot.cpp.
Referenced by QCustomPlot::axisRectAt(), QCustomPlot::axisRects(), QCustomPlot::layoutElementAt(), parentPlotInitialized(), and QCustomPlot::selectedLegends().
|
virtual |
Reimplemented in QCPAxisRect, QCPLayoutGrid, QCPLayout, QCPAxisRect, QCPLayoutGrid, and QCPLayout.
|
inline |
Returns the parent layout of this layout element.
Definition at line 1460 of file qcustomplot.h.
Referenced by QCPLayoutGrid::addElement(), and QCPLayoutInset::addElement().
|
inline |
Definition at line 841 of file qcustomplot.h.
|
protectedvirtual |
Reimplemented in QCPAxisRect.
Definition at line 3522 of file qcustomplot.cpp.
Referenced by QCPLayout::adoptElement().
|
inline |
Definition at line 1471 of file qcustomplot.h.
Referenced by setMarginGroup().
|
inline |
Definition at line 849 of file qcustomplot.h.
|
inline |
Definition at line 1474 of file qcustomplot.h.
|
inline |
Definition at line 852 of file qcustomplot.h.
|
inline |
Definition at line 1463 of file qcustomplot.h.
Referenced by QCPLayout::getFinalMaximumOuterSize(), QCPLayout::getFinalMinimumOuterSize(), setMargins(), and setMinimumMargins().
|
inline |
Definition at line 844 of file qcustomplot.h.
|
virtual |
Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
if a maximum size (setMaximumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMaximumOuterSize) to determine the maximum allowed size of this layout element.
A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.
The default implementation simply returns QWIDGETSIZE_MAX for both width and height, implying no suggested maximum size. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented in QCPTextElement, and QCPLayoutGrid.
Definition at line 3438 of file qcustomplot.cpp.
Referenced by QCPLayout::getFinalMaximumOuterSize().
|
inline |
Definition at line 1467 of file qcustomplot.h.
Referenced by QCPLayout::getFinalMaximumOuterSize().
|
inline |
Definition at line 848 of file qcustomplot.h.
|
virtual |
Returns the maximum size this layout element (the inner rect) may be expanded to.
if a maximum size (setMaximumSize) was not set manually, parent layouts consult this function to determine the maximum allowed size of this layout element. (A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.)
Reimplemented in QCPPlotTitle, and QCPLayoutGrid.
Definition at line 1961 of file qcustomplot.cpp.
References mMaximumSize.
|
inline |
Definition at line 1464 of file qcustomplot.h.
|
inline |
Definition at line 845 of file qcustomplot.h.
|
virtual |
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
A manual minimum size is considered set if it is non-zero.
The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented in QCPTextElement, QCPPlottableLegendItem, and QCPLayoutGrid.
Definition at line 3416 of file qcustomplot.cpp.
References mMargins.
Referenced by QCPLayout::getFinalMinimumOuterSize().
|
inline |
Definition at line 1466 of file qcustomplot.h.
Referenced by QCPLayout::getFinalMinimumOuterSize().
|
inline |
Definition at line 847 of file qcustomplot.h.
|
virtual |
Returns the minimum size this layout element (the inner rect) may be compressed to.
if a minimum size (setMinimumSize) was not set manually, parent layouts consult this function to determine the minimum allowed size of this layout element. (A manual minimum size is considered set if it is non-zero.)
Reimplemented in QCPPlotTitle, QCPPlottableLegendItem, and QCPLayoutGrid.
Definition at line 1950 of file qcustomplot.cpp.
References mMinimumSize.
|
inlineprotectedvirtual |
This event is called, if the mouse is double-clicked inside the outer rect of this layout element.
Definition at line 893 of file qcustomplot.h.
References event.
|
inlineprotectedvirtual |
This event is called, if the mouse is moved inside the outer rect of this layout element.
Reimplemented in QCPColorScale, and QCPAxisRect.
Definition at line 891 of file qcustomplot.h.
References event.
|
inlineprotectedvirtual |
This event is called, if the mouse was pressed while being inside the outer rect of this layout element.
Reimplemented in QCPColorScale, and QCPAxisRect.
Definition at line 890 of file qcustomplot.h.
References event.
|
inlineprotectedvirtual |
This event is called, if the mouse was previously pressed inside the outer rect of this layout element and is now released.
Reimplemented in QCPColorScale, and QCPAxisRect.
Definition at line 892 of file qcustomplot.h.
References event.
|
inline |
Returns the outer rect of this layout element. The outer rect is the inner rect expanded by the margins (setMargins, setAutoMargins). The outer rect is used (and set via setOuterRect) by the parent QCPLayout to control the size of this layout element.
Definition at line 1462 of file qcustomplot.h.
|
inline |
Definition at line 843 of file qcustomplot.h.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Reimplemented in QCPLegend, and QCPLegend.
Definition at line 3489 of file qcustomplot.cpp.
References elements(), QCPLayerable::initializeParentPlot(), and QCPLayerable::parentPlot().
|
protectedvirtual |
Reimplemented from QCPLayerable.
|
inline |
Returns the inner rect of this layout element. The inner rect is the outer rect (outerRect, setOuterRect) shrinked by the margins (setMargins, setAutoMargins).
In some cases, the area between outer and inner rect is left blank. In other cases the margin area is used to display peripheral graphics while the main content is in the inner rect. This is where automatic margin calculation becomes interesting because it allows the layout element to adapt the margins to the peripheral graphics it wants to draw. For example, QCPAxisRect draws the axis labels and tick labels in the margin area, thus needs to adjust the margins (if setAutoMargins is enabled) according to the space required by the labels of the axes.
Returns the inner rect of this layout element. The inner rect is the outer rect (setOuterRect) shrinked by the margins (setMargins, setAutoMargins).
In some cases, the area between outer and inner rect is left blank. In other cases the margin area is used to display peripheral graphics while the main content is in the inner rect. This is where automatic margin calculation becomes interesting because it allows the layout element to adapt the margins to the peripheral graphics it wants to draw. For example, QCPAxisRect draws the axis labels and tick labels in the margin area, thus needs to adjust the margins (if setAutoMargins is enabled) according to the space required by the labels of the axes.
Definition at line 1461 of file qcustomplot.h.
Referenced by QCPLayoutInset::addElement(), QCPAxis::calculateMargin(), QCPAxis::draw(), QCustomPlot::plottableAt(), QCPLayoutInset::setInsetRect(), setOuterRect(), QCPAxisRect::update(), QCPColorScale::update(), and QCPLayoutInset::updateLayout().
|
inline |
Definition at line 842 of file qcustomplot.h.
|
virtual |
Layout elements are sensitive to events inside their outer rect. If pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if onlySelectable is true, -1.0 is returned.
See QCPLayerable::selectTest for a general explanation of this virtual method.
QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour.
Reimplemented from QCPLayerable.
Reimplemented in QCPPlotTitle, QCPLegend, QCPAbstractLegendItem, QCPLayoutInset, QCPTextElement, QCPLegend, QCPAbstractLegendItem, and QCPLayoutInset.
Definition at line 3466 of file qcustomplot.cpp.
References mOuterRect, QCPLayerable::mParentPlot, and QCustomPlot::selectionTolerance().
Referenced by QCustomPlot::axisRectAt(), and QCustomPlot::layoutElementAt().
|
virtual |
This function is used to decide whether a click hits a layerable object or not.
pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/ deselectEvent methods.
details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
You may pass 0 as details to indicate that you are not interested in those selection details.
This function is used to decide whether a click hits a layerable object or not.
pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
You may pass 0 as details to indicate that you are not interested in those selection details.
Reimplemented from QCPLayerable.
Reimplemented in QCPPlotTitle, QCPLegend, QCPAbstractLegendItem, QCPLayoutInset, QCPTextElement, QCPLegend, QCPAbstractLegendItem, and QCPLayoutInset.
| void QCPLayoutElement::setAutoMargins | ( | QCP::MarginSides | sides | ) |
Sets on which sides the margin shall be calculated automatically. If a side is calculated automatically, a minimum margin value may be provided with setMinimumMargins. If a side is set to be controlled manually, the value may be specified with setMargins.
Margin sides that are under automatic control may participate in a QCPMarginGroup (see setMarginGroup), to synchronize (align) it with other layout elements in the plot.
Sets on which sides the margin shall be calculated automatically. If a side is calculated automatically, a minimum margin value may be provided with setMinimumMargins. If a side is set to be controlled manually, the value may be specified with setMargins.
Margin sides that are under automatic control may participate in a QCPMarginGroup (see setMarginGroup), to synchronize (align) it with other layout elements in the plot.
Definition at line 3228 of file qcustomplot.cpp.
References mAutoMargins.
| void QCPLayoutElement::setAutoMargins | ( | QCP::MarginSides | sides | ) |
| void QCPLayoutElement::setMarginGroup | ( | QCP::MarginSides | sides, |
| QCPMarginGroup * | group | ||
| ) |
Sets the margin group of the specified margin sides.
Margin groups allow synchronizing specified margins across layout elements, see the documentation of QCPMarginGroup.
To unset the margin group of sides, set group to 0.
Note that margin groups only work for margin sides that are set to automatic (setAutoMargins).
Sets the margin group of the specified margin sides.
Margin groups allow synchronizing specified margins across layout elements, see the documentation of QCPMarginGroup.
To unset the margin group of sides, set group to 0.
Note that margin groups only work for margin sides that are set to automatic (setAutoMargins).
Definition at line 3318 of file qcustomplot.cpp.
References QCPMarginGroup::addChild(), marginGroup(), mMarginGroups, QCP::msBottom, QCP::msLeft, QCP::msRight, QCP::msTop, and QCPMarginGroup::removeChild().
Referenced by ~QCPLayoutElement().
| void QCPLayoutElement::setMarginGroup | ( | QCP::MarginSides | sides, |
| QCPMarginGroup * | group | ||
| ) |
| void QCPLayoutElement::setMargins | ( | const QMargins & | margins | ) |
Sets the margins of this layout element. If setAutoMargins is disabled for some or all sides, this function is used to manually set the margin on those sides. Sides that are still set to be handled automatically are ignored and may have any value in margins.
The margin is the distance between the outer rect (controlled by the parent layout via setOuterRect) and the inner rect (which usually contains the main content of this layout element).
Definition at line 3193 of file qcustomplot.cpp.
References margins(), mMargins, mOuterRect, and mRect.
Referenced by QCPAbstractLegendItem::QCPAbstractLegendItem(), QCPLegend::QCPLegend(), QCPPlotTitle::QCPPlotTitle(), QCPTextElement::QCPTextElement(), QCustomPlot::QCustomPlot(), and update().
| void QCPLayoutElement::setMargins | ( | const QMargins & | margins | ) |
| void QCPLayoutElement::setMaximumSize | ( | const QSize & | size | ) |
Sets the maximum size of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
Sets the maximum size for the inner rect of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
Definition at line 3270 of file qcustomplot.cpp.
References mMaximumSize, mParentLayout, size, and QCPLayout::sizeConstraintsChanged().
Referenced by setMaximumSize(), and QCPColorScale::update().
| void QCPLayoutElement::setMaximumSize | ( | const QSize & | size | ) |
| void QCPLayoutElement::setMaximumSize | ( | int | width, |
| int | height | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the maximum size of this layout element.
Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the maximum size for the inner rect of this layout element.
Definition at line 3284 of file qcustomplot.cpp.
References height, setMaximumSize(), and width.
| void QCPLayoutElement::setMaximumSize | ( | int | width, |
| int | height | ||
| ) |
| void QCPLayoutElement::setMinimumMargins | ( | const QMargins & | margins | ) |
If setAutoMargins is enabled on some or all margins, this function is used to provide minimum values for those margins.
The minimum values are not enforced on margin sides that were set to be under manual control via setAutoMargins.
Definition at line 3210 of file qcustomplot.cpp.
References margins(), and mMinimumMargins.
Referenced by QCPAxisRect::QCPAxisRect(), and QCPColorScale::QCPColorScale().
| void QCPLayoutElement::setMinimumMargins | ( | const QMargins & | margins | ) |
| void QCPLayoutElement::setMinimumSize | ( | const QSize & | size | ) |
Sets the minimum size of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
If the parent layout size is not sufficient to satisfy all minimum size constraints of its child layout elements, the layout may set a size that is actually smaller than size. QCustomPlot propagates the layout's size constraints to the outside by setting its own minimum QWidget size accordingly, so violations of size should be exceptions.
Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
Sets the minimum size for the inner rect of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
If the parent layout size is not sufficient to satisfy all minimum size constraints of its child layout elements, the layout may set a size that is actually smaller than size. QCustomPlot propagates the layout's size constraints to the outside by setting its own minimum QWidget size accordingly, so violations of size should be exceptions.
Definition at line 3245 of file qcustomplot.cpp.
References mMinimumSize, mParentLayout, size, and QCPLayout::sizeConstraintsChanged().
Referenced by QCPAxisRect::QCPAxisRect(), setMinimumSize(), and QCPColorScale::update().
| void QCPLayoutElement::setMinimumSize | ( | const QSize & | size | ) |
| void QCPLayoutElement::setMinimumSize | ( | int | width, |
| int | height | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the minimum size of this layout element.
Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the minimum size for the inner rect of this layout element.
Definition at line 3259 of file qcustomplot.cpp.
References height, setMinimumSize(), and width.
| void QCPLayoutElement::setMinimumSize | ( | int | width, |
| int | height | ||
| ) |
| void QCPLayoutElement::setOuterRect | ( | const QRect & | rect | ) |
Sets the outer rect of this layout element. If the layout element is inside a layout, the layout sets the position and size of this layout element using this function.
Calling this function externally has no effect, since the layout will overwrite any changes to the outer rect upon the next replot.
The layout element will adapt its inner rect by applying the margins inward to the outer rect.
Definition at line 3173 of file qcustomplot.cpp.
References mMargins, mOuterRect, mRect, and rect().
Referenced by QCustomPlot::setViewport(), and QCPAxisRect::update().
| void QCPLayoutElement::setOuterRect | ( | const QRect & | rect | ) |
| void QCPLayoutElement::setSizeConstraintRect | ( | SizeConstraintRect | constraintRect | ) |
Sets to which rect of a layout element the size constraints apply. Size constraints can be set via setMinimumSize and setMaximumSize.
The outer rect (outerRect) includes the margins (e.g. in the case of a QCPAxisRect the axis labels), whereas the inner rect (rect) does not.
Definition at line 3297 of file qcustomplot.cpp.
References mParentLayout, mSizeConstraintRect, and QCPLayout::sizeConstraintsChanged().
|
inline |
Definition at line 1468 of file qcustomplot.h.
Referenced by QCPLayout::getFinalMaximumOuterSize(), and QCPLayout::getFinalMinimumOuterSize().
|
virtual |
Updates the layout element and sub-elements. This function is automatically called before every replot by the parent layout element. It is called multiple times, once for every UpdatePhase. The phases are run through in the order of the enum values. For details about what happens at the different phases, see the documentation of UpdatePhase.
Layout elements that have child elements should call the update method of their child elements, and pass the current phase unchanged.
The default implementation executes the automatic margin mechanism in the upMargins phase. Subclasses should make sure to call the base class implementation.
Reimplemented in QCPColorScale, QCPAxisRect, QCPLayout, QCPColorScale, QCPAxisRect, and QCPLayout.
Definition at line 3360 of file qcustomplot.cpp.
References calculateAutoMargin(), QCP::getMarginValue(), mAutoMargins, mMarginGroups, mMargins, mMinimumMargins, QCP::msBottom, QCP::msLeft, QCP::msNone, QCP::msRight, QCP::msTop, setMargins(), QCP::setMarginValue(), and upMargins.
Referenced by QCPLayout::update(), QCPAxisRect::update(), and QCPColorScale::update().
|
virtual |
Reimplemented in QCPColorScale, QCPAxisRect, QCPLayout, QCPColorScale, QCPAxisRect, and QCPLayout.
|
inlineprotectedvirtual |
This event is called, if the mouse wheel is scrolled while the cursor is inside the rect of this layout element.
Reimplemented from QCPLayerable.
Reimplemented in QCPColorScale, QCPAxisRect, QCPColorScale, and QCPAxisRect.
Definition at line 894 of file qcustomplot.h.
References event.
|
protected |
Definition at line 1508 of file qcustomplot.h.
Referenced by QCPAxisRect::calculateAutoMargin(), setAutoMargins(), and update().
|
protected |
Definition at line 1509 of file qcustomplot.h.
Referenced by setMarginGroup(), and update().
|
protected |
Definition at line 1507 of file qcustomplot.h.
Referenced by calculateAutoMargin(), QCPLayoutGrid::maximumOuterSizeHint(), QCPTextElement::maximumOuterSizeHint(), QCPLayoutGrid::maximumSizeHint(), QCPPlotTitle::maximumSizeHint(), minimumOuterSizeHint(), QCPLayoutGrid::minimumOuterSizeHint(), QCPPlottableLegendItem::minimumOuterSizeHint(), QCPTextElement::minimumOuterSizeHint(), QCPLayoutGrid::minimumSizeHint(), QCPPlottableLegendItem::minimumSizeHint(), QCPPlotTitle::minimumSizeHint(), setMargins(), setOuterRect(), and update().
|
protected |
Definition at line 1504 of file qcustomplot.h.
Referenced by maximumSizeHint(), and setMaximumSize().
|
protected |
Definition at line 1507 of file qcustomplot.h.
Referenced by calculateAutoMargin(), setMinimumMargins(), and update().
|
protected |
Definition at line 1504 of file qcustomplot.h.
Referenced by minimumSizeHint(), and setMinimumSize().
|
protected |
Definition at line 1506 of file qcustomplot.h.
Referenced by QCPAbstractLegendItem::clipRect(), QCPPlottableLegendItem::draw(), QCPLegend::draw(), selectTest(), QCPLegend::selectTest(), setMargins(), and setOuterRect().
|
protected |
Definition at line 1503 of file qcustomplot.h.
Referenced by QCPLayout::adoptElement(), QCPLayout::releaseElement(), setMaximumSize(), setMinimumSize(), setSizeConstraintRect(), and ~QCPLayoutElement().
|
protected |
Definition at line 1506 of file qcustomplot.h.
Referenced by QCPPlottableLegendItem::draw(), QCPTextElement::draw(), QCPPlotTitle::draw(), QCPAxisRect::drawBackground(), QCPAbstractLegendItem::selectTest(), setMargins(), setOuterRect(), and QCPLayoutGrid::updateLayout().
|
protected |
Definition at line 1505 of file qcustomplot.h.
Referenced by setSizeConstraintRect().