QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskLinearBox Class Reference

#include <QskLinearBox.h>

Detailed Description

Layout stringing items in rows and columns.

QskLinearBox organizes layout items in vertical or horizontal order ( orientation ). When the number of items for a row/column has reached an upper limit ( dimension ) the following items will be added to a new row/column.

When having the dimension being set to unlimited ( or 1 with the inverted orientation ) the string layout behaves similar to QBoxLayout, RowLayout/ColumnLayout ( QML ) or what is sometimes called a linear layout.

When not restricting the layout to one row/column only the layout can be used to set up simple grid formations.

Layout items may be QQuickItem *s or spacers - both having a stretch factor in the range of [0..10];

Note
All available Qsk layouts are thin layers on top of the same grid based workhorse ( = QGridLayoutEngine ). QskLinearBox offers a reasonable subset of features, tailored for an index based point of view.
See also
QskGridBox, QskStackBox

Definition at line 11 of file QskLinearBox.h.

Inheritance diagram for QskLinearBox:

Properties

Qt::Orientation orientation
 Direction of flow for laying out the items.
 
uint dimension
 Upper limit for the number of elements in a row or column.
 
qreal spacing
 Global layout spacing.
 
Qt::Alignment defaultAlignment
 
Qt::Edges extraSpacingAt
 
int elementCount
 
bool empty
 
- Properties inherited from QskIndexedLayoutBox
bool autoAddChildren
 Flag controlling whether to automatically append children to the layout.
 
- Properties inherited from QskBox
bool panel
 
QskBoxBorderMetrics borderMetrics
 
QskBoxBorderColors borderColors
 
QskGradient setFillGradient
 
QskMargins padding
 
- Properties inherited from QskControl
QLocale locale
 
QskAspect::Section section
 
bool autoLayoutChildren
 
bool visibleToLayout
 
QskMargins margins
 
QskGradient background
 
QskSizePolicy sizePolicy
 
QskPlacementPolicy placementPolicy
 
QSizeF minimumSize
 
QSizeF maximumSize
 
QSizeF preferredSize
 
QSizeF sizeConstraint
 
- Properties inherited from QskItem
QRectF geometry
 
QRectF rect
 
bool tabFence
 
bool polishOnResize
 
bool polishOnParentResize
 
Qt::FocusPolicy focusPolicy
 
bool wheelEnabled
 
bool visibleToParent
 
bool hasChildItems
 
bool initiallyPainted
 
UpdateFlags updateFlags
 

Public Member Functions

 QskLinearBox (QQuickItem *parent=nullptr)
 Create a row layout.
 
 QskLinearBox (Qt::Orientation, QQuickItem *parent=nullptr)
 Create a row or column layout.
 
 QskLinearBox (Qt::Orientation, uint dimension, QQuickItem *parent=nullptr)
 Constructor.
 
 ~QskLinearBox () override
 
bool isEmpty () const
 
int elementCount () const
 
qreal spacingAtIndex (int index) const
 
QQuickItem * itemAtIndex (int index) const
 
int indexOf (const QQuickItem *) const
 
void removeItem (const QQuickItem *)
 
void removeAt (int index)
 
Qt::Orientation orientation () const
 
void setOrientation (Qt::Orientation)
 Set the orientation of the layout.
 
void setDimension (uint)
 Set the dimension of the layout.
 
uint dimension () const
 
void setExtraSpacingAt (Qt::Edges)
 
Qt::Edges extraSpacingAt () const
 
void setDefaultAlignment (Qt::Alignment)
 
Qt::Alignment defaultAlignment () const
 
void setSpacing (qreal spacing)
 Set the global spacing of the layout.
 
void resetSpacing ()
 Reset the global spacing to its initial value.
 
qreal spacing () const
 
Q_INVOKABLE int addItem (QQuickItem *)
 
int addItem (QQuickItem *, Qt::Alignment)
 
Q_INVOKABLE int insertItem (int index, QQuickItem *)
 
int insertItem (int index, QQuickItem *, Qt::Alignment)
 
Q_INVOKABLE int addSpacer (qreal spacing, int stretchFactor=0)
 Append a spacer to the layout.
 
Q_INVOKABLE int insertSpacer (int index, qreal spacing, int stretchFactor=0)
 Insert a spacer at a specific position.
 
Q_INVOKABLE int addStretch (int stretchFactor=0)
 Append a stretch to the layout.
 
Q_INVOKABLE int insertStretch (int index, int stretchFactor=0)
 Insert a stretch at a specific position.
 
Q_INVOKABLE void setStretchFactor (int index, int stretchFactor)
 Modify the stretch factor of a layout element.
 
Q_INVOKABLE int stretchFactor (int index) const
 
void setStretchFactor (const QQuickItem *, int stretchFactor)
 Modify the stretch factor of an inserted item.
 
int stretchFactor (const QQuickItem *) const
 
void dump () const
 
- Public Member Functions inherited from QskIndexedLayoutBox
 QskIndexedLayoutBox (QQuickItem *parent=nullptr)
 Constructor.
 
 ~QskIndexedLayoutBox () override
 Destructor.
 
void setAutoAddChildren (bool on=true)
 En/Disable auto appending of children.
 
bool autoAddChildren () const
 
- Public Member Functions inherited from QskBox
 QskBox (QQuickItem *parent=nullptr)
 
 QskBox (bool hasPanel, QQuickItem *parent=nullptr)
 
void setPanel (bool)
 
bool hasPanel () const
 
QskBoxBorderMetrics borderMetrics () const
 
void setBorderMetrics (const QskBoxBorderMetrics &)
 
void resetBorderMetrics ()
 
QskBoxBorderColors borderColors () const
 
void setBorderColors (const QskBoxBorderColors &)
 
void resetBorderColors ()
 
QskGradient fillGradient () const
 
void setFillGradient (const QskGradient &)
 
void resetFillGradient ()
 
void setPadding (qreal)
 
void setPadding (const QMarginsF &)
 
void resetPadding ()
 
QMarginsF padding () const
 
QRectF layoutRectForSize (const QSizeF &) const override
 
- Public Member Functions inherited from QskControl
 QskControl (QQuickItem *parent=nullptr)
 
 ~QskControl () override
 
void setMargins (qreal)
 
void setMargins (qreal, qreal, qreal, qreal)
 
void setMargins (const QMarginsF &)
 
void resetMargins ()
 
QMarginsF margins () const
 
void setBackground (const QskGradient &)
 
void resetBackground ()
 
QskGradient background () const
 
void setBackgroundColor (const QColor &)
 
QRectF contentsRect () const
 
QRectF layoutRect () const
 
virtual QRectF focusIndicatorRect () const
 
virtual QRectF focusIndicatorClipRect () const
 
QRectF subControlRect (QskAspect::Subcontrol) const
 
QRectF subControlRect (const QSizeF &, QskAspect::Subcontrol) const
 
QRectF subControlContentsRect (QskAspect::Subcontrol) const
 
QRectF subControlContentsRect (const QSizeF &, QskAspect::Subcontrol) const
 
void setAutoLayoutChildren (bool)
 
bool autoLayoutChildren () const
 
void setSection (QskAspect::Section)
 
void resetSection ()
 
QskAspect::Section section () const override final
 
void setSizePolicy (QskSizePolicy)
 
void setSizePolicy (QskSizePolicy::Policy, QskSizePolicy::Policy)
 
void setSizePolicy (Qt::Orientation, QskSizePolicy::Policy)
 
QskSizePolicy sizePolicy () const
 
QskSizePolicy::Policy sizePolicy (Qt::Orientation) const
 
void setLayoutAlignmentHint (Qt::Alignment)
 
Qt::Alignment layoutAlignmentHint () const
 
void setPlacementPolicy (QskPlacementPolicy)
 
void setPlacementPolicy (QskPlacementPolicy::Policy, QskPlacementPolicy::Policy)
 
void setPlacementPolicy (Qsk::Visibilities, QskPlacementPolicy::Policy)
 
void resetPlacementPolicy ()
 
QskPlacementPolicy placementPolicy () const
 
QskPlacementPolicy::Policy placementPolicy (Qsk::Visibility) const
 
QskPlacementPolicy::Policy effectivePlacementPolicy () const
 
bool isVisibleToLayout () const
 
void setMinimumSize (const QSizeF &)
 
void setMinimumSize (qreal width, qreal height)
 
void setMinimumWidth (qreal width)
 
void setMinimumHeight (qreal height)
 
void setMaximumSize (const QSizeF &)
 
void setMaximumSize (qreal width, qreal height)
 
void setMaximumWidth (qreal width)
 
void setMaximumHeight (qreal height)
 
void setPreferredSize (const QSizeF &)
 
void setPreferredSize (qreal width, qreal height)
 
void setPreferredWidth (qreal width)
 
void setPreferredHeight (qreal height)
 
void setFixedSize (const QSizeF &)
 
void setFixedSize (qreal width, qreal height)
 
void setFixedWidth (qreal width)
 
void setFixedHeight (qreal height)
 
void setExplicitSizeHint (Qt::SizeHint, const QSizeF &)
 
void setExplicitSizeHint (Qt::SizeHint, qreal width, qreal height)
 
void resetExplicitSizeHint (Qt::SizeHint)
 
QSizeF minimumSize () const
 
QSizeF maximumSize () const
 
QSizeF preferredSize () const
 
QSizeF explicitSizeHint (Qt::SizeHint) const
 
QSizeF implicitSizeHint (Qt::SizeHint, const QSizeF &constraint) const
 
QSizeF sizeHint () const
 
qreal heightForWidth (qreal width) const
 
qreal widthForHeight (qreal height) const
 
QSizeF effectiveSizeHint (Qt::SizeHint, const QSizeF &constraint=QSizeF()) const
 
QSizeF sizeConstraint (Qt::SizeHint, const QSizeF &constraint=QSizeF()) const
 
QSizeF sizeConstraint () const
 
QLocale locale () const
 
void resetLocale ()
 
QVector< QskAspect::SubcontrolsubControls () const
 
QRectF subControlRect (const QRectF &, QskAspect::Subcontrol) const
 Calculate position and size of a subControl.
 
QRectF subControlContentsRect (const QRectF &, QskAspect::Subcontrol) const
 Calculate the inner rectangle for subControl.
 
- Public Member Functions inherited from QskItem
const char * className () const
 
bool isVisibleTo (const QQuickItem *) const
 
bool isVisibleToParent () const
 
bool hasChildItems () const
 
QRectF rect () const
 
QSizeF implicitSize () const
 
void setGeometry (qreal x, qreal y, qreal width, qreal height)
 
void setGeometry (const QPointF &, const QSizeF &)
 
QRectF geometry () const
 
void setPosition (qreal x, qreal y)
 
void setSize (qreal width, qreal height)
 
void setPolishOnResize (bool)
 
bool polishOnResize () const
 
void setPolishOnParentResize (bool)
 
bool polishOnParentResize () const
 
void setFocusPolicy (Qt::FocusPolicy)
 
Qt::FocusPolicy focusPolicy () const
 
void setTabFence (bool)
 
bool isTabFence () const
 
void setWheelEnabled (bool)
 
bool isWheelEnabled () const
 
void setLayoutMirroring (bool on, bool childrenInherit=false)
 
void resetLayoutMirroring ()
 
bool layoutMirroring () const
 
void resetUpdateFlags ()
 
UpdateFlags updateFlags () const
 
void setUpdateFlag (UpdateFlag, bool on=true)
 
void resetUpdateFlag (UpdateFlag)
 
bool testUpdateFlag (UpdateFlag) const
 
void classBegin () override
 
void componentComplete () override
 
void releaseResources () override
 
bool isPolishScheduled () const
 
bool isUpdateNodeScheduled () const
 
bool isInitiallyPainted () const
 
bool maybeUnresized () const
 
- Public Member Functions inherited from QskSkinnable
 QskSkinnable ()
 
virtual ~QskSkinnable ()
 
void setSkinlet (const QskSkinlet *)
 Set an individual skinlet to render/display the content.
 
const QskSkinletskinlet () const
 
QFont effectiveFont (QskAspect) const
 
qreal effectiveFontHeight (QskAspect) const
 
QskColorFilter effectiveGraphicFilter (QskAspect::Subcontrol) const
 
void setSubcontrolProxy (QskAspect::Subcontrol, QskAspect::Subcontrol proxy)
 
void resetSubcontrolProxy (QskAspect::Subcontrol)
 
QskAspect::Subcontrol subcontrolProxy (QskAspect::Subcontrol) const
 
bool setAnimationHint (QskAspect, QskAnimationHint)
 
QskAnimationHint animationHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool hasAnimationHint (QskAspect) const
 
bool setSkinHint (QskAspect, const QVariant &)
 Insert a hint into the local hint table.
 
bool resetSkinHint (QskAspect)
 Remove a hint from the local hint table.
 
bool moveSkinHint (QskAspect, const QVariant &)
 
bool moveSkinHint (QskAspect, const QVariant &, const QVariant &)
 
QskAnimationHint effectiveAnimation (QskAspect::Type, QskAspect::Subcontrol, QskAspect::States, QskSkinHintStatus *status=nullptr) const
 
QVariant effectiveSkinHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Find the value for a specific aspect.
 
virtual QskAspect::Variation effectiveVariation () const
 
QskSkinHintStatus hintStatus (QskAspect) const
 
QRectF subControlRect (const QRectF &, QskAspect::Subcontrol) const
 Calculate position and size of a subControl.
 
QRectF subControlContentsRect (const QRectF &, QskAspect::Subcontrol) const
 Calculate the inner rectangle for subControl.
 
QSizeF outerBoxSize (QskAspect, const QSizeF &innerBoxSize) const
 Calculate the size, when being expanded by paddings, indentations.
 
QSizeF innerBoxSize (QskAspect, const QSizeF &outerBoxSize) const
 Calculate the size, with paddings, indentations being subtracted.
 
QRectF innerBox (QskAspect, const QRectF &outerBox) const
 Calculate the rectangle, whith paddings, indentations being subtracted.
 
QRectF outerBox (QskAspect, const QRectF &innerBox) const
 Calculate the rectangle, when being expanded by paddings, indentations.
 
QMarginsF innerPadding (QskAspect, const QSizeF &) const
 Calculate the padding from attributes for the given aspect.
 
const QskSkinleteffectiveSkinlet () const
 
QskSkineffectiveSkin () const
 
void startTransition (QskAspect, QskAnimationHint, const QVariant &from, const QVariant &to)
 
void startTransition (QskAspect, int index, QskAnimationHint, const QVariant &from, const QVariant &to)
 
QskAspect::Subcontrol effectiveSubcontrol (QskAspect::Subcontrol) const
 
QskControlcontrolCast ()
 
const QskControlcontrolCast () const
 
virtual const QMetaObject * metaObject () const =0
 
void debug (QskAspect) const
 
void debug (QskAspect::State) const
 
void debug (QDebug, QskAspect) const
 
void debug (QDebug, QskAspect::State) const
 
void setSkinStates (QskAspect::States)
 
void setSkinStateFlag (QskAspect::State, bool on=true)
 
void addSkinStates (QskAspect::States)
 
void clearSkinStates (QskAspect::States)
 
bool hasSkinState (QskAspect::State) const
 
QskAspect::States skinStates () const
 
const char * skinStatesAsPrintable () const
 
const char * skinStatesAsPrintable (QskAspect::States) const
 
bool setColor (QskAspect, Qt::GlobalColor)
 Sets a color hint.
 
bool setColor (QskAspect, QRgb)
 Sets a color hint.
 
bool setColor (QskAspect, const QColor &)
 Sets a color hint.
 
bool moveColor (QskAspect, Qt::GlobalColor)
 
bool moveColor (QskAspect, QRgb)
 
bool moveColor (QskAspect, const QColor &)
 
bool resetColor (QskAspect)
 Removes a color hint from the local table.
 
QColor color (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a color hint.
 
bool setMetric (QskAspect, qreal)
 Sets a metric hint.
 
bool moveMetric (QskAspect, qreal)
 
bool resetMetric (QskAspect)
 Removes a metric hint from the local table.
 
qreal metric (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a metric hint.
 
bool setFlagHint (QskAspect, int flag)
 Sets a flag hint.
 
template<typename T >
flagHint (QskAspect, T=T()) const
 Retrieves a flag hint.
 
bool setPositionHint (QskAspect, qreal)
 
bool movePositionHint (QskAspect, qreal)
 
bool movePositionHint (QskAspect, qreal from, qreal to)
 
bool resetPositionHint (QskAspect)
 
qreal positionHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool setStrutSizeHint (QskAspect, const QSizeF &)
 Sets a metric hint.
 
bool setStrutSizeHint (QskAspect, qreal width, qreal height)
 Sets a strut size hint.
 
bool resetStrutSizeHint (QskAspect)
 Removes a strut size hint from the local table.
 
QSizeF strutSizeHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a strut size hint.
 
bool setMarginHint (QskAspect, qreal)
 Sets a margin hint.
 
bool setMarginHint (QskAspect, const QMarginsF &)
 Sets a margin hint.
 
bool resetMarginHint (QskAspect)
 Removes a margin hint from the local table.
 
QMarginsF marginHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a margin hint.
 
bool setPaddingHint (QskAspect, qreal)
 Sets a padding hint.
 
bool setPaddingHint (QskAspect, const QMarginsF &)
 Sets a padding hint.
 
bool resetPaddingHint (QskAspect)
 Removes a padding hint from the local table.
 
QMarginsF paddingHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a padding hint.
 
bool setGradientHint (QskAspect, const QskGradient &)
 Sets a gradient as color hint.
 
QskGradient gradientHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a color hint as gradient.
 
bool setBoxShapeHint (QskAspect, const QskBoxShapeMetrics &)
 Sets a shape hint.
 
bool resetBoxShapeHint (QskAspect)
 Removes a shape hint from the local table.
 
QskBoxShapeMetrics boxShapeHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a shape hint.
 
bool setBoxBorderMetricsHint (QskAspect, const QskBoxBorderMetrics &)
 Sets a border metrics hint.
 
bool resetBoxBorderMetricsHint (QskAspect)
 Removes a border metrics hint from the local table.
 
QskBoxBorderMetrics boxBorderMetricsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a border hint.
 
bool setBoxBorderColorsHint (QskAspect, const QskBoxBorderColors &)
 Sets a border colors hint.
 
bool resetBoxBorderColorsHint (QskAspect)
 Removes a border colors hint from the local table.
 
QskBoxBorderColors boxBorderColorsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves border colors hint.
 
bool setShadowMetricsHint (QskAspect, const QskShadowMetrics &)
 
bool resetShadowMetricsHint (QskAspect)
 
QskShadowMetrics shadowMetricsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool setShadowColorHint (QskAspect, const QColor &)
 
bool resetShadowColorHint (QskAspect)
 
QColor shadowColorHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
QskBoxHints boxHints (QskAspect) const
 
bool setArcMetricsHint (QskAspect, const QskArcMetrics &)
 
bool resetArcMetricsHint (QskAspect)
 
QskArcMetrics arcMetricsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool setStippleMetricsHint (QskAspect, const QskStippleMetrics &)
 
bool resetStippleMetricsHint (QskAspect)
 
QskStippleMetrics stippleMetricsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool setSpacingHint (QskAspect, qreal)
 Sets a spacing hint.
 
bool resetSpacingHint (QskAspect)
 Removes a spacing hint from the local table.
 
qreal spacingHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a spacing hint.
 
bool setAlignmentHint (QskAspect, Qt::Alignment)
 Sets an alignment hint.
 
bool resetAlignmentHint (QskAspect)
 Removes an alignment hint from the local table.
 
Qt::Alignment alignmentHint (QskAspect, Qt::Alignment=Qt::Alignment()) const
 Retrieves an alignment hint.
 
bool setTextOptionsHint (QskAspect, const QskTextOptions &)
 
bool resetTextOptionsHint (QskAspect)
 
QskTextOptions textOptionsHint (QskAspect, QskSkinHintStatus *=nullptr) const
 
bool setFontRoleHint (QskAspect, const QskFontRole &)
 Sets a font role hint.
 
bool resetFontRoleHint (QskAspect)
 Removes a font role hint from the local table.
 
QskFontRole fontRoleHint (QskAspect, QskSkinHintStatus *=nullptr) const
 Retrieves a font role hint.
 
bool setGraphicRoleHint (QskAspect, int role)
 Sets a graphic role hint.
 
bool resetGraphicRoleHint (QskAspect)
 Removes a graphic role hint from the local table.
 
int graphicRoleHint (QskAspect, QskSkinHintStatus *=nullptr) const
 A Retrieves a graphic role hint.
 
bool setSymbolHint (const QskAspect, const QskGraphic &)
 
bool resetSymbolHint (const QskAspect)
 
QskGraphic symbolHint (const QskAspect, QskSkinHintStatus *=nullptr) const
 
const QskSkinHintTablehintTable () const
 Accessor for local skin hint table.
 
bool startHintTransitions (QskAspect::States, QskAspect::States, int index=-1)
 
bool startHintTransitions (const QVector< QskAspect::Subcontrol > &, QskAspect::States, QskAspect::States, int index=-1)
 
const QskHintAnimatorrunningHintAnimator (QskAspect, int index=-1) const
 

Public Slots

void transpose ()
 Invert the orientation of the layout.
 
void activate ()
 
void invalidate ()
 
void clear (bool autoDelete=false)
 
- Public Slots inherited from QskControl
void setLocale (const QLocale &)
 
- Public Slots inherited from QskItem
void setGeometry (const QRectF &)
 
void show ()
 
void hide ()
 
void setHidden (bool)
 
void setDisabled (bool)
 
void resetImplicitSize ()
 

Signals

void orientationChanged ()
 
void dimensionChanged ()
 
void defaultAlignmentChanged ()
 
void spacingChanged ()
 
void extraSpacingAtChanged ()
 
- Signals inherited from QskIndexedLayoutBox
void autoAddChildrenChanged ()
 
- Signals inherited from QskBox
void panelChanged (bool)
 
void borderMetricsChanged (const QskBoxBorderMetrics &)
 
void borderColorsChanged (const QskBoxBorderColors &)
 
void fillGradientChanged (const QskGradient &)
 
void paddingChanged (const QMarginsF &)
 
- Signals inherited from QskControl
void backgroundChanged ()
 
void sectionChanged (QskAspect::Section)
 
void marginsChanged (const QMarginsF &)
 
void focusIndicatorRectChanged ()
 
void localeChanged (const QLocale &)
 
- Signals inherited from QskItem
void wheelEnabledChanged (bool)
 
void focusPolicyChanged (Qt::FocusPolicy)
 
void itemFlagsChanged ()
 
void updateFlagsChanged (UpdateFlags)
 

Protected Member Functions

bool event (QEvent *) override
 
void geometryChangeEvent (QskGeometryChangeEvent *) override
 
void itemChange (ItemChange, const ItemChangeData &) override
 
void updateLayout () override
 
QSizeF layoutSizeHint (Qt::SizeHint, const QSizeF &) const override
 
- Protected Member Functions inherited from QskIndexedLayoutBox
void itemChange (ItemChange, const ItemChangeData &) override
 
void reparentItem (QQuickItem *)
 
void unparentItem (QQuickItem *)
 
- Protected Member Functions inherited from QskControl
bool event (QEvent *) override
 
virtual void gestureEvent (QskGestureEvent *)
 
void hoverEnterEvent (QHoverEvent *) override
 
void hoverLeaveEvent (QHoverEvent *) override
 
bool childMouseEventFilter (QQuickItem *, QEvent *) override
 
void itemChange (ItemChange, const ItemChangeData &) override
 
void geometryChange (const QRectF &, const QRectF &) override
 
void initSizePolicy (QskSizePolicy::Policy, QskSizePolicy::Policy)
 
virtual void updateResources ()
 
virtual QSizeF contentsSizeHint (Qt::SizeHint, const QSizeF &) const
 
- Protected Member Functions inherited from QskItem
 QskItem (QskItemPrivate &, QQuickItem *=nullptr)
 
bool event (QEvent *) override
 
virtual void changeEvent (QEvent *)
 
virtual void windowChangeEvent (QskWindowChangeEvent *)
 
void mouseUngrabEvent () override
 
void touchUngrabEvent () override
 
void itemChange (ItemChange, const ItemChangeData &) override
 
void geometryChange (const QRectF &, const QRectF &) override
 
virtual void aboutToShow ()
 
- Protected Member Functions inherited from QskSkinnable
virtual void updateNode (QSGNode *)
 
virtual bool isTransitionAccepted (QskAspect) const
 Additional check if an transition should be started.
 
virtual QskAspect::Subcontrol substitutedSubcontrol (QskAspect::Subcontrol) const
 
QskSkinHintTablehintTable ()
 Accessor for local skin hint table.
 

Additional Inherited Members

- Public Types inherited from QskItem
enum  UpdateFlag {
  DeferredUpdate = 1 << 0 , DeferredPolish = 1 << 1 , DeferredLayout = 1 << 2 , CleanupOnVisibility = 1 << 3 ,
  PreferRasterForTextures = 1 << 4 , DebugForceBackground = 1 << 7
}
 
- Static Public Attributes inherited from QskBox
static const QskAspect::Subcontrol Panel
 
- Static Public Attributes inherited from QskControl
static const QskAspect::Subcontrol Background
 
static const QskAspect::State Disabled
 
static const QskAspect::State Hovered
 
static const QskAspect::State Focused
 

Constructor & Destructor Documentation

◆ QskLinearBox() [1/3]

QskLinearBox::QskLinearBox ( QQuickItem *  parent = nullptr)
explicit

Create a row layout.

The orientation is set to Qt::Horizontal orientation having an unlimited dimension.

Parameters
parentParent item
See also
orientation, dimension

Definition at line 51 of file QskLinearBox.cpp.

◆ QskLinearBox() [2/3]

QskLinearBox::QskLinearBox ( Qt::Orientation  orientation,
QQuickItem *  parent = nullptr 
)
explicit

Create a row or column layout.

The dimension is unlimited.

Parameters
orientationQt::Horizontal or Qt::Vertical
parentParent item
See also
orientation, dimension

Definition at line 56 of file QskLinearBox.cpp.

◆ QskLinearBox() [3/3]

QskLinearBox::QskLinearBox ( Qt::Orientation  orientation,
uint  dimension,
QQuickItem *  parent = nullptr 
)

Constructor.

Parameters
orientationQt::Horizontal or Qt::Vertical
dimensionUpper limit for the number of elements in a row or column
parentParent item
See also
orientation, dimension

Definition at line 61 of file QskLinearBox.cpp.

◆ ~QskLinearBox()

QskLinearBox::~QskLinearBox ( )
override

Destructor

Definition at line 67 of file QskLinearBox.cpp.

Member Function Documentation

◆ activate

void QskLinearBox::activate ( )
slot

Definition at line 174 of file QskLinearBox.cpp.

◆ addItem() [1/2]

int QskLinearBox::addItem ( QQuickItem *  item)

Definition at line 387 of file QskLinearBox.cpp.

◆ addItem() [2/2]

int QskLinearBox::addItem ( QQuickItem *  item,
Qt::Alignment  alignment 
)

Definition at line 382 of file QskLinearBox.cpp.

◆ addSpacer()

int QskLinearBox::addSpacer ( qreal  spacing,
int  stretchFactor = 0 
)

Append a spacer to the layout.

The same as insertSpacer( -1, spacing, stretchFactor );

Parameters
spacingSpacing
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
See also
insertSpacer()

Definition at line 476 of file QskLinearBox.cpp.

◆ addStretch()

int QskLinearBox::addStretch ( int  stretchFactor = 0)

Append a stretch to the layout.

The same as insertStretch( -1, stretchFactor );

Parameters
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
See also
insertStretch(), addSpacer()

Definition at line 503 of file QskLinearBox.cpp.

◆ autoAddItem()

void QskLinearBox::autoAddItem ( QQuickItem *  item)
finaloverrideprivatevirtual

Implements QskIndexedLayoutBox.

Definition at line 164 of file QskLinearBox.cpp.

◆ autoRemoveItem()

void QskLinearBox::autoRemoveItem ( QQuickItem *  item)
finaloverrideprivatevirtual

Implements QskIndexedLayoutBox.

Definition at line 169 of file QskLinearBox.cpp.

◆ clear

void QskLinearBox::clear ( bool  autoDelete = false)
slot

Definition at line 137 of file QskLinearBox.cpp.

◆ defaultAlignment()

Qt::Alignment QskLinearBox::defaultAlignment ( ) const

Definition at line 333 of file QskLinearBox.cpp.

◆ dimensionChanged

void QskLinearBox::dimensionChanged ( )
signal

The dimension of the layout has changed

See also
setDimension(), dimension()

◆ dump()

void QskLinearBox::dump ( ) const

Definition at line 539 of file QskLinearBox.cpp.

◆ elementCount()

int QskLinearBox::elementCount ( ) const

Definition at line 85 of file QskLinearBox.cpp.

◆ event()

bool QskLinearBox::event ( QEvent *  event)
overrideprotected

Definition at line 245 of file QskLinearBox.cpp.

◆ extraSpacingAt()

Qt::Edges QskLinearBox::extraSpacingAt ( ) const

Definition at line 377 of file QskLinearBox.cpp.

◆ geometryChangeEvent()

void QskLinearBox::geometryChangeEvent ( QskGeometryChangeEvent )
overrideprotectedvirtual

For no known reason QQuickItem propagates changes of position and size by calling QQuickItem::geometryChange(), instead of using events.

QskItem reestablished the more powerful concept of events by sending/posting events, that can be preprocessed by event filtering.

Parameters
eventEvent indicating the geometry change
See also
geometryChange()
QObject::installEventFilter()

Reimplemented from QskItem.

Definition at line 222 of file QskLinearBox.cpp.

◆ indexOf()

int QskLinearBox::indexOf ( const QQuickItem *  item) const

Definition at line 100 of file QskLinearBox.cpp.

◆ insertItem() [1/2]

int QskLinearBox::insertItem ( int  index,
QQuickItem *  item 
)

Definition at line 401 of file QskLinearBox.cpp.

◆ insertItem() [2/2]

int QskLinearBox::insertItem ( int  index,
QQuickItem *  item,
Qt::Alignment  alignment 
)

Definition at line 392 of file QskLinearBox.cpp.

◆ insertSpacer()

int QskLinearBox::insertSpacer ( int  index,
qreal  spacing,
int  stretchFactor = 0 
)

Insert a spacer at a specific position.

Spacers being inserted to the layout are elements having an index - like regular QQuickItem *s and participate in the calculation of the geometries.

A spacer is treated like being an item with a preferred width/height of spacing. In case of having a stretchFactor > 0 the width/height might exceed spacing.

Parameters
indexPosition, where to insert the spacer. If index is < 0 or beyond QskLayout::itemCount() the spacer will be appended.
spacingSpacing Minimum for width/height
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
Note
Calling QskLayout::itemAtIndex( index ) will return a nullptr.
See also
insertItem(), QskLayout::itemAtIndex()

Definition at line 481 of file QskLinearBox.cpp.

◆ insertStretch()

int QskLinearBox::insertStretch ( int  index,
int  stretchFactor = 0 
)

Insert a stretch at a specific position.

A stretch is simply a spacer with a spacing of 0

Parameters
indexPosition, where to insert the stretch. If index is < 0 or beyond QskLayout::itemCount() the stretch will be appended.
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
Note
Calling QskLayout::itemAtIndex( index ) will return a nullptr.
See also
insertSpacer(), QskLayout::itemAtIndex()

Definition at line 508 of file QskLinearBox.cpp.

◆ invalidate

void QskLinearBox::invalidate ( )
slot

Definition at line 179 of file QskLinearBox.cpp.

◆ isEmpty()

bool QskLinearBox::isEmpty ( ) const
inline

Definition at line 122 of file QskLinearBox.h.

◆ itemAtIndex()

QQuickItem * QskLinearBox::itemAtIndex ( int  index) const

Definition at line 95 of file QskLinearBox.cpp.

◆ itemChange()

void QskLinearBox::itemChange ( ItemChange  change,
const ItemChangeData &  value 
)
overrideprotected

Definition at line 231 of file QskLinearBox.cpp.

◆ layoutSizeHint()

QSizeF QskLinearBox::layoutSizeHint ( Qt::SizeHint  which,
const QSizeF &  constraint 
) const
overrideprotectedvirtual

Reimplemented from QskControl.

Definition at line 210 of file QskLinearBox.cpp.

◆ orientation()

Qt::Orientation QskLinearBox::orientation ( ) const
Returns
Value of the orientation property

Definition at line 299 of file QskLinearBox.cpp.

◆ orientationChanged

void QskLinearBox::orientationChanged ( )
signal

The orientation of the layout has changed

See also
orientation

◆ removeAt()

void QskLinearBox::removeAt ( int  index)

Definition at line 105 of file QskLinearBox.cpp.

◆ removeItem()

void QskLinearBox::removeItem ( const QQuickItem *  item)

Definition at line 132 of file QskLinearBox.cpp.

◆ resetSpacing()

void QskLinearBox::resetSpacing ( )

Reset the global spacing to its initial value.

See also
spacing

Definition at line 354 of file QskLinearBox.cpp.

◆ setDefaultAlignment()

void QskLinearBox::setDefaultAlignment ( Qt::Alignment  alignment)

Definition at line 327 of file QskLinearBox.cpp.

◆ setDimension()

void QskLinearBox::setDimension ( uint  dimension)

Set the dimension of the layout.

Parameters
dimensionUpper limit for the number of elements in a row or column
Warning
A value of 0 is invalid and will be set to 1
See also
dimension

Definition at line 272 of file QskLinearBox.cpp.

◆ setExtraSpacingAt()

void QskLinearBox::setExtraSpacingAt ( Qt::Edges  edges)

Definition at line 366 of file QskLinearBox.cpp.

◆ setOrientation()

void QskLinearBox::setOrientation ( Qt::Orientation  orientation)

Set the orientation of the layout.

Parameters
orientationQt::Vertical or Qt::Horizontal
See also
orientation

Definition at line 288 of file QskLinearBox.cpp.

◆ setSpacing()

void QskLinearBox::setSpacing ( qreal  spacing)

Set the global spacing of the layout.

Parameters
spacingDistance between each cell and row
See also
spacing

Definition at line 338 of file QskLinearBox.cpp.

◆ setStretchFactor() [1/2]

void QskLinearBox::setStretchFactor ( const QQuickItem *  item,
int  stretchFactor 
)

Modify the stretch factor of an inserted item.

Parameters
itemInserted item
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
See also
stretchFactor()

Definition at line 529 of file QskLinearBox.cpp.

◆ setStretchFactor() [2/2]

void QskLinearBox::setStretchFactor ( int  index,
int  stretchFactor 
)

Modify the stretch factor of a layout element.

Parameters
indexPosition of the element
stretchFactorA value between [0..10]. The ratio of the stretch factors of expandable candidates decides about how to distribute extra space.
See also
stretchFactor()

Definition at line 513 of file QskLinearBox.cpp.

◆ spacingAtIndex()

qreal QskLinearBox::spacingAtIndex ( int  index) const

Definition at line 90 of file QskLinearBox.cpp.

◆ spacingChanged

void QskLinearBox::spacingChanged ( )
signal

The spacing of the layout has changed

See also
setSpacing(), spacing(), setRowSpacing(), setColumnSpacing()

◆ stretchFactor() [1/2]

int QskLinearBox::stretchFactor ( const QQuickItem *  item) const
Parameters
itemInserted item
Returns
Stretch factor of a layout element
See also
setStretchFactor()

Definition at line 534 of file QskLinearBox.cpp.

◆ stretchFactor() [2/2]

int QskLinearBox::stretchFactor ( int  index) const
Parameters
indexPosition of the inserted element
Returns
Stretch factor of a layout element
See also
setStretchFactor()

Definition at line 524 of file QskLinearBox.cpp.

◆ transpose

void QskLinearBox::transpose ( )
slot

Invert the orientation of the layout.

Qt::Horizontal becomes to Qt::Vertical and v.v.

See also
setOrientation(), orientation(), orientationChanged()

Definition at line 304 of file QskLinearBox.cpp.

◆ updateLayout()

void QskLinearBox::updateLayout ( )
overrideprotectedvirtual

Reimplemented from QskControl.

Definition at line 204 of file QskLinearBox.cpp.

Property Documentation

◆ defaultAlignment

Qt::Alignment QskLinearBox::defaultAlignment
readwrite

Definition at line 24 of file QskLinearBox.h.

◆ dimension

uint QskLinearBox::dimension
readwrite

Upper limit for the number of elements in a row or column.

According to the orientation the layout is organized in rows or columns. The dimension is an upper limit for the number of elements in a row/column.

When the number of elements exceeds the dimension the following element will be inserted in the following row/column.

See also
orientation
Access functions:
dimension(), setDimension(), dimensionChanged()
Returns
Value of the dimension property const

Definition at line 18 of file QskLinearBox.h.

◆ elementCount

int QskLinearBox::elementCount
read

Definition at line 30 of file QskLinearBox.h.

◆ empty

bool QskLinearBox::empty
read

Definition at line 31 of file QskLinearBox.h.

◆ extraSpacingAt

Qt::Edges QskLinearBox::extraSpacingAt
readwrite

Definition at line 27 of file QskLinearBox.h.

◆ orientation

Qt::Orientation QskLinearBox::orientation
readwrite

Direction of flow for laying out the items.

In case of Qt::Horizontal the elements are organized horizontally increasing the column index, when appending an item. When the number of columns exceeds the dimension the next item will be in the first column of the next row ( v.v for Qt::Vertical ).

The horizontal layout direction is affected by its state of QskControl::layoutMirroring(), what might depend on the QskControl::locale().

See also
transpose(), dimension
Access functions:
orientation(), setOrientation(), orientationChanged()

Definition at line 15 of file QskLinearBox.h.

◆ spacing

qreal QskLinearBox::spacing
readwrite

Global layout spacing.

The spacing is the distance between each cell and row of the layout. Its initial value depend on the current theme.

Beside setting the global spacing it is also possible to add individual spacings at the end of each row and column.

Note
In opposite to a spacer, the global spacing does not insert elements.
See also
setRowSpacing(), setColumnSpacing(), insertSpacer(), QskControl::setMargins()
Access functions:
spacing(), setSpacing(), spacingChanged()
Returns
Value of the spacing property

Definition at line 21 of file QskLinearBox.h.