aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/src/concepts/positioning/topic.qdoc
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2012-07-03 11:45:26 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-05 01:47:53 +0200
commit422033971f5d74b8ed7dcf3492379403d4d0eb3d (patch)
tree0b4e599f47fae7ec482e06bc34091c29c9853ab1 /src/quick/doc/src/concepts/positioning/topic.qdoc
parent7481adc7d72665de7873b99f58764f2a6b906c9c (diff)
Reorganize "concept" pages in QtQuick docs
This removes concepts/topic.qdoc and move this content into individual concept topic pages under individual directories for each concept to avoid having a really long "concepts" index page. This change also: - Moves components.qdoc ("Defining reusable components") into the appdevguide/ since it's not specific to QtQuick features - it's more about how to use a QtQml feature to build QML apps. - Moves the part of qtqml/doc/src/cppintegration/data.qdoc that discusses how to use C++ models with QtQuick views into quick/doc/src/concepts/modelviewsdata/data-cppmodels.qdoc. Change-Id: Id18a1d56acaaac41714c13cbc94bb3b80f337355 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/quick/doc/src/concepts/positioning/topic.qdoc')
-rw-r--r--src/quick/doc/src/concepts/positioning/topic.qdoc169
1 files changed, 169 insertions, 0 deletions
diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc
new file mode 100644
index 0000000000..6c44e66f31
--- /dev/null
+++ b/src/quick/doc/src/concepts/positioning/topic.qdoc
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qtquick-positioning-topic.html
+\title Important Concepts In Qt Quick - Positioning
+\brief Overview of positioning concepts
+
+Visual items in QML can be positioned in a variety of ways. The most important
+positioning-related concept is that of anchoring, a form of relative
+positioning where items can be anchored (or attached) to each other at certain
+boundaries. Other positioning concepts include absolute positioning,
+positioning with coordinate bindings, and layouts.
+
+
+\section1 Manual Positioning
+
+Items can be positioned manually. If the user-interface is going to be
+static, manual positioning provides the most efficient form of positioning.
+
+In any user-interface, the visual elements exist at a particular location in
+the screen coordinates at any instant in time. While fluidly animated and
+dynamic user-interfaces are a major focus of Qt Quick, statically-positioned
+user interfaces are still a viable option. What's more, if the position of
+those elements does not change, it can often be more performant to specify
+the position manually than to use the more dynamic positioning methods
+documented in proceeding sections.
+
+In Qt Quick, every visual object is positioned within the
+\l{qtquick-visual-coordinates.html}{coordinate system}
+provided by the Qt Quick visual canvas. As described in that document, the
+x and y coordinates of a visual object are relative to those of its visual
+parent, with the top-left corner have the value [0, 0].
+
+Thus, the following example will display three rectangles positioned manually:
+
+\table
+ \header
+ \li Example Code
+ \li Resultant Layout
+
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+
+ Rectangle {
+ id: r1
+ x: 0
+ y: 0
+ width: 200
+ height: 200
+
+ Rectangle {
+ id: r2
+ x: 0
+ y: 100
+ width: 100
+ height: 100
+ }
+
+ Rectangle {
+ id: r3
+ x: 100
+ y: 100
+ width: 50
+ height: 100
+ }
+ }
+ \endqml
+ \li
+ \image manual-layout.png
+\endtable
+
+\section1 Positioning With Bindings
+
+Items may also be positioned by assigning binding expressions to the properties
+associated with their location in the visual canvas. This type of positioning
+is the most highly dynamic, however some performance cost is associated with
+positioning items in this manner.
+
+The position and dimensions of a visual object can also be set through property
+bindings. This has the advantage that the values will automatically be updated
+as the dependencies of the bindings change. For example, the width of one
+Rectangle might depend on the width of the Rectangle next to it.
+
+While bindings provide a very flexible and intuitive way of creating dynamic
+layouts, it should be noted that there is some performance cost associated with
+them, and where possible, pristine Anchor layouts should be preferred.
+
+
+\section1 Anchors
+
+Anchors allows an item to be placed either adjacent to or inside of another,
+by attaching one or more of the item's anchor-points (boundaries) to an
+anchor-point of the other. These anchors will remain even if the dimensions
+or location of one of the items changes, allowing for highly dynamic
+user-interfaces.
+
+A visual object can be thought of as having various anchor-points (or more
+correctly, anchor-lines). Other items can be anchored to those points, which
+means that as any object changes, the other objects which are anchored to it
+will adjust automatically to maintain the anchoring.
+
+Qt Quick provides anchors as a top-level concept. See the documentation about
+\l{qtquick-positioning-anchors.html}{positioning with anchors}
+for in-depth information on the topic.
+
+It is important to note that anchor-based layouts are generally far more
+performant than binding-based layouts, if pristine. A "pristine" anchor layout
+is one which uses only anchors (with object nesting) to determine the
+positioning, whereas a "contaminated" anchor layout is one which uses both
+anchoring and bindings (either on position-related [x,y] properties or on
+dimension-related [width,height] properties) to determine the position.
+
+\section1 Layouts
+
+Qt Quick also provides some built-in layout items. For many use cases, the
+best layout to use is a simple grid, row, or column, and Qt Quick provides
+items which will layout children in these formations in the most efficient
+manner possible.
+
+There are many well-known layouts which work well in user-interfaces, such as
+grids and lists, rows and columns. Qt Quick supports these sort of pre-defined
+layouts, which can often be more performant to draw than anchor or
+binding-based layouts. See the documentation on
+\l{qtquick-positioning-layouts.html}{layout elements} for more
+information about utilizing pre-defined layouts.
+
+
+
+\section1 Right-To-Left Support
+
+The directionality of the written form of a language often has a great impact
+on how the visual elements of a user-interface should be positioned. Qt Quick
+supports right-to-left positioning of elements through the predefined-layouts
+as well as right-to-left text layouts.
+
+Please see the documentation about
+\l{qtquick-positioning-righttoleft.html}
+{right-to-left support in Qt Quick} for in-depth information on the topic.
+
+
+*/
+