mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
QFormLayout cleanup
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
5aa772683e
commit
72914c9715
2 changed files with 20 additions and 25 deletions
|
@ -51,7 +51,6 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace {
|
|
||||||
// Fixed column matrix, stores items as [i11, i12, i21, i22...],
|
// Fixed column matrix, stores items as [i11, i12, i21, i22...],
|
||||||
// with FORTRAN-style index operator(r, c).
|
// with FORTRAN-style index operator(r, c).
|
||||||
template <class T, int NumColumns>
|
template <class T, int NumColumns>
|
||||||
|
@ -120,12 +119,6 @@ void FixedColumnMatrix<T, NumColumns>::storageIndexToPosition(int idx, int *rowP
|
||||||
*rowPtr = idx / NumColumns;
|
*rowPtr = idx / NumColumns;
|
||||||
*colPtr = idx % NumColumns;
|
*colPtr = idx % NumColumns;
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// special values for unset fields; must not clash with values of FieldGrowthPolicy or
|
|
||||||
// RowWrapPolicy
|
|
||||||
const uint DefaultFieldGrowthPolicy = 255;
|
|
||||||
const uint DefaultRowWrapPolicy = 255;
|
|
||||||
|
|
||||||
enum { FormColumnCount = 2 };
|
enum { FormColumnCount = 2 };
|
||||||
|
|
||||||
|
@ -208,13 +201,13 @@ public:
|
||||||
void recalcHFW(int w);
|
void recalcHFW(int w);
|
||||||
void setupHfwLayoutData();
|
void setupHfwLayoutData();
|
||||||
|
|
||||||
uint fieldGrowthPolicy : 8;
|
QFormLayout::FieldGrowthPolicy fieldGrowthPolicy;
|
||||||
uint rowWrapPolicy : 8;
|
QFormLayout::RowWrapPolicy rowWrapPolicy;
|
||||||
uint has_hfw : 2;
|
bool has_hfw;
|
||||||
uint dirty : 2; // have we laid out yet?
|
bool dirty; // have we laid out yet?
|
||||||
uint sizesDirty : 2; // have we (not) gathered layout item sizes?
|
bool sizesDirty; // have we (not) gathered layout item sizes?
|
||||||
uint expandVertical : 1; // Do we expand vertically?
|
bool expandVertical; // Do we expand vertically?
|
||||||
uint expandHorizontal : 1; // Do we expand horizonally?
|
bool expandHorizontal; // Do we expand horizonally?
|
||||||
Qt::Alignment labelAlignment;
|
Qt::Alignment labelAlignment;
|
||||||
Qt::Alignment formAlignment;
|
Qt::Alignment formAlignment;
|
||||||
|
|
||||||
|
@ -249,9 +242,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
QFormLayoutPrivate::QFormLayoutPrivate()
|
QFormLayoutPrivate::QFormLayoutPrivate()
|
||||||
: fieldGrowthPolicy(DefaultFieldGrowthPolicy),
|
: fieldGrowthPolicy(QFormLayout::StyleHintGrowth),
|
||||||
rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true),
|
rowWrapPolicy(QFormLayout::StyleHintWrap), has_hfw(false), dirty(true), sizesDirty(true),
|
||||||
expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0),
|
expandVertical(false), expandHorizontal(false), labelAlignment(0), formAlignment(0),
|
||||||
layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1),
|
layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1),
|
||||||
sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1)
|
sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1)
|
||||||
{
|
{
|
||||||
|
@ -1698,7 +1691,7 @@ QWidget *QFormLayout::labelForField(QLayout *field) const
|
||||||
void QFormLayout::setFieldGrowthPolicy(FieldGrowthPolicy policy)
|
void QFormLayout::setFieldGrowthPolicy(FieldGrowthPolicy policy)
|
||||||
{
|
{
|
||||||
Q_D(QFormLayout);
|
Q_D(QFormLayout);
|
||||||
if (FieldGrowthPolicy(d->fieldGrowthPolicy) != policy) {
|
if (d->fieldGrowthPolicy != policy) {
|
||||||
d->fieldGrowthPolicy = policy;
|
d->fieldGrowthPolicy = policy;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
@ -1707,10 +1700,10 @@ void QFormLayout::setFieldGrowthPolicy(FieldGrowthPolicy policy)
|
||||||
QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const
|
QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const
|
||||||
{
|
{
|
||||||
Q_D(const QFormLayout);
|
Q_D(const QFormLayout);
|
||||||
if (d->fieldGrowthPolicy == DefaultFieldGrowthPolicy) {
|
if (d->fieldGrowthPolicy == QFormLayout::StyleHintGrowth) {
|
||||||
return QFormLayout::FieldGrowthPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutFieldGrowthPolicy));
|
return QFormLayout::FieldGrowthPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutFieldGrowthPolicy));
|
||||||
} else {
|
} else {
|
||||||
return QFormLayout::FieldGrowthPolicy(d->fieldGrowthPolicy);
|
return d->fieldGrowthPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1731,7 +1724,7 @@ QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const
|
||||||
void QFormLayout::setRowWrapPolicy(RowWrapPolicy policy)
|
void QFormLayout::setRowWrapPolicy(RowWrapPolicy policy)
|
||||||
{
|
{
|
||||||
Q_D(QFormLayout);
|
Q_D(QFormLayout);
|
||||||
if (RowWrapPolicy(d->rowWrapPolicy) != policy) {
|
if (d->rowWrapPolicy != policy) {
|
||||||
d->rowWrapPolicy = policy;
|
d->rowWrapPolicy = policy;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
@ -1740,10 +1733,10 @@ void QFormLayout::setRowWrapPolicy(RowWrapPolicy policy)
|
||||||
QFormLayout::RowWrapPolicy QFormLayout::rowWrapPolicy() const
|
QFormLayout::RowWrapPolicy QFormLayout::rowWrapPolicy() const
|
||||||
{
|
{
|
||||||
Q_D(const QFormLayout);
|
Q_D(const QFormLayout);
|
||||||
if (d->rowWrapPolicy == DefaultRowWrapPolicy) {
|
if (d->rowWrapPolicy == QFormLayout::StyleHintWrap) {
|
||||||
return QFormLayout::RowWrapPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutWrapPolicy));
|
return QFormLayout::RowWrapPolicy(d->getStyle()->styleHint(QStyle::SH_FormLayoutWrapPolicy));
|
||||||
} else {
|
} else {
|
||||||
return QFormLayout::RowWrapPolicy(d->rowWrapPolicy);
|
return d->rowWrapPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2026,7 +2019,7 @@ void QFormLayout::setItem(int row, ItemRole role, QLayoutItem *item)
|
||||||
void QFormLayout::resetFieldGrowthPolicy()
|
void QFormLayout::resetFieldGrowthPolicy()
|
||||||
{
|
{
|
||||||
Q_D(QFormLayout);
|
Q_D(QFormLayout);
|
||||||
d->fieldGrowthPolicy = DefaultFieldGrowthPolicy;
|
d->fieldGrowthPolicy = QFormLayout::StyleHintGrowth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -2036,7 +2029,7 @@ void QFormLayout::resetFieldGrowthPolicy()
|
||||||
void QFormLayout::resetRowWrapPolicy()
|
void QFormLayout::resetRowWrapPolicy()
|
||||||
{
|
{
|
||||||
Q_D(QFormLayout);
|
Q_D(QFormLayout);
|
||||||
d->rowWrapPolicy = DefaultRowWrapPolicy;
|
d->rowWrapPolicy = QFormLayout::StyleHintWrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -65,12 +65,14 @@ class Q_GUI_EXPORT QFormLayout : public QLayout
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FieldGrowthPolicy {
|
enum FieldGrowthPolicy {
|
||||||
|
StyleHintGrowth,
|
||||||
FieldsStayAtSizeHint,
|
FieldsStayAtSizeHint,
|
||||||
ExpandingFieldsGrow,
|
ExpandingFieldsGrow,
|
||||||
AllNonFixedFieldsGrow
|
AllNonFixedFieldsGrow
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RowWrapPolicy {
|
enum RowWrapPolicy {
|
||||||
|
StyleHintWrap,
|
||||||
DontWrapRows,
|
DontWrapRows,
|
||||||
WrapLongRows,
|
WrapLongRows,
|
||||||
WrapAllRows
|
WrapAllRows
|
||||||
|
|
Loading…
Add table
Reference in a new issue