From 42849ecec82fb289fd337fb9dc591bd48ba89b56 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 22 Oct 2009 13:00:45 +1000 Subject: Doc --- src/declarative/fx/qfxitem.cpp | 41 ++++++++++++++++++++++++++++---------- src/declarative/fx/qfxlistview.cpp | 28 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index bd94b8c..c346504 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -876,6 +876,7 @@ void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) parameter provides information about the event. */ + class QFxKeysAttachedPrivate : public QObjectPrivate { public: @@ -1194,19 +1195,13 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) /*! \qmlclass Item QFxItem \brief The Item is the most basic of all visual items in QML. - */ -/*! - \class QFxItem Item - \brief The QFxItem class is a generic QmlView item. It is the base class for all other view items. - - \qmltext - All visual items in Qt Declarative inherit from QFxItem. Although QFxItem + All visual items in Qt Declarative inherit from Item. Although Item has no visual appearance, it defines all the properties that are - common across visual items - like the x and y position, and the - width and height. \l {Keys}{Key handling} is also provided by Item. + common across visual items - such as the x and y position, the + width and height, \l {anchor-layout}{anchoring} and key handling. - QFxItem is also useful for grouping items together. + Item is also useful for grouping items together. \qml Item { @@ -1229,7 +1224,31 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) } \endqml - \endqmltext + \section1 Key Handling + + Key handling is available to all Item-based visual elements via the \l {Keys}{Keys} + attached property. The \e Keys attached property provides basic handlers such + as \l {Keys::onPressed(event)}{onPressed} and \l {Keys::onReleased(event)}{onReleased}, + as well as handlers for specific keys, such as + \l {Keys::onCancelPressed(event)}{onCancelPressed}. The example below + assigns \l {qmlfocus}{focus} to the item and handles + the Left key via the general \e onPressed handler and the Select key via the + onSelectPressed handler: + + \qml + Item { + focus: true + Keys.onPressed: { + if (event.key == Qt.Key_Left) { + print("move left"); + event.accepted = true; + } + } + Keys.onSelectPressed: print("Selected"); + } + \endqml + + See the \l {Keys}{Keys} attached property for detailed documentation. \ingroup group_coreitems */ diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 2ea1cb7..23bf573 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -907,6 +907,34 @@ QFxListView::~QFxListView() It is sometimes necessary to delay the destruction of an item until an animation completes. + + The example below ensures that the animation completes before + the item is removed from the list. + + \code + Component { + id: myDelegate + Item { + id: wrapper + ListView.onRemove: SequentialAnimation { + PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } + PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false } + } + } + } + \endcode +*/ + +//XXX change to \qmlattachedsignal when it exists. +/*! + \qmlattachedproperty void ListView::onAdd + This attached handler is called immediately after an item is added to the view. +*/ + +/*! + \qmlattachedproperty void ListView::onRemove + This attached handler is called immediately before an item is removed from the view. */ /*! -- cgit v0.12