|
| 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 Q_DECL_OVERRIDE |
|
| 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 Q_DECL_OVERRIDE |
|
| 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 Q_DECL_OVERRIDE |
|
| 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 Q_DECL_OVERRIDE |
|
| 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 Q_DECL_OVERRIDE |
|
| 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) |
|
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) |
|
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) |
|
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) |
|
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 |
|
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
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) |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
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) |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
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) |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
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) |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
void | initializeParentPlot (QCustomPlot *parentPlot) |
|
void | setParentLayerable (QCPLayerable *parentLayerable) |
|
bool | moveToLayer (QCPLayer *layer, bool prepend) |
|
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
|
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.
QSize QCPLayoutElement::maximumOuterSizeHint |
( |
| ) |
const |
|
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, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLayoutGrid, QCPLayoutGrid, QCPLayoutGrid, QCPLayoutGrid, and QCPLayoutGrid.
QSize QCPLayoutElement::minimumOuterSizeHint |
( |
| ) |
const |
|
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, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPPlottableLegendItem, QCPPlottableLegendItem, QCPPlottableLegendItem, QCPPlottableLegendItem, QCPPlottableLegendItem, QCPLayoutGrid, QCPLayoutGrid, QCPLayoutGrid, QCPLayoutGrid, and QCPLayoutGrid.
virtual double QCPLayoutElement::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
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.
You may pass 0 as details to indicate that you are not interested in those selection details.
- See Also
- selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions
Reimplemented from QCPLayerable.
Reimplemented in QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, and QCPLayoutInset.
virtual double QCPLayoutElement::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
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.
You may pass 0 as details to indicate that you are not interested in those selection details.
- See Also
- selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions
Reimplemented from QCPLayerable.
Reimplemented in QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, and QCPLayoutInset.
double QCPLayoutElement::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
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 QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, and QCPLayoutInset.
virtual double QCPLayoutElement::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
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.
You may pass 0 as details to indicate that you are not interested in those selection details.
- See Also
- selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions
Reimplemented from QCPLayerable.
Reimplemented in QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, and QCPLayoutInset.
virtual double QCPLayoutElement::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
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.
You may pass 0 as details to indicate that you are not interested in those selection details.
- See Also
- selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions
Reimplemented from QCPLayerable.
Reimplemented in QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPTextElement, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPLegend, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPAbstractLegendItem, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, QCPLayoutInset, and QCPLayoutInset.
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, QCPColorScale, QCPColorScale, QCPColorScale, QCPColorScale, QCPAxisRect, QCPAxisRect, QCPAxisRect, QCPAxisRect, QCPAxisRect, QCPLayout, QCPLayout, QCPLayout, QCPLayout, and QCPLayout.