QCPLayoutGrid

Search for usage in LXR

Inheritance diagram for QCPLayoutGrid:

Public Types

enum  FillOrder { foRowsFirst , foColumnsFirst }
 
- Public Types inherited from QCPLayoutElement
enum  SizeConstraintRect { scrInnerRect , scrOuterRect }
 
enum  UpdatePhase { upPreparation , upMargins , upLayout }
 
- Public Types inherited from QObject
typedef  QObjectList
 

Public Member Functions

 QCPLayoutGrid ()
 
bool addElement (int row, int column, QCPLayoutElement *element)
 
bool addElement (QCPLayoutElement *element)
 
int columnCount () const
 
int columnSpacing () const
 
QList< double > columnStretchFactors () const
 
QCPLayoutElementelement (int row, int column) const
 
virtual QCPLayoutElementelementAt (int index) const override
 
virtual int elementCount () const override
 
virtual QList< QCPLayoutElement * > elements (bool recursive) const override
 
void expandTo (int newRowCount, int newColumnCount)
 
FillOrder fillOrder () const
 
bool hasElement (int row, int column)
 
void indexToRowCol (int index, int &row, int &column) const
 
void insertColumn (int newIndex)
 
void insertRow (int newIndex)
 
virtual QSize maximumOuterSizeHint () const override
 
virtual QSize minimumOuterSizeHint () const override
 
int rowColToIndex (int row, int column) const
 
int rowCount () const
 
int rowSpacing () const
 
QList< double > rowStretchFactors () const
 
void setColumnSpacing (int pixels)
 
void setColumnStretchFactor (int column, double factor)
 
void setColumnStretchFactors (const QList< double > &factors)
 
void setFillOrder (FillOrder order, bool rearrange=true)
 
void setRowSpacing (int pixels)
 
void setRowStretchFactor (int row, double factor)
 
void setRowStretchFactors (const QList< double > &factors)
 
void setWrap (int count)
 
virtual void simplify () override
 
virtual bool take (QCPLayoutElement *element) override
 
virtual QCPLayoutElementtakeAt (int index) override
 
virtual void updateLayout () override
 
int wrap () const
 
- Public Member Functions inherited from QCPLayout
 QCPLayout ()
 
void clear ()
 
bool remove (QCPLayoutElement *element)
 
bool removeAt (int index)
 
virtual void update (UpdatePhase phase) override
 
- Public Member Functions inherited from QCPLayoutElement
 QCPLayoutElement (QCustomPlot *parentPlot=nullptr)
 
QCP::MarginSides autoMargins () const
 
QCPLayoutlayout () const
 
QCPMarginGroupmarginGroup (QCP::MarginSide side) const
 
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups () const
 
QMargins margins () const
 
QSize maximumSize () const
 
QMargins minimumMargins () 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
 
QCPLayerlayer () const
 
QCPLayerableparentLayerable () const
 
QCustomPlotparentPlot () 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< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
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 QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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
 
qobject_cast (const QObject *object)
 
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)
 
QThreadthread () const const
 

Protected Member Functions

void getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const
 
void getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const
 
- Protected Member Functions inherited from QCPLayout
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
 
- 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
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

int mColumnSpacing
 
QList< double > mColumnStretchFactors
 
QList< QList< QCPLayoutElement * > > mElements
 
FillOrder mFillOrder
 
int mRowSpacing
 
QList< double > mRowStretchFactors
 
int mWrap
 
- Protected Attributes inherited from QCPLayoutElement
QCP::MarginSides mAutoMargins
 
QHash< QCP::MarginSide, QCPMarginGroup * > mMarginGroups
 
QMargins mMargins
 
QSize mMaximumSize
 
QMargins mMinimumMargins
 
QSize mMinimumSize
 
QRect mOuterRect
 
QCPLayoutmParentLayout
 
QRect mRect
 
SizeConstraintRect mSizeConstraintRect
 
- Protected Attributes inherited from QCPLayerable
bool mAntialiased
 
QCPLayermLayer
 
QPointer< QCPLayerablemParentLayerable
 
QCustomPlotmParentPlot
 
bool mVisible
 

Additional Inherited Members

- 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)
 
- Static Protected Member Functions inherited from QCPLayout
static QSize getFinalMaximumOuterSize (const QCPLayoutElement *el)
 
static QSize getFinalMinimumOuterSize (const QCPLayoutElement *el)
 

Detailed Description

A layout that arranges child elements in a grid.

Elements are laid out in a grid with configurable stretch factors (setColumnStretchFactor, setRowStretchFactor) and spacing (setColumnSpacing, setRowSpacing).

Elements can be added to cells via addElement. The grid is expanded if the specified row or column doesn't exist yet. Whether a cell contains a valid layout element can be checked with hasElement, that element can be retrieved with element. If rows and columns that only have empty cells shall be removed, call simplify. Removal of elements is either done by just adding the element to a different layout or by using the QCPLayout interface take or remove.

If you use addElement(QCPLayoutElement*) without explicit parameters for row and column, the grid layout will choose the position according to the current setFillOrder and the wrapping (setWrap).

Row and column insertion can be performed with insertRow and insertColumn.

Definition at line 1381 of file qcustomplot.h.

Member Enumeration Documentation

◆ FillOrder

Defines in which direction the grid is filled when using addElement(QCPLayoutElement*). The column/row at which wrapping into the next row/column occurs can be specified with setWrap.

See also
setFillOrder
Enumerator
foRowsFirst 

Rows are filled first, and a new element is wrapped to the next column if the row count would exceed setWrap.

foColumnsFirst 

Columns are filled first, and a new element is wrapped to the next row if the column count would exceed setWrap.

Definition at line 1403 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPLayoutGrid()

QCPLayoutGrid::QCPLayoutGrid ( )
explicit

Creates an instance of QCPLayoutGrid and sets default values.

Definition at line 4104 of file qcustomplot.cpp.

◆ ~QCPLayoutGrid()

QCPLayoutGrid::~QCPLayoutGrid ( )
overridevirtual

Definition at line 4112 of file qcustomplot.cpp.

Member Function Documentation

◆ addElement() [1/2]

bool QCPLayoutGrid::addElement ( int row,
int column,
QCPLayoutElement * element )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Adds the element to cell with row and column. If element is already in a layout, it is first removed from there. If row or column don't exist yet, the layout is expanded accordingly.

Returns true if the element was added successfully, i.e. if the cell at row and column didn't already have an element.

Use the overload of this method without explicit row/column index to place the element according to the configured fill order and wrapping settings.

See also
element, hasElement, take, remove

Definition at line 4159 of file qcustomplot.cpp.

◆ addElement() [2/2]

bool QCPLayoutGrid::addElement ( QCPLayoutElement * element)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Adds the element to the next empty cell according to the current fill order (setFillOrder) and wrapping (setWrap). If element is already in a layout, it is first removed from there. If necessary, the layout is expanded to hold the new element.

Returns true if the element was added successfully.

See also
setFillOrder, setWrap, element, hasElement, take, remove

Definition at line 4185 of file qcustomplot.cpp.

◆ columnCount()

int QCPLayoutGrid::columnCount ( ) const
inline

Returns the number of columns in the layout.

See also
rowCount

Definition at line 1413 of file qcustomplot.h.

◆ columnSpacing()

int QCPLayoutGrid::columnSpacing ( ) const
inline

Definition at line 1416 of file qcustomplot.h.

◆ columnStretchFactors()

QList< double > QCPLayoutGrid::columnStretchFactors ( ) const
inline

Definition at line 1414 of file qcustomplot.h.

◆ element()

QCPLayoutElement * QCPLayoutGrid::element ( int row,
int column ) const

Returns the element in the cell in row and column.

Returns nullptr if either the row/column is invalid or if the cell is empty. In those cases, a qDebug message is printed. To check whether a cell exists and isn't empty, use hasElement.

