|
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 |
|
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.
Reimplementowana w QCPTextElement i 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.
Reimplementowana w QCPTextElement, QCPPlottableLegendItem i QCPLayoutGrid.
QRect QCPLayoutElement::rect |
( |
| ) |
const |
|
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.
- Zobacz również
- outerRect
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.
Reimplementowana z QCPLayerable.
Reimplementowana w QCPTextElement, QCPLegend, QCPAbstractLegendItem i QCPLayoutInset.
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).
- Zobacz również
- QCP::MarginSide
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).
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.
- Zobacz również
- rect
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.
Reimplementowana w QCPColorScale, QCPAxisRect i QCPLayout.