Make the default vertical alignment configurable
This is a prerequisite of sharing the layout engine of QGraphicsLayout with the engine of QtQuick.Layouts. Change-Id: Iae566c0e51d234b836cf818b541d4284bd78bbee Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>bb10
parent
ae8948a0a9
commit
423ee63b7b
|
|
@ -800,9 +800,10 @@ void QGridLayoutRowInfo::dump(int indent) const
|
|||
}
|
||||
#endif
|
||||
|
||||
QGridLayoutEngine::QGridLayoutEngine()
|
||||
QGridLayoutEngine::QGridLayoutEngine(Qt::Alignment defaultAlignment)
|
||||
{
|
||||
m_visualDirection = Qt::LeftToRight;
|
||||
m_defaultAlignment = defaultAlignment;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
|
@ -990,6 +991,8 @@ Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layou
|
|||
// no vertical alignment, respect the row alignment
|
||||
int y = layoutItem->firstRow();
|
||||
align |= (rowAlignment(y, Qt::Vertical) & Qt::AlignVertical_Mask);
|
||||
if (!(align & Qt::AlignVertical_Mask))
|
||||
align |= (m_defaultAlignment & Qt::AlignVertical_Mask);
|
||||
}
|
||||
if (!(align & Qt::AlignHorizontal_Mask)) {
|
||||
// no horizontal alignment, respect the column alignment
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ public:
|
|||
class QGridLayoutEngine
|
||||
{
|
||||
public:
|
||||
QGridLayoutEngine();
|
||||
QGridLayoutEngine(Qt::Alignment defaultAlignment = Qt::Alignment(0));
|
||||
inline ~QGridLayoutEngine() { qDeleteAll(q_items); }
|
||||
|
||||
int rowCount(Qt::Orientation orientation) const;
|
||||
|
|
@ -430,6 +430,7 @@ private:
|
|||
QLayoutParameter<qreal> q_defaultSpacings[NOrientations];
|
||||
QGridLayoutRowInfo q_infos[NOrientations];
|
||||
Qt::LayoutDirection m_visualDirection;
|
||||
Qt::Alignment m_defaultAlignment;
|
||||
|
||||
// Lazily computed from the above user input
|
||||
mutable int q_cachedEffectiveFirstRows[NOrientations];
|
||||
|
|
|
|||
Loading…
Reference in New Issue