From 0102413396c91e97ed856235cd1a52f7185c4862 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 May 2012 14:02:14 +1000 Subject: Augment performance docs Change-Id: I5721b5b567712818462b51a85c7710bc6a08746b Reviewed-by: Michael Brasser --- doc/src/qml/performance.qdoc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'doc/src') diff --git a/doc/src/qml/performance.qdoc b/doc/src/qml/performance.qdoc index 91c9bbbbd7..da9a66cbec 100644 --- a/doc/src/qml/performance.qdoc +++ b/doc/src/qml/performance.qdoc @@ -599,6 +599,30 @@ Rectangle { } \endcode +Note that this is still not as efficient as specifying a static size, so you should still specify static sizes via +the x, y, width and height properties. + +Item coordinates are always relative to their parent, so if you wanted to be a fixed offset from your parent's +0,0 coordinate you should not use anchors. For example the following items are in the same place, but the anchors +code is not as resource efficient as fixed positioning. + +\code +Rectangle { + width: 60 + height: 60 + Rectangle { + x: 20 + y: 20 + width: 20 + height: 20 + } + Rectangle { + anchors.fill: parent + anchors.margins: 20 + } +} +\endcode + \section1 Models and Views Most applications will have at least one model feeding data to a view. There are -- cgit v1.2.3