Commit 05e492cf authored by Jan Arve Saether's avatar Jan Arve Saether Committed by The Qt Project
Browse files

Fixed a bug where a rearrange was not always done


This happened only when the size of the layout didn't change.

Task-number: QTBUG-31570

Change-Id: Ia090c0062fa8fc3eb6f648592529ee8fcd025593
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@digia.com>
parent 6694cbab
6.2 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 dev old/5.1 old/5.2 wip/calendar wip/tizen v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1
No related merge requests found
Showing with 56 additions and 2 deletions
...@@ -112,8 +112,16 @@ public: ...@@ -112,8 +112,16 @@ public:
void setGeometry(const QRectF &rect) void setGeometry(const QRectF &rect)
{ {
const QRect r(rect.toRect()); const QRect r(rect.toRect());
const QSize newSize(r.size());
m_item->setPosition(r.topLeft()); m_item->setPosition(r.topLeft());
m_item->setSize(r.size()); QSizeF oldSize(m_item->width(), m_item->height());
if (newSize == oldSize) {
if (QQuickLayout *lay = qobject_cast<QQuickLayout *>(m_item))
if (lay->arrangementIsDirty())
lay->rearrange(newSize);
} else {
m_item->setSize(newSize);
}
} }
QQuickItem *layoutItem() const { return m_item; } QQuickItem *layoutItem() const { return m_item; }
......
...@@ -77,9 +77,10 @@ public: ...@@ -77,9 +77,10 @@ public:
void componentComplete(); void componentComplete();
virtual QSizeF sizeHint(Qt::SizeHint whichSizeHint) const = 0; virtual QSizeF sizeHint(Qt::SizeHint whichSizeHint) const = 0;
virtual void invalidate(QQuickItem * childItem = 0); virtual void invalidate(QQuickItem * childItem = 0);
virtual void rearrange(const QSizeF &);
bool arrangementIsDirty() const { return m_dirty; }
protected: protected:
bool event(QEvent *e); bool event(QEvent *e);
virtual void rearrange(const QSizeF &);
enum Orientation { enum Orientation {
Vertical = 0, Vertical = 0,
......
...@@ -658,5 +658,50 @@ Item { ...@@ -658,5 +658,50 @@ Item {
layout.visible = false layout.visible = false
layout.destroy() // Do not crash layout.destroy() // Do not crash
} }
Component {
id: rearrangeNestedLayouts_Component
RowLayout {
id: layout
anchors.fill: parent
width: 200
height: 20
RowLayout {
id: row
spacing: 0
Rectangle {
id: fixed
color: 'red'
implicitWidth: 20
implicitHeight: 20
}
Rectangle {
id: filler
color: 'grey'
Layout.fillWidth: true
implicitHeight: 20
}
}
}
}
function test_rearrangeNestedLayouts()
{
var layout = rearrangeNestedLayouts_Component.createObject(container)
var fixed = layout.children[0].children[0]
var filler = layout.children[0].children[1]
compare(itemRect(fixed), [0,0,20,20])
compare(itemRect(filler), [20,0,180,20])
fixed.implicitWidth = 100
wait(20); // wait for at least 20 ms (this matches the time between two frame
// repaints for 50hz displays)
compare(itemRect(fixed), [0,0,100,20])
compare(itemRect(filler), [100,0,100,20])
}
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment