The abstract base class for layouts. More...
#include <qcustomplot.h>
Public Member Functions | |
void | clear () |
virtual QCPLayoutElement * | elementAt (int index) const =0 |
virtual int | elementCount () const =0 |
virtual QList< QCPLayoutElement * > | elements (bool recursive) const Q_DECL_OVERRIDE |
QCPLayout () | |
bool | remove (QCPLayoutElement *element) |
bool | removeAt (int index) |
virtual void | simplify () |
virtual bool | take (QCPLayoutElement *element)=0 |
virtual QCPLayoutElement * | takeAt (int index)=0 |
virtual void | update (UpdatePhase phase) Q_DECL_OVERRIDE |
![]() | |
QCP::MarginSides | autoMargins () const |
QCPLayout * | layout () const |
QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
QMargins | margins () const |
virtual QSize | maximumOuterSizeHint () const |
QSize | maximumSize () const |
QMargins | minimumMargins () const |
virtual QSize | minimumOuterSizeHint () const |
QSize | minimumSize () const |
QRect | outerRect () const |
QCPLayoutElement (QCustomPlot *parentPlot=0) | |
QRect | rect () const |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
void | setAutoMargins (QCP::MarginSides sides) |
void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
void | setMargins (const QMargins &margins) |
void | setMaximumSize (const QSize &size) |
void | setMaximumSize (int width, int height) |
void | setMinimumMargins (const QMargins &margins) |
void | setMinimumSize (const QSize &size) |
void | setMinimumSize (int width, int height) |
void | setOuterRect (const QRect &rect) |
void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
SizeConstraintRect | sizeConstraintRect () const |
virtual | ~QCPLayoutElement () |
![]() | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
bool | setLayer (const QString &layerName) |
void | setVisible (bool on) |
bool | visible () const |
virtual | ~QCPLayerable () |
Protected Member Functions | |
void | adoptElement (QCPLayoutElement *el) |
QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
void | releaseElement (QCPLayoutElement *el) |
void | sizeConstraintsChanged () const |
virtual void | updateLayout () |
![]() | |
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
virtual int | calculateAutoMargin (QCP::MarginSide side) |
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
virtual void | layoutChanged () |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
![]() | |
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
virtual QRect | clipRect () const |
virtual void | deselectEvent (bool *selectionStateChanged) |
void | initializeParentPlot (QCustomPlot *parentPlot) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
bool | moveToLayer (QCPLayer *layer, bool prepend) |
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
virtual QCP::Interaction | selectionCategory () const |
void | setParentLayerable (QCPLayerable *parentLayerable) |
virtual void | wheelEvent (QWheelEvent *event) |
Static Protected Member Functions | |
static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
Friends | |
class | QCPLayoutElement |
Additional Inherited Members | |
![]() | |
enum | SizeConstraintRect { scrInnerRect, scrOuterRect } |
enum | UpdatePhase { upPreparation, upMargins, upLayout } |
![]() | |
void | layerChanged (QCPLayer *newLayer) |
![]() | |
QCP::MarginSides | mAutoMargins |
QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
QMargins | mMargins |
QSize | mMaximumSize |
QMargins | mMinimumMargins |
QSize | mMinimumSize |
QRect | mOuterRect |
QCPLayout * | mParentLayout |
QRect | mRect |
SizeConstraintRect | mSizeConstraintRect |
![]() | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
The abstract base class for layouts.
This is an abstract base class for layout elements whose main purpose is to define the position and size of other child layout elements. In most cases, layouts don't draw anything themselves (but there are exceptions to this, e.g. QCPLegend).
QCPLayout derives from QCPLayoutElement, and thus can itself be nested in other layouts.
QCPLayout introduces a common interface for accessing and manipulating the child elements. Those functions are most notably elementCount, elementAt, takeAt, take, simplify, removeAt, remove and clear. Individual subclasses may add more functions to this interface which are more specialized to the form of the layout. For example, QCPLayoutGrid adds functions that take row and column indices to access cells of the layout grid more conveniently.
Since this is an abstract base class, you can't instantiate it directly. Rather use one of its subclasses like QCPLayoutGrid or QCPLayoutInset.
For a general introduction to the layout system, see the dedicated documentation page The Layout System.
Definition at line 1287 of file qcustomplot.h.
|
explicit |
Creates an instance of QCPLayout and sets default values. Note that since QCPLayout is an abstract base class, it can't be instantiated directly.
Definition at line 3640 of file qcustomplot.cpp.
|
protected |
Definition at line 3805 of file qcustomplot.cpp.
void QCPLayout::clear | ( | ) |
Removes and deletes all layout elements in this layout. Finally calls simplify to make sure all empty cells are collapsed.
Definition at line 3750 of file qcustomplot.cpp.
|
pure virtual |
Returns the element in the cell with the given index. If index is invalid, returns 0.
Note that even if index is valid, the respective cell may be empty in some layouts (e.g. QCPLayoutGrid), so this function may return 0 in those cases. You may use this function to check whether a cell is empty or not.
Implemented in QCPLayoutInset, and QCPLayoutGrid.
|
pure virtual |
Returns the number of elements/cells in the layout.
Implemented in QCPLayoutInset, and QCPLayoutGrid.
|
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 from QCPLayoutElement.
Reimplemented in QCPLayoutGrid.
Definition at line 3671 of file qcustomplot.cpp.
|
staticprotected |
Definition at line 4020 of file qcustomplot.cpp.
|
staticprotected |
Definition at line 3995 of file qcustomplot.cpp.
|
protected |
Definition at line 3870 of file qcustomplot.cpp.
|
protected |
Definition at line 3829 of file qcustomplot.cpp.
bool QCPLayout::remove | ( | QCPLayoutElement * | element | ) |
Removes and deletes the provided element. Returns true on success. If element is not in the layout, returns false.
This function internally uses takeAt to remove the element from the layout and then deletes the element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
Definition at line 3734 of file qcustomplot.cpp.
bool QCPLayout::removeAt | ( | int | index | ) |
Removes and deletes the element at the provided index. Returns true on success. If index is invalid or points to an empty cell, returns false.
This function internally uses takeAt to remove the element from the layout and then deletes the returned element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
Definition at line 3713 of file qcustomplot.cpp.
|
virtual |
Simplifies the layout by collapsing empty cells. The exact behavior depends on subclasses, the default implementation does nothing.
Not all layouts need simplification. For example, QCPLayoutInset doesn't use explicit simplification while QCPLayoutGrid does.
Reimplemented in QCPLayoutInset, and QCPLayoutGrid.
Definition at line 3698 of file qcustomplot.cpp.
|
protected |
Subclasses call this method to report changed (minimum/maximum) size constraints.
If the parent of this layout is again a QCPLayout, forwards the call to the parent's sizeConstraintsChanged. If the parent is a QWidget (i.e. is the QCustomPlot::plotLayout of QCustomPlot), calls QWidget::updateGeometry, so if the QCustomPlot widget is inside a Qt QLayout, it may update itself and resize cells accordingly.
Definition at line 3768 of file qcustomplot.cpp.
|
pure virtual |
Removes the specified element from the layout and returns true on success.
If the element isn't in this layout, returns false.
Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
Implemented in QCPLayoutInset, and QCPLayoutGrid.
|
pure virtual |
Removes the element with the given index from the layout and returns it.
If the index is invalid or the cell with that index is empty, returns 0.
Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
Implemented in QCPLayoutInset, and QCPLayoutGrid.
|
virtual |
If phase is upLayout, calls updateLayout, which subclasses may reimplement to reposition and resize their cells.
Finally, the call is propagated down to all child QCPLayoutElements.
For details about this method and the update phases, see the documentation of QCPLayoutElement::update.
Reimplemented from QCPLayoutElement.
Definition at line 3653 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented in QCPLayoutInset, and QCPLayoutGrid.
Definition at line 3788 of file qcustomplot.cpp.
|
friend |
Definition at line 1323 of file qcustomplot.h.