OmronPID
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes
QCPLayoutInset Class Reference

A layout that places child elements aligned to the border or arbitrarily positioned. More...

Inheritance diagram for QCPLayoutInset:
QCPLayout QCPLayoutElement QCPLayerable

Public Types

enum  InsetPlacement { ipFree , ipBorderAligned }
 Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset. More...
 
- Public Types inherited from QCPLayoutElement
enum  UpdatePhase { upPreparation , upMargins , upLayout }
 Defines the phases of the update process, that happens just before a replot. More...
 
enum  SizeConstraintRect { scrInnerRect , scrOuterRect }
 Defines to which rect of a layout element the size constraints that can be set via setMinimumSize and setMaximumSize apply. More...
 

Public Member Functions

 QCPLayoutInset ()
 Creates an instance of QCPLayoutInset and sets default values.
 
InsetPlacement insetPlacement (int index) const
 Returns the placement type of the element with the specified index.
 
Qt::Alignment insetAlignment (int index) const
 Returns the alignment of the element with the specified index.
 
QRectF insetRect (int index) const
 Returns the rect of the element with the specified index.
 
void setInsetPlacement (int index, InsetPlacement placement)
 Sets the inset placement type of the element with the specified index to placement.
 
void setInsetAlignment (int index, Qt::Alignment alignment)
 If the inset placement (setInsetPlacement) is ipBorderAligned, this function is used to set the alignment of the element with the specified index to alignment.
 
void setInsetRect (int index, const QRectF &rect)
 If the inset placement (setInsetPlacement) is ipFree, this function is used to set the position and size of the element with the specified index to rect.
 
virtual void updateLayout () Q_DECL_OVERRIDE
 
virtual int elementCount () const Q_DECL_OVERRIDE
 Returns the number of elements/cells in the layout.
 
virtual QCPLayoutElementelementAt (int index) const Q_DECL_OVERRIDE
 Returns the element in the cell with the given index.
 
virtual QCPLayoutElementtakeAt (int index) Q_DECL_OVERRIDE
 Removes the element with the given index from the layout and returns it.
 
virtual bool take (QCPLayoutElement *element) Q_DECL_OVERRIDE
 Removes the specified element from the layout and returns true on success.
 
virtual void simplify () Q_DECL_OVERRIDE
 The QCPInsetLayout does not need simplification since it can never have empty cells due to its linear index structure.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
 The inset layout is sensitive to events only at areas where its (visible) child elements are sensitive.
 
void addElement (QCPLayoutElement *element, Qt::Alignment alignment)
 Adds the specified element to the layout as an inset aligned at the border (setInsetAlignment is initialized with ipBorderAligned).
 
void addElement (QCPLayoutElement *element, const QRectF &rect)
 Adds the specified element to the layout as an inset with free positioning/sizing (setInsetAlignment is initialized with ipFree).
 
- Public Member Functions inherited from QCPLayout
 QCPLayout ()
 Creates an instance of QCPLayout and sets default values.
 
virtual void update (UpdatePhase phase) Q_DECL_OVERRIDE
 If phase is upLayout, calls updateLayout, which subclasses may reimplement to reposition and resize their cells.
 
virtual QList< QCPLayoutElement * > elements (bool recursive) const Q_DECL_OVERRIDE
 Returns a list of all child elements in this layout element.
 
virtual int elementCount () const =0
 Returns the number of elements/cells in the layout.
 
virtual QCPLayoutElementelementAt (int index) const =0
 Returns the element in the cell with the given index.
 
virtual QCPLayoutElementtakeAt (int index)=0
 Removes the element with the given index from the layout and returns it.
 
virtual bool take (QCPLayoutElement *element)=0
 Removes the specified element from the layout and returns true on success.
 
virtual void simplify ()
 Simplifies the layout by collapsing empty cells.
 
bool removeAt (int index)
 Removes and deletes the element at the provided index.
 
bool remove (QCPLayoutElement *element)
 Removes and deletes the provided element.
 
void clear ()
 Removes and deletes all layout elements in this layout.
 
- Public Member Functions inherited from QCPLayoutElement
 QCPLayoutElement (QCustomPlot *parentPlot=0)
 Creates an instance of QCPLayoutElement and sets default values.
 
QCPLayoutlayout () const
 Returns the parent layout of this layout element.
 
QRect rect () const
 Returns the inner rect of this layout element.
 
QRect outerRect () const
 Returns the outer rect of this layout element.
 
QMargins margins () const
 
QMargins minimumMargins () const
 
QCP::MarginSides autoMargins () const
 
QSize minimumSize () const
 
QSize maximumSize () const
 
SizeConstraintRect sizeConstraintRect () const
 
QCPMarginGroupmarginGroup (QCP::MarginSide side) const
 
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups () const
 
void setOuterRect (const QRect &rect)
 Sets the outer rect of this layout element.
 
void setMargins (const QMargins &margins)
 Sets the margins of this layout element.
 
void setMinimumMargins (const QMargins &margins)
 If setAutoMargins is enabled on some or all margins, this function is used to provide minimum values for those margins.
 
void setAutoMargins (QCP::MarginSides sides)
 Sets on which sides the margin shall be calculated automatically.
 
void setMinimumSize (const QSize &size)
 Sets the minimum size of this layout element.
 
void 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.
 
void setMaximumSize (const QSize &size)
 Sets the maximum size of this layout element.
 
void 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.
 
void setSizeConstraintRect (SizeConstraintRect constraintRect)
 Sets to which rect of a layout element the size constraints apply.
 
void setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group)
 Sets the margin group of the specified margin sides.
 
virtual void update (UpdatePhase phase)
 Updates the layout element and sub-elements.
 
virtual QSize minimumOuterSizeHint () const
 Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
 
virtual QSize maximumOuterSizeHint () const
 Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
 
virtual QList< QCPLayoutElement * > elements (bool recursive) const
 Returns a list of all child elements in this layout element.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
 Layout elements are sensitive to events inside their outer rect.
 
- Public Member Functions inherited from QCPLayerable
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
 Creates a new QCPLayerable instance.
 
bool visible () const
 
QCustomPlotparentPlot () const
 
QCPLayerableparentLayerable () const
 Returns the parent layerable of this layerable.
 
QCPLayerlayer () const
 
bool antialiased () const
 
void setVisible (bool on)
 Sets the visibility of this layerable object.
 
Q_SLOT bool setLayer (QCPLayer *layer)
 Sets the layer of this layerable object.
 
bool setLayer (const QString &layerName)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the layer of this layerable object by name.
 
void setAntialiased (bool enabled)
 Sets whether this object will be drawn antialiased or not.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const
 This function is used to decide whether a click hits a layerable object or not.
 
bool realVisibility () const
 Returns whether this layerable is visible, taking the visibility of the layerable parent and the visibility of this layerable's layer into account.
 

Protected Attributes

QList< QCPLayoutElement * > mElements
 
QList< InsetPlacementmInsetPlacement
 
QList< Qt::Alignment > mInsetAlignment
 
QList< QRectF > mInsetRect
 
- Protected Attributes inherited from QCPLayoutElement
QCPLayoutmParentLayout
 
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
 
QCustomPlotmParentPlot
 
QPointer< QCPLayerablemParentLayerable
 
QCPLayermLayer
 
bool mAntialiased
 

Additional Inherited Members

- Signals inherited from QCPLayerable
void layerChanged (QCPLayer *newLayer)
 This signal is emitted when the layer of this layerable changes, i.e.
 
- Protected Member Functions inherited from QCPLayout
virtual void updateLayout ()
 
void sizeConstraintsChanged () const
 Subclasses call this method to report changed (minimum/maximum) size constraints.
 
void adoptElement (QCPLayoutElement *el)
 
void releaseElement (QCPLayoutElement *el)
 
QVector< int > getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const
 
- Protected Member Functions inherited from QCPLayoutElement
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
 
- Protected Member Functions inherited from QCPLayerable
virtual void parentPlotInitialized (QCustomPlot *parentPlot)
 
virtual QCP::Interaction selectionCategory () const
 
virtual QRect clipRect () const
 
virtual void applyDefaultAntialiasingHint (QCPPainter *painter) const =0
 
virtual void draw (QCPPainter *painter)=0
 
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)
 This event gets called when the user presses a mouse button while the cursor is over the layerable.
 
virtual void mouseMoveEvent (QMouseEvent *event, const QPointF &startPos)
 This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
 
virtual void mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos)
 This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
 
virtual void mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details)
 This event gets called when the user presses the mouse button a second time in a double-click, while the cursor is over the layerable.
 
virtual void wheelEvent (QWheelEvent *event)
 This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable.
 
void initializeParentPlot (QCustomPlot *parentPlot)
 
void setParentLayerable (QCPLayerable *parentLayerable)
 
bool moveToLayer (QCPLayer *layer, bool prepend)
 
void applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
 
- Static Protected Member Functions inherited from QCPLayout
static QSize getFinalMinimumOuterSize (const QCPLayoutElement *el)
 
static QSize getFinalMaximumOuterSize (const QCPLayoutElement *el)
 

Detailed Description

A layout that places child elements aligned to the border or arbitrarily positioned.

Elements are placed either aligned to the border or at arbitrary position in the area of the layout. Which placement applies is controlled with the InsetPlacement (setInsetPlacement).

Elements are added via addElement(QCPLayoutElement *element, Qt::Alignment alignment) or addElement(QCPLayoutElement *element, const QRectF &rect). If the first method is used, the inset placement will default to ipBorderAligned and the element will be aligned according to the alignment parameter. The second method defaults to ipFree and allows placing elements at arbitrary position and size, defined by rect.

The alignment or rect can be set via setInsetAlignment or setInsetRect, respectively.

This is the layout that every QCPAxisRect has as QCPAxisRect::insetLayout.

Member Enumeration Documentation

◆ InsetPlacement

Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.

Enumerator
ipFree 

The element may be positioned/sized arbitrarily, see setInsetRect.

ipBorderAligned 

The element is aligned to one of the layout sides, see setInsetAlignment.

Member Function Documentation

◆ addElement() [1/2]

void QCPLayoutInset::addElement ( QCPLayoutElement element,
const QRectF &  rect 
)

Adds the specified element to the layout as an inset with free positioning/sizing (setInsetAlignment is initialized with ipFree).

The position and size is set to rect.

rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout.

See also
addElement(QCPLayoutElement *element, Qt::Alignment alignment)

◆ addElement() [2/2]

void QCPLayoutInset::addElement ( QCPLayoutElement element,
Qt::Alignment  alignment 
)

Adds the specified element to the layout as an inset aligned at the border (setInsetAlignment is initialized with ipBorderAligned).

The alignment is set to alignment.

alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored.

See also
addElement(QCPLayoutElement *element, const QRectF &rect)

◆ elementAt()

QCPLayoutElement * QCPLayoutInset::elementAt ( int  index) const
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.

See also
elements, elementCount, takeAt

Implements QCPLayout.

◆ elementCount()

int QCPLayoutInset::elementCount ( ) const
virtual

Returns the number of elements/cells in the layout.

See also
elements, elementAt

Implements QCPLayout.

◆ insetAlignment()

Qt::Alignment QCPLayoutInset::insetAlignment ( int  index) const

Returns the alignment of the element with the specified index.

The alignment only has a meaning, if the inset placement (setInsetPlacement) is ipBorderAligned.

◆ insetRect()

QRectF QCPLayoutInset::insetRect ( int  index) const

Returns the rect of the element with the specified index.

The rect only has a meaning, if the inset placement (setInsetPlacement) is ipFree.

◆ selectTest()

double QCPLayoutInset::selectTest ( const QPointF &  pos,
bool  onlySelectable,
QVariant *  details = 0 
) const
virtual

The inset layout is sensitive to events only at areas where its (visible) child elements are sensitive.

If the selectTest method of any of the child elements returns a positive number for pos, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. The inset layout is not selectable itself by default. So if onlySelectable is true, -1.0 is returned.

See QCPLayerable::selectTest for a general explanation of this virtual method.

Reimplemented from QCPLayoutElement.

◆ setInsetAlignment()

void QCPLayoutInset::setInsetAlignment ( int  index,
Qt::Alignment  alignment 
)

If the inset placement (setInsetPlacement) is ipBorderAligned, this function is used to set the alignment of the element with the specified index to alignment.

alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored.

◆ setInsetPlacement()

void QCPLayoutInset::setInsetPlacement ( int  index,
QCPLayoutInset::InsetPlacement  placement 
)

Sets the inset placement type of the element with the specified index to placement.

See also
InsetPlacement

◆ setInsetRect()

void QCPLayoutInset::setInsetRect ( int  index,
const QRectF &  rect 
)

If the inset placement (setInsetPlacement) is ipFree, this function is used to set the position and size of the element with the specified index to rect.

rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout.

Note that the minimum and maximum sizes of the embedded element (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize) are enforced.

◆ simplify()

void QCPLayoutInset::simplify ( )
inlinevirtual

The QCPInsetLayout does not need simplification since it can never have empty cells due to its linear index structure.

This method does nothing.

Reimplemented from QCPLayout.

◆ take()

bool QCPLayoutInset::take ( QCPLayoutElement element)
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

Implements QCPLayout.

◆ takeAt()

QCPLayoutElement * QCPLayoutInset::takeAt ( int  index)
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.

See also
elementAt, take

Implements QCPLayout.

◆ updateLayout()

void QCPLayoutInset::updateLayout ( )
virtual

Reimplemented from QCPLayout.


The documentation for this class was generated from the following files: