SETestKCL  1.0.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
QCPLayoutInset Class Reference

#include <qcustomplot.h>

Inheritance diagram for QCPLayoutInset:
Inheritance graph
[legend]
Collaboration diagram for QCPLayoutInset:
Collaboration graph
[legend]

Public Types

enum  InsetPlacement { ipFree, ipBorderAligned }
 
- Public Types inherited from QCPLayoutElement
enum  UpdatePhase { upPreparation, upMargins, upLayout }
 

Public Member Functions

 QCPLayoutInset ()
 
virtual ~QCPLayoutInset ()
 
InsetPlacement insetPlacement (int index) const
 
Qt::Alignment insetAlignment (int index) const
 
QRectF insetRect (int index) const
 
void setInsetPlacement (int index, InsetPlacement placement)
 
void setInsetAlignment (int index, Qt::Alignment alignment)
 
void setInsetRect (int index, const QRectF &rect)
 
virtual void updateLayout ()
 
virtual int elementCount () const
 
virtual QCPLayoutElementelementAt (int index) const
 
virtual QCPLayoutElementtakeAt (int index)
 
virtual bool take (QCPLayoutElement *element)
 
virtual void simplify ()
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const
 
void addElement (QCPLayoutElement *element, Qt::Alignment alignment)
 
void addElement (QCPLayoutElement *element, const QRectF &rect)
 
- Public Member Functions inherited from QCPLayout
 QCPLayout ()
 
virtual void update (UpdatePhase phase)
 
virtual QList< QCPLayoutElement * > elements (bool recursive) const
 
bool removeAt (int index)
 
bool remove (QCPLayoutElement *element)
 
void clear ()
 
- Public Member Functions inherited from QCPLayoutElement
 QCPLayoutElement (QCustomPlot *parentPlot=0)
 
virtual ~QCPLayoutElement ()
 
QCPLayoutlayout () const
 
QRect rect () const
 
QRect outerRect () const
 
QMargins margins () const
 
QMargins minimumMargins () const
 
QCP::MarginSides autoMargins () const
 
QSize minimumSize () const
 
QSize maximumSize () const
 
QCPMarginGroupmarginGroup (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 setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group)
 
virtual QSize minimumSizeHint () const
 
virtual QSize maximumSizeHint () const
 
- Public Member Functions inherited from QCPLayerable
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
 
 ~QCPLayerable ()
 
bool visible () const
 
QCustomPlotparentPlot () const
 
QCPLayerableparentLayerable () const
 
QCPLayerlayer () 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
 

Protected Attributes

QList< QCPLayoutElement * > mElements
 
QList< InsetPlacementmInsetPlacement
 
QList< Qt::Alignment > mInsetAlignment
 
QList< QRectF > mInsetRect
 
- Protected Attributes inherited from QCPLayoutElement
QCPLayoutmParentLayout
 
QSize mMinimumSize
 
QSize mMaximumSize
 
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)
 
- Protected Member Functions inherited from QCPLayout
void sizeConstraintsChanged () const
 
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 mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual void applyDefaultAntialiasingHint (QCPPainter *painter) const
 
virtual void draw (QCPPainter *painter)
 
virtual void parentPlotInitialized (QCustomPlot *parentPlot)
 
- Protected Member Functions inherited from QCPLayerable
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)
 
void initializeParentPlot (QCustomPlot *parentPlot)
 
void setParentLayerable (QCPLayerable *parentLayerable)
 
bool moveToLayer (QCPLayer *layer, bool prepend)
 
void applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
 

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.

Definition at line 823 of file qcustomplot.h.

Member Enumeration Documentation

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.

Definition at line 830 of file qcustomplot.h.

Constructor & Destructor Documentation

QCPLayoutInset ( )
explicit

Creates an instance of QCPLayoutInset and sets default values.

Definition at line 3079 of file qcustomplot.cpp.

~QCPLayoutInset ( )
virtual

Definition at line 3083 of file qcustomplot.cpp.

References QCPLayout::clear().

Member Function Documentation

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). 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)

Definition at line 3312 of file qcustomplot.cpp.

References QCPLayout::adoptElement(), ipBorderAligned, QCPLayoutElement::layout(), mElements, mInsetAlignment, mInsetPlacement, mInsetRect, and QCPLayout::take().

Referenced by QCustomPlot::QCustomPlot().

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). 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)

Definition at line 3338 of file qcustomplot.cpp.

References QCPLayout::adoptElement(), ipFree, QCPLayoutElement::layout(), mElements, mInsetAlignment, mInsetPlacement, mInsetRect, and QCPLayout::take().

QCPLayoutElement * 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.

Definition at line 3231 of file qcustomplot.cpp.

References mElements.

Referenced by insetAlignment(), insetPlacement(), insetRect(), setInsetAlignment(), setInsetPlacement(), setInsetRect(), take(), and takeAt().

int elementCount ( ) const
virtual

Returns the number of elements/cells in the layout.

See Also
elements, elementAt

Implements QCPLayout.

Definition at line 3225 of file qcustomplot.cpp.

References mElements.

Referenced by take().

Qt::Alignment 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.

Definition at line 3108 of file qcustomplot.cpp.

References elementAt(), and mInsetAlignment.

QCPLayoutInset::InsetPlacement insetPlacement ( int  index) const

Returns the placement type of the element with the specified index.

Definition at line 3093 of file qcustomplot.cpp.

References elementAt(), ipFree, and mInsetPlacement.

QRectF 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.

Definition at line 3123 of file qcustomplot.cpp.

References elementAt(), and mInsetRect.

Referenced by updateLayout().

double 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.

Definition at line 3285 of file qcustomplot.cpp.

References mElements, QCPLayerable::mParentPlot, and QCustomPlot::selectionTolerance().

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.

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.

Definition at line 3155 of file qcustomplot.cpp.

References elementAt(), and mInsetAlignment.

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

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

See Also
InsetPlacement

Definition at line 3139 of file qcustomplot.cpp.

References elementAt(), and mInsetPlacement.

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.

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.

Definition at line 3174 of file qcustomplot.cpp.

References elementAt(), mInsetRect, and QCPLayoutElement::rect().

void 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.

Definition at line 853 of file qcustomplot.h.

bool 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.

Definition at line 3258 of file qcustomplot.cpp.

References elementAt(), elementCount(), and takeAt().

QCPLayoutElement * 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.

Definition at line 3240 of file qcustomplot.cpp.

References elementAt(), mElements, mInsetAlignment, mInsetPlacement, mInsetRect, and QCPLayout::releaseElement().

Referenced by take().

void updateLayout ( )
virtual

Member Data Documentation

QList<QCPLayoutElement*> mElements
protected

Definition at line 862 of file qcustomplot.h.

Referenced by addElement(), elementAt(), elementCount(), selectTest(), takeAt(), and updateLayout().

QList<Qt::Alignment> mInsetAlignment
protected

Definition at line 864 of file qcustomplot.h.

Referenced by addElement(), insetAlignment(), setInsetAlignment(), takeAt(), and updateLayout().

QList<InsetPlacement> mInsetPlacement
protected

Definition at line 863 of file qcustomplot.h.

Referenced by addElement(), insetPlacement(), setInsetPlacement(), takeAt(), and updateLayout().

QList<QRectF> mInsetRect
protected

Definition at line 865 of file qcustomplot.h.

Referenced by addElement(), insetRect(), setInsetRect(), takeAt(), and updateLayout().


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