QCPLayout
Public Member Functions | |
QCPLayout () | |
void | clear () |
virtual QCPLayoutElement * | elementAt (int index) const =0 |
virtual int | elementCount () const =0 |
virtual QList< QCPLayoutElement * > | elements (bool recursive) const override |
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) override |
Public Member Functions inherited from QCPLayoutElement | |
QCPLayoutElement (QCustomPlot *parentPlot=nullptr) | |
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 |
QRect | rect () const |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const 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 |
Public Member Functions inherited from QCPLayerable | |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr) | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
bool | setLayer (const QString &layerName) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
void | setVisible (bool on) |
bool | visible () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
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 () |
Protected Member Functions inherited from QCPLayoutElement | |
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const override |
virtual int | calculateAutoMargin (QCP::MarginSide side) |
virtual void | draw (QCPPainter *painter) override |
virtual void | layoutChanged () |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) override |
Protected Member Functions inherited from QCPLayerable | |
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) |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions | |
static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
enum | UpdatePhase { upPreparation , upMargins , upLayout } |
Public Types inherited from QObject | |
typedef | QObjectList |
Properties inherited from QObject | |
objectName | |
Signals inherited from QCPLayerable | |
void | layerChanged (QCPLayer *newLayer) |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Protected Attributes inherited from QCPLayoutElement | |
QCP::MarginSides | mAutoMargins |
QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
QMargins | mMargins |
QSize | mMaximumSize |
QMargins | mMinimumMargins |
QSize | mMinimumSize |
QRect | mOuterRect |
QCPLayout * | mParentLayout |
QRect | mRect |
SizeConstraintRect | mSizeConstraintRect |
Protected Attributes inherited from QCPLayerable | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
Detailed Description
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 1341 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPLayout()
|
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 3666 of file qcustomplot.cpp.
Member Function Documentation
◆ adoptElement()
|
protected |
Associates el with this layout. This is done by setting the QCPLayoutElement::layout, the QCPLayerable::parentLayerable and the QObject parent to this layout.
Further, if el didn't previously have a parent plot, calls QCPLayerable::initializeParentPlot on el to set the paret plot.
This method is used by subclass specific methods that add elements to the layout. Note that this method only changes properties in el. The removal from the old layout and the insertion into the new layout must be done additionally.
Definition at line 3831 of file qcustomplot.cpp.
◆ clear()
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 3776 of file qcustomplot.cpp.
◆ elementAt()
|
pure virtual |
Returns the element in the cell with the given index. If index is invalid, returns nullptr
.
Note that even if index is valid, the respective cell may be empty in some layouts (e.g. QCPLayoutGrid), so this function may return nullptr
in those cases. You may use this function to check whether a cell is empty or not.
- See also
- elements, elementCount, takeAt
Implemented in QCPLayoutGrid, and QCPLayoutInset.
◆ elementCount()
|
pure virtual |
Returns the number of elements/cells in the layout.
Implemented in QCPLayoutGrid, and QCPLayoutInset.
◆ elements()
|
overridevirtual |
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.
- Warning
- There may be
nullptr
entries in the returned list. For example, QCPLayoutGrid may have empty cells which yieldnullptr
at the respective index.
Reimplemented from QCPLayoutElement.
Reimplemented in QCPLayoutGrid.
Definition at line 3697 of file qcustomplot.cpp.
◆ getFinalMaximumOuterSize()
|
staticprotected |
This is a helper function for the implementation of subclasses.
It returns the maximum size that should finally be used for the outer rect of the passed layout element el.
It takes into account whether a manual maximum size is set (QCPLayoutElement::setMaximumSize), which size constraint is set (QCPLayoutElement::setSizeConstraintRect), as well as the maximum size hint, if no manual maximum size was set (QCPLayoutElement::maximumOuterSizeHint).
Definition at line 4045 of file qcustomplot.cpp.
◆ getFinalMinimumOuterSize()
|
staticprotected |
This is a helper function for the implementation of subclasses.
It returns the minimum size that should finally be used for the outer rect of the passed layout element el.
It takes into account whether a manual minimum size is set (QCPLayoutElement::setMinimumSize), which size constraint is set (QCPLayoutElement::setSizeConstraintRect), as well as the minimum size hint, if no manual minimum size was set (QCPLayoutElement::minimumOuterSizeHint).
Definition at line 4020 of file qcustomplot.cpp.
◆ getSectionSizes()
|
protected |
This is a helper function for the implementation of updateLayout in subclasses.
It calculates the sizes of one-dimensional sections with provided constraints on maximum section sizes, minimum section sizes, relative stretch factors and the final total size of all sections.
The QVector entries refer to the sections. Thus all QVectors must have the same size.
maxSizes gives the maximum allowed size of each section. If there shall be no maximum size imposed, set all vector values to Qt's QWIDGETSIZE_MAX.
minSizes gives the minimum allowed size of each section. If there shall be no minimum size imposed, set all vector values to zero. If the minSizes entries add up to a value greater than totalSize, sections will be scaled smaller than the proposed minimum sizes. (In other words, not exceeding the allowed total size is taken to be more important than not going below minimum section sizes.)
stretchFactors give the relative proportions of the sections to each other. If all sections shall be scaled equally, set all values equal. If the first section shall be double the size of each individual other section, set the first number of stretchFactors to double the value of the other individual values (e.g. {2, 1, 1, 1}).
totalSize is the value that the final section sizes will add up to. Due to rounding, the actual sum may differ slightly. If you want the section sizes to sum up to exactly that value, you could distribute the remaining difference on the sections.
The return value is a QVector containing the section sizes.
Definition at line 3896 of file qcustomplot.cpp.
◆ releaseElement()
|
protected |
Disassociates el from this layout. This is done by setting the QCPLayoutElement::layout and the QCPLayerable::parentLayerable to zero. The QObject parent is set to the parent QCustomPlot.
This method is used by subclass specific methods that remove elements from the layout (e.g. take or takeAt). Note that this method only changes properties in el. The removal from the old layout must be done additionally.
Definition at line 3855 of file qcustomplot.cpp.
◆ remove()
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 3760 of file qcustomplot.cpp.
◆ removeAt()
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 3739 of file qcustomplot.cpp.
◆ simplify()
|
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 QCPLayoutGrid, and QCPLayoutInset.
Definition at line 3724 of file qcustomplot.cpp.
◆ sizeConstraintsChanged()
|
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 3794 of file qcustomplot.cpp.
◆ take()
|
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.
- See also
- takeAt
Implemented in QCPLayoutGrid, and QCPLayoutInset.
◆ takeAt()
|
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 nullptr
.
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 QCPLayoutGrid, and QCPLayoutInset.
◆ update()
|
overridevirtual |
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 3679 of file qcustomplot.cpp.
◆ updateLayout()
|
protectedvirtual |
Subclasses reimplement this method to update the position and sizes of the child elements/cells via calling their QCPLayoutElement::setOuterRect. The default implementation does nothing.
The geometry used as a reference is the inner rect of this layout. Child elements should stay within that rect.
getSectionSizes may help with the reimplementation of this function.
- See also
- update
Reimplemented in QCPLayoutGrid, and QCPLayoutInset.
Definition at line 3814 of file qcustomplot.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.