See also
addElement, hasElement

Definition at line 4127 of file qcustomplot.cpp.

◆ elementAt()

QCPLayoutElement * QCPLayoutGrid::elementAt ( int index) const
overridevirtual

\seebaseclassmethod

Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.

See also
rowColToIndex

Implements QCPLayout.

Definition at line 4625 of file qcustomplot.cpp.

◆ elementCount()

virtual int QCPLayoutGrid::elementCount ( ) const
inlineoverridevirtual

Returns the number of elements/cells in the layout.

See also
elements, elementAt

Implements QCPLayout.

Definition at line 1433 of file qcustomplot.h.

◆ elements()

QList< QCPLayoutElement * > QCPLayoutGrid::elements ( bool recursive) const
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 yield nullptr at the respective index.

Reimplemented from QCPLayout.

Definition at line 4680 of file qcustomplot.cpp.

◆ expandTo()

void QCPLayoutGrid::expandTo ( int newRowCount,
int newColumnCount )

Expands the layout to have newRowCount rows and newColumnCount columns. So the last valid row index will be newRowCount-1, the last valid column index will be newColumnCount-1.

If the current column/row count is already larger or equal to newColumnCount/newRowCount, this function does nothing in that dimension.

Newly created cells are empty, new rows and columns have the stretch factor 1.

Note that upon a call to addElement, the layout is expanded automatically to contain the specified row and column, using this function.

See also
simplify

Definition at line 4441 of file qcustomplot.cpp.

◆ fillOrder()

FillOrder QCPLayoutGrid::fillOrder ( ) const
inline

Definition at line 1419 of file qcustomplot.h.

◆ getMaximumRowColSizes()

void QCPLayoutGrid::getMaximumRowColSizes ( QVector< int > * maxColWidths,
QVector< int > * maxRowHeights ) const
protected

Places the maximum column widths and row heights into maxColWidths and maxRowHeights respectively.

The maximum height of a row is the smallest maximum height of any element's outer rect in that row. The maximum width of a column is the smallest maximum width of any element's outer rect in that column.

This is a helper function for updateLayout.

See also
getMinimumRowColSizes

Definition at line 4832 of file qcustomplot.cpp.

◆ getMinimumRowColSizes()

void QCPLayoutGrid::getMinimumRowColSizes ( QVector< int > * minColWidths,
QVector< int > * minRowHeights ) const
protected

Places the minimum column widths and row heights into minColWidths and minRowHeights respectively.

The minimum height of a row is the largest minimum height of any element's outer rect in that row. The minimum width of a column is the largest minimum width of any element's outer rect in that column.

This is a helper function for updateLayout.

See also
getMaximumRowColSizes

Definition at line 4799 of file qcustomplot.cpp.

◆ hasElement()

bool QCPLayoutGrid::hasElement ( int row,
int column )

Returns whether the cell at row and column exists and contains a valid element, i.e. isn't empty.

See also
element

Definition at line 4221 of file qcustomplot.cpp.

◆ indexToRowCol()

void QCPLayoutGrid::indexToRowCol ( int index,
int & row,
int & column ) const

Converts the linear index to row and column indices and writes the result to row and column.

The way the cells are indexed depends on setFillOrder. If it is foRowsFirst, the indices increase left to right and then top to bottom. If it is foColumnsFirst, the indices increase top to bottom and then left to right.

If there are no cells (i.e. column or row count is zero), sets row and column to -1.

For the retrieved row and column to be valid, the passed index must be valid itself, i.e. greater or equal to zero and smaller than the current elementCount.

See also
rowColToIndex

Definition at line 4557 of file qcustomplot.cpp.

◆ insertColumn()

void QCPLayoutGrid::insertColumn ( int newIndex)

Inserts a new column with empty cells at the column index newIndex. Valid values for newIndex range from 0 (inserts a column at the left) to columnCount (appends a column at the right).

See also
insertRow

