![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A layout that arranges child elements in a grid. More...
#include <qcustomplot.h>


Public Types | |
| enum | FillOrder { foRowsFirst , foColumnsFirst } |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
| enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
Public Member Functions | |
| QCPLayoutGrid () | |
| virtual | ~QCPLayoutGrid () |
| int | rowCount () const |
| int | columnCount () const |
| QList< double > | columnStretchFactors () const |
| QList< double > | rowStretchFactors () const |
| int | columnSpacing () const |
| int | rowSpacing () const |
| int | wrap () const |
| FillOrder | fillOrder () const |
| void | setColumnStretchFactor (int column, double factor) |
| void | setColumnStretchFactors (const QList< double > &factors) |
| void | setRowStretchFactor (int row, double factor) |
| void | setRowStretchFactors (const QList< double > &factors) |
| void | setColumnSpacing (int pixels) |
| void | setRowSpacing (int pixels) |
| void | setWrap (int count) |
| void | setFillOrder (FillOrder order, bool rearrange=true) |
| virtual void | updateLayout () |
| virtual int | elementCount () const |
| virtual QCPLayoutElement * | elementAt (int index) const |
| virtual QCPLayoutElement * | takeAt (int index) |
| virtual bool | take (QCPLayoutElement *element) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual void | simplify () |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| QCPLayoutElement * | element (int row, int column) const |
| bool | addElement (int row, int column, QCPLayoutElement *element) |
| bool | addElement (QCPLayoutElement *element) |
| bool | hasElement (int row, int column) |
| void | expandTo (int newRowCount, int newColumnCount) |
| void | insertRow (int newIndex) |
| void | insertColumn (int newIndex) |
| int | rowColToIndex (int row, int column) const |
| void | indexToRowCol (int index, int &row, int &column) const |
| QCPLayoutGrid () | |
| virtual | ~QCPLayoutGrid () |
| int | rowCount () const |
| int | columnCount () const |
| QList< double > | columnStretchFactors () const |
| QList< double > | rowStretchFactors () const |
| int | columnSpacing () const |
| int | rowSpacing () const |
| void | setColumnStretchFactor (int column, double factor) |
| void | setColumnStretchFactors (const QList< double > &factors) |
| void | setRowStretchFactor (int row, double factor) |
| void | setRowStretchFactors (const QList< double > &factors) |
| void | setColumnSpacing (int pixels) |
| void | setRowSpacing (int pixels) |
| virtual void | updateLayout () |
| virtual int | elementCount () const |
| virtual QCPLayoutElement * | elementAt (int index) const |
| virtual QCPLayoutElement * | takeAt (int index) |
| virtual bool | take (QCPLayoutElement *element) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual void | simplify () |
| virtual QSize | minimumSizeHint () const |
| virtual QSize | maximumSizeHint () const |
| QCPLayoutElement * | element (int row, int column) const |
| bool | addElement (int row, int column, QCPLayoutElement *element) |
| bool | hasElement (int row, int column) |
| void | expandTo (int newRowCount, int newColumnCount) |
| void | insertRow (int newIndex) |
| void | insertColumn (int newIndex) |
Public Member Functions inherited from QCPLayout | |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
Public Member Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| SizeConstraintRect | sizeConstraintRect () const |
| QCPMarginGroup * | marginGroup (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 | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| QCPMarginGroup * | marginGroup (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 double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Member Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| virtual | ~QCPLayerable () |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () 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 |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| ~QCPLayerable () | |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () 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 Member Functions | |
| void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
| void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
| void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
| void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
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 |
| 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 | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| 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) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
| 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 |
Protected Attributes | |
| QList< QList< QCPLayoutElement * > > | mElements |
| QList< double > | mColumnStretchFactors |
| QList< double > | mRowStretchFactors |
| int | mColumnSpacing |
| int | mRowSpacing |
| int | mWrap |
| FillOrder | mFillOrder |
Protected Attributes inherited from QCPLayoutElement | |
| QCPLayout * | mParentLayout |
| 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 |
| QCustomPlot * | mParentPlot |
| QPointer< QCPLayerable > | mParentLayerable |
| QCPLayer * | mLayer |
| bool | mAntialiased |
Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
| void | layerChanged (QCPLayer *newLayer) |
Static Protected Member Functions inherited from QCPLayout | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
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.
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.
Row and column insertion can be performed with insertRow and insertColumn.
Definition at line 1574 of file qcustomplot.h.
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.
| 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 1596 of file qcustomplot.h.
|
explicit |
Creates an instance of QCPLayoutGrid and sets default values.
Definition at line 4078 of file qcustomplot.cpp.
|
virtual |
Definition at line 4081 of file qcustomplot.cpp.
References QCPLayout::clear().
|
explicit |
|
virtual |
| 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.
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.
Definition at line 4129 of file qcustomplot.cpp.
References QCPLayout::adoptElement(), element(), expandTo(), hasElement(), QCPLayoutElement::layout(), mElements, and QCPLayout::take().
Referenced by addElement(), QCPLegend::addItem(), QCustomPlot::QCustomPlot(), ccHistogramWindow::refresh(), ccWaveWidget::refresh(), and setFillOrder().
| bool QCPLayoutGrid::addElement | ( | int | row, |
| int | column, | ||
| QCPLayoutElement * | element | ||
| ) |
| 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.
Definition at line 4155 of file qcustomplot.cpp.
References addElement(), element(), foColumnsFirst, hasElement(), mFillOrder, and mWrap.
|
inline |
Returns the number of columns in the layout.
Definition at line 1612 of file qcustomplot.h.
Referenced by expandTo(), getMaximumRowColSizes(), getMinimumRowColSizes(), hasElement(), indexToRowCol(), insertColumn(), insertRow(), maximumOuterSizeHint(), maximumSizeHint(), minimumOuterSizeHint(), minimumSizeHint(), rowColToIndex(), setColumnStretchFactor(), simplify(), and updateLayout().
| int QCPLayoutGrid::columnCount | ( | ) | const |
|
inline |
Definition at line 1617 of file qcustomplot.h.
|
inline |
Definition at line 971 of file qcustomplot.h.
|
inline |
Definition at line 1615 of file qcustomplot.h.
|
inline |
Definition at line 969 of file qcustomplot.h.
| QCPLayoutElement * QCPLayoutGrid::element | ( | int | row, |
| int | column | ||
| ) | const |
Returns the element in the cell in row and column.
Returns 0 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.
Definition at line 4097 of file qcustomplot.cpp.
References mElements, and result.
Referenced by addElement(), and take().
| QCPLayoutElement* QCPLayoutGrid::element | ( | int | row, |
| int | column | ||
| ) | const |
|
virtual |
\seebaseclassmethod
Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.
Implements QCPLayout.
Definition at line 4575 of file qcustomplot.cpp.
References elementCount(), indexToRowCol(), and mElements.
Referenced by elements(), QCPLegend::item(), setFillOrder(), take(), and takeAt().
|
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.
Implements QCPLayout.
|
inlinevirtual |
Returns the number of elements/cells in the layout.
Implements QCPLayout.
Definition at line 1634 of file qcustomplot.h.
References columnCount().
Referenced by elementAt(), elements(), indexToRowCol(), QCPLegend::itemCount(), setFillOrder(), and take().
|
virtual |
|
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 QCPLayout.
Definition at line 4621 of file qcustomplot.cpp.
References elementAt(), elementCount(), and result.
|
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 QCPLayout.
| 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.
Definition at line 4398 of file qcustomplot.cpp.
References columnCount(), mColumnStretchFactors, mElements, mRowStretchFactors, and rowCount().
Referenced by addElement(), insertColumn(), and insertRow().
| void QCPLayoutGrid::expandTo | ( | int | newRowCount, |
| int | newColumnCount | ||
| ) |
|
inline |
Definition at line 1620 of file qcustomplot.h.
Referenced by QCPLegend::removeItem().
|
protected |
Definition at line 4758 of file qcustomplot.cpp.
References columnCount(), QCPLayout::getFinalMaximumOuterSize(), mElements, and rowCount().
Referenced by maximumOuterSizeHint(), maximumSizeHint(), and updateLayout().
|
protected |
|
protected |
Definition at line 4728 of file qcustomplot.cpp.
References columnCount(), QCPLayout::getFinalMinimumOuterSize(), mElements, and rowCount().
Referenced by minimumOuterSizeHint(), minimumSizeHint(), and updateLayout().
|
protected |
| 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.
Definition at line 4184 of file qcustomplot.cpp.
References columnCount(), mElements, and rowCount().
Referenced by addElement().
| bool QCPLayoutGrid::hasElement | ( | int | row, |
| int | column | ||
| ) |
| 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.
Definition at line 4512 of file qcustomplot.cpp.
References columnCount(), elementCount(), foColumnsFirst, foRowsFirst, mFillOrder, and rowCount().
Referenced by elementAt(), and takeAt().
| 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).
Inserts a new column with empty cells at the column index newIndex. Valid values for newIndex range from 0 (inserts a row at the left) to rowCount (appends a row at the right).
Definition at line 4446 of file qcustomplot.cpp.
References columnCount(), expandTo(), mColumnStretchFactors, mElements, and rowCount().
| void QCPLayoutGrid::insertColumn | ( | int | newIndex | ) |
| 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).
Definition at line 4420 of file qcustomplot.cpp.
References columnCount(), expandTo(), mElements, mRowStretchFactors, and rowCount().
Referenced by ccHistogramWindow::refresh(), and ccWaveWidget::refresh().
| void QCPLayoutGrid::insertRow | ( | int | newIndex | ) |
|
virtual |
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 4695 of file qcustomplot.cpp.
References columnCount(), getMaximumRowColSizes(), mColumnSpacing, QCPLayoutElement::mMargins, mRowSpacing, result, and rowCount().
|
virtual |
Returns the maximum size this layout element (the inner rect) may be expanded to.
if a maximum size (setMaximumSize) was not set manually, parent layouts consult this function 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.)
Reimplemented from QCPLayoutElement.
Definition at line 2944 of file qcustomplot.cpp.
References columnCount(), getMaximumRowColSizes(), mColumnSpacing, QCPLayoutElement::mMargins, mRowSpacing, result, and rowCount().
|
virtual |
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 4679 of file qcustomplot.cpp.
References columnCount(), getMinimumRowColSizes(), mColumnSpacing, QCPLayoutElement::mMargins, mRowSpacing, result, and rowCount().
Referenced by QCustomPlot::minimumSizeHint(), and QCustomPlot::sizeHint().
|
virtual |
Returns the minimum size this layout element (the inner rect) may be compressed to.
if a minimum size (setMinimumSize) was not set manually, parent layouts consult this function to determine the minimum allowed size of this layout element. (A manual minimum size is considered set if it is non-zero.)
Reimplemented from QCPLayoutElement.
Definition at line 2928 of file qcustomplot.cpp.
References columnCount(), getMinimumRowColSizes(), mColumnSpacing, QCPLayoutElement::mMargins, mRowSpacing, result, and rowCount().
| 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.
Definition at line 4478 of file qcustomplot.cpp.
References columnCount(), foColumnsFirst, foRowsFirst, mFillOrder, and rowCount().
|
inline |
Returns the number of rows in the layout.
Definition at line 1611 of file qcustomplot.h.
Referenced by expandTo(), getMaximumRowColSizes(), getMinimumRowColSizes(), hasElement(), indexToRowCol(), insertColumn(), insertRow(), maximumOuterSizeHint(), maximumSizeHint(), minimumOuterSizeHint(), minimumSizeHint(), rowColToIndex(), setRowStretchFactor(), simplify(), and updateLayout().
| int QCPLayoutGrid::rowCount | ( | ) | const |
|
inline |
Definition at line 1618 of file qcustomplot.h.
|
inline |
Definition at line 972 of file qcustomplot.h.
|
inline |
Definition at line 1616 of file qcustomplot.h.
|
inline |
Definition at line 970 of file qcustomplot.h.
| void QCPLayoutGrid::setColumnSpacing | ( | int | pixels | ) |
Sets the gap that is left blank between columns to pixels.
Definition at line 4306 of file qcustomplot.cpp.
References mColumnSpacing.
Referenced by QCPLegend::QCPLegend().
| void QCPLayoutGrid::setColumnSpacing | ( | int | pixels | ) |
| 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.
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 (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize), regardless of the stretch factor.
The default stretch factor of newly created rows/columns is 1.
Definition at line 4204 of file qcustomplot.cpp.
References columnCount(), and mColumnStretchFactors.
| void QCPLayoutGrid::setColumnStretchFactor | ( | int | column, |
| double | factor | ||
| ) |
| 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.
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 (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize), regardless of the stretch factor.
The default stretch factor of newly created rows/columns is 1.
Definition at line 4229 of file qcustomplot.cpp.
References mColumnStretchFactors.
| void QCPLayoutGrid::setColumnStretchFactors | ( | const QList< double > & | factors | ) |
| 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.
Definition at line 4363 of file qcustomplot.cpp.
References addElement(), elementAt(), elementCount(), mFillOrder, simplify(), and takeAt().
Referenced by QCPLegend::QCPLegend(), and QCPLegend::removeItem().
| void QCPLayoutGrid::setRowSpacing | ( | int | pixels | ) |
Sets the gap that is left blank between rows to pixels.
Definition at line 4313 of file qcustomplot.cpp.
References mRowSpacing.
Referenced by QCPLegend::QCPLegend().
| void QCPLayoutGrid::setRowSpacing | ( | int | pixels | ) |
| 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.
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 (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize), regardless of the stretch factor.
The default stretch factor of newly created rows/columns is 1.
Definition at line 4259 of file qcustomplot.cpp.
References mRowStretchFactors, and rowCount().
| void QCPLayoutGrid::setRowStretchFactor | ( | int | row, |
| double | factor | ||
| ) |
| 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.
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 (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize), regardless of the stretch factor.
The default stretch factor of newly created rows/columns is 1.
Definition at line 4284 of file qcustomplot.cpp.
References mRowStretchFactors.
| void QCPLayoutGrid::setRowStretchFactors | ( | const QList< double > & | factors | ) |
| 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.
Definition at line 4333 of file qcustomplot.cpp.
Referenced by QCPLegend::QCPLegend().
|
virtual |
Simplifies the layout by collapsing rows and columns which only contain empty cells.
Reimplemented from QCPLayout.
Definition at line 4640 of file qcustomplot.cpp.
References columnCount(), mColumnStretchFactors, mElements, mRowStretchFactors, QCPLayout::removeAt(), and rowCount().
Referenced by setFillOrder().
|
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 from QCPLayout.
|
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.
Implements QCPLayout.
Definition at line 4606 of file qcustomplot.cpp.
References element(), elementAt(), elementCount(), and takeAt().
|
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.
Implements QCPLayout.
|
virtual |
\seebaseclassmethod
Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.
Implements QCPLayout.
Definition at line 4592 of file qcustomplot.cpp.
References elementAt(), indexToRowCol(), mElements, and QCPLayout::releaseElement().
Referenced by setFillOrder(), and take().
|
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.
Implements QCPLayout.
|
virtual |
Reimplemented from QCPLayout.
Definition at line 4538 of file qcustomplot.cpp.
References columnCount(), getMaximumRowColSizes(), getMinimumRowColSizes(), QCPLayout::getSectionSizes(), mColumnSpacing, mColumnStretchFactors, mElements, QCPLayoutElement::mRect, mRowSpacing, mRowStretchFactors, and rowCount().
|
virtual |
Reimplemented from QCPLayout.
|
inline |
Definition at line 1619 of file qcustomplot.h.
|
protected |
Definition at line 1662 of file qcustomplot.h.
Referenced by maximumOuterSizeHint(), maximumSizeHint(), minimumOuterSizeHint(), minimumSizeHint(), setColumnSpacing(), and updateLayout().
|
protected |
Definition at line 1660 of file qcustomplot.h.
Referenced by expandTo(), insertColumn(), setColumnStretchFactor(), setColumnStretchFactors(), simplify(), and updateLayout().
|
protected |
Definition at line 1659 of file qcustomplot.h.
Referenced by addElement(), element(), elementAt(), expandTo(), getMaximumRowColSizes(), getMinimumRowColSizes(), hasElement(), insertColumn(), insertRow(), simplify(), takeAt(), and updateLayout().
|
protected |
Definition at line 1664 of file qcustomplot.h.
Referenced by addElement(), indexToRowCol(), rowColToIndex(), and setFillOrder().
|
protected |
Definition at line 1662 of file qcustomplot.h.
Referenced by maximumOuterSizeHint(), maximumSizeHint(), minimumOuterSizeHint(), minimumSizeHint(), setRowSpacing(), and updateLayout().
|
protected |
Definition at line 1661 of file qcustomplot.h.
Referenced by expandTo(), insertRow(), setRowStretchFactor(), setRowStretchFactors(), simplify(), and updateLayout().
|
protected |
Definition at line 1663 of file qcustomplot.h.
Referenced by addElement(), and setWrap().