summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-01-26 16:22:13 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-01-26 16:22:13 (GMT)
commit8533384ded9323a0b38490ed65793abd9a62d46f (patch)
tree6faac6d1c32bebb1df0294332033bc44dc0d8ae5 /doc/src
parent834c8617dc130126c0ce5213bda36b9f62717b1e (diff)
parent5498dcd7b10e147734a3414cab824b8b435aa3d9 (diff)
downloadQt-8533384ded9323a0b38490ed65793abd9a62d46f.zip
Qt-8533384ded9323a0b38490ed65793abd9a62d46f.tar.gz
Qt-8533384ded9323a0b38490ed65793abd9a62d46f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/declarative/anchor-layout.qdoc3
-rw-r--r--doc/src/declarative/qtbinding.qdoc9
-rw-r--r--doc/src/snippets/declarative/codingconventions/photo.qml14
3 files changed, 23 insertions, 3 deletions
diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc
index e567ae1..0655fdb 100644
--- a/doc/src/declarative/anchor-layout.qdoc
+++ b/doc/src/declarative/anchor-layout.qdoc
@@ -78,6 +78,9 @@ Rectangle { id: rect3; x: 150; ... }
\image edge4.png
+There are also some convenience anchors. anchors.fill is a convenience that is the same as setting the left,right,top and bottom anchors
+to the left,right,top and bottom of the target item. anchors.centerIn is another convenience anchor, and is the same as setting the verticalCenter
+and horizontalCenter anchors to the verticalCenter and horizontalCenter of the target item.
\section1 Anchor Margins and Offsets
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 4213f66..03290aa 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -235,6 +235,10 @@ defined by C++ classes; in fact, many of the core \l {QML Elements} are implemen
C++ classes. When you create a QML object using one of these elements, you are simply creating an
instance of a QObject-based C++ class and setting its properties.
+To create a visual item that fits in with the Qt Quick elements, base your class off \l QDeclarativeItem instead of QObject directly.
+You can then implement your own painting and functionality like any other QGraphicsObject. Note that QGraphicsItem::ItemHasNoContents is set by default on QDeclarativeItem because
+it does not paint anything; you will need to clear this if your item is supposed to paint anything (as opposed to being solely for input handling or logical grouping).
+
For example, here is an \c ImageViewer class with an \c image URL property:
\snippet doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h 0
@@ -249,6 +253,11 @@ Then, any QML code loaded by your C++ application or \l{QDeclarativeExtensionPlu
\snippet doc/src/snippets/declarative/qtbinding/newelements/standalone.qml 0
+
+It is advised that you avoid using QGraphicsItem functionality beyond the properties documented in QDeclarativeItem.
+This is because the GraphicsView backend is intended to be an implementation detail for QML, so the QtQuick items can be moved to faster backends as they become available with no change from a QML perspective.
+To minimize any porting requirements for custom visual items, try to stick to the documented properties in QDeclarativeItem where possible. Properties QDeclarativeItem inherits but doesn't document are classed as implementation details; they are not officially supported and may disappear between releases.
+
Note that custom C++ types do not have to inherit from QDeclarativeItem; this is only necessary if it is
a displayable item. If the item is not displayable, it can simply inherit from QObject.
diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml
index 61e7eb7..78c5068 100644
--- a/doc/src/snippets/declarative/codingconventions/photo.qml
+++ b/doc/src/snippets/declarative/codingconventions/photo.qml
@@ -49,12 +49,20 @@ Rectangle {
signal clicked // signal declarations
- function doSomething(x) { // javascript functions
+ function doSomething(x) // javascript functions
+ {
return x + photoImage.width
}
- x: 20; y: 20; width: 200; height: 150 // object properties
- color: "gray" // try to group related properties together
+ color: "gray" // object properties
+ x: 20; y: 20; height: 150 // try to group related properties together
+ width: { // large bindings
+ if(photoImage.width > 200){
+ photoImage.width;
+ }else{
+ 200;
+ }
+ }
Rectangle { // child objects
id: border