Definition at line 4493 of file qcustomplot.cpp.

◆ insertRow()

void QCPLayoutGrid::insertRow ( int newIndex)

Inserts a new row with empty cells at the row index newIndex. Valid values for newIndex range from 0 (inserts a row at the top) to rowCount (appends a row at the bottom).

See also
insertColumn

Definition at line 4466 of file qcustomplot.cpp.

◆ maximumOuterSizeHint()

QSize QCPLayoutGrid::maximumOuterSizeHint ( ) const
overridevirtual

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.

Reimplemented from QCPLayoutElement.

Definition at line 4765 of file qcustomplot.cpp.

◆ minimumOuterSizeHint()

QSize QCPLayoutGrid::minimumOuterSizeHint ( ) const
overridevirtual

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.

Reimplemented from QCPLayoutElement.

Definition at line 4748 of file qcustomplot.cpp.

◆ rowColToIndex()

int QCPLayoutGrid::rowColToIndex ( int row,
int column ) const

Converts the given row and column to the linear index used by some methods of QCPLayoutGrid and QCPLayout.

The way the cells are indexed depends on setFillOrder. If it is foRowsFirst, the indices increase left to right and then top to bottom. If it is foColumnsFirst, the indices increase top to bottom and then left to right.

For the returned index to be valid, row and column must be valid indices themselves, i.e. greater or equal to zero and smaller than the current rowCount/ columnCount.

See also
indexToRowCol

Definition at line 4524 of file qcustomplot.cpp.

◆ rowCount()

int QCPLayoutGrid::rowCount ( ) const
inline

Returns the number of rows in the layout.

See also
columnCount

Definition at line 1412 of file qcustomplot.h.

◆ rowSpacing()

int QCPLayoutGrid::rowSpacing ( ) const
inline

Definition at line 1417 of file qcustomplot.h.

◆ rowStretchFactors()

QList< double > QCPLayoutGrid::rowStretchFactors ( ) const
inline

Definition at line 1415 of file qcustomplot.h.

◆ setColumnSpacing()

void QCPLayoutGrid::setColumnSpacing ( int pixels)

Sets the gap that is left blank between columns to pixels.

See also
setRowSpacing

Definition at line 4340 of file qcustomplot.cpp.

◆ setColumnStretchFactor()

void QCPLayoutGrid::setColumnStretchFactor ( int column,
double factor )

Sets the stretch factor of column.

Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)

The default stretch factor of newly created rows/columns is 1.

See also
setColumnStretchFactors, setRowStretchFactor

Definition at line 4241 of file qcustomplot.cpp.

◆ setColumnStretchFactors()

void QCPLayoutGrid::setColumnStretchFactors ( const QList< double > & factors)

Sets the stretch factors of all columns. factors must have the size columnCount.

Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)

The default stretch factor of newly created rows/columns is 1.

See also
setColumnStretchFactor, setRowStretchFactors

Definition at line 4265 of file qcustomplot.cpp.

◆ setFillOrder()

void QCPLayoutGrid::setFillOrder ( FillOrder order,
bool rearrange = true )

Sets the filling order and wrapping behaviour that is used when adding new elements with the method addElement(QCPLayoutElement*).

The specified order defines whether rows or columns are filled first. Using setWrap, you can control at which row/column count wrapping into the next column/row will occur. If you set it to zero, no wrapping will ever occur. Changing the fill order also changes the meaning of the linear index used e.g. in elementAt and takeAt. The default fill order for QCPLayoutGrid is foColumnsFirst.

If you want to have all current elements arranged in the new order, set rearrange to true. The elements will be rearranged in a way that tries to preserve their linear index. However, empty cells are skipped during build-up of the new cell order, which shifts the succeeding element's index. The rearranging is performed even if the specified order is already the current fill order. Thus this method can be used to re-wrap the current elements.

If rearrange is false, the current element arrangement is not changed, which means the linear indexes change (because the linear index is dependent on the fill order).

Note that the method addElement(int row, int column, QCPLayoutElement *element) with explicitly stated row and column is not subject to wrapping and can place elements even beyond the specified wrapping point.

See also
setWrap, addElement(QCPLayoutElement*)

Definition at line 4402 of file qcustomplot.cpp.

◆ setRowSpacing()

void QCPLayoutGrid::setRowSpacing ( int pixels)

Sets the gap that is left blank between rows to pixels.

See also
setColumnSpacing

Definition at line 4350 of file qcustomplot.cpp.

◆ setRowStretchFactor()

void QCPLayoutGrid::setRowStretchFactor ( int row,
double factor )

Sets the stretch factor of row.

Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)

The default stretch factor of newly created rows/columns is 1.

See also
setColumnStretchFactors, setRowStretchFactor

Definition at line 4294 of file qcustomplot.cpp.

◆ setRowStretchFactors()

void QCPLayoutGrid::setRowStretchFactors ( const QList< double > & factors)

Sets the stretch factors of all rows. factors must have the size rowCount.

Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)

The default stretch factor of newly created rows/columns is 1.

See also
setRowStretchFactor, setColumnStretchFactors

Definition at line 4318 of file qcustomplot.cpp.

◆ setWrap()

void QCPLayoutGrid::setWrap ( int count)

Sets the maximum number of columns or rows that are used, before new elements added with addElement(QCPLayoutElement*) will start to fill the next row or column, respectively. It depends on setFillOrder, whether rows or columns are wrapped.

If count is set to zero, no wrapping will ever occur.

If you wish to re-wrap the elements currently in the layout, call setFillOrder with rearrange set to true (the actual fill order doesn't need to be changed for the rearranging to be done).

Note that the method addElement(int row, int column, QCPLayoutElement *element) with explicitly stated row and column is not subject to wrapping and can place elements even beyond the specified wrapping point.

See also
setFillOrder

Definition at line 4372 of file qcustomplot.cpp.

◆ simplify()

void QCPLayoutGrid::simplify ( )
overridevirtual

Simplifies the layout by collapsing rows and columns which only contain empty cells.

Reimplemented from QCPLayout.

Definition at line 4703 of file qcustomplot.cpp.

◆ take()

bool QCPLayoutGrid::take ( QCPLayoutElement * element)
overridevirtual

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 4661 of file qcustomplot.cpp.

◆ takeAt()

QCPLayoutElement * QCPLayoutGrid::takeAt ( int index)
overridevirtual

\seebaseclassmethod

Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.

See also
rowColToIndex

Implements QCPLayout.

Definition at line 4644 of file qcustomplot.cpp.

◆ updateLayout()

void QCPLayoutGrid::updateLayout ( )
overridevirtual

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 from QCPLayout.

Definition at line 4589 of file qcustomplot.cpp.

◆ wrap()

int QCPLayoutGrid::wrap ( ) const
inline

Definition at line 1418 of file qcustomplot.h.

Member Data Documentation

◆ mColumnSpacing

int QCPLayoutGrid::mColumnSpacing
protected

Definition at line 1458 of file qcustomplot.h.

◆ mColumnStretchFactors

QList<double> QCPLayoutGrid::mColumnStretchFactors
protected

Definition at line 1456 of file qcustomplot.h.

◆ mElements

QList<QList<QCPLayoutElement*> > QCPLayoutGrid::mElements
protected

Definition at line 1455 of file qcustomplot.h.

◆ mFillOrder

FillOrder QCPLayoutGrid::mFillOrder
protected

Definition at line 1460 of file qcustomplot.h.

◆ mRowSpacing

int QCPLayoutGrid::mRowSpacing
protected

Definition at line 1458 of file qcustomplot.h.

◆ mRowStretchFactors

QList<double> QCPLayoutGrid::mRowStretchFactors
protected

Definition at line 1457 of file qcustomplot.h.

◆ mWrap

int QCPLayoutGrid::mWrap
protected

Definition at line 1459 of file qcustomplot.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.