diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-09-15 23:56:21 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-09-15 23:56:21 (GMT) |
commit | 21ecd608105ed576fd0c76b48c25e599cb160f32 (patch) | |
tree | 1b6d6b600b611869ee980008aaaf0c7829894066 /src/declarative/fx | |
parent | 6b9a5070b3806e80a937d940c959302769061826 (diff) | |
parent | d3b03a7d6c4ad023572d7099ee9f9ec3f0711d04 (diff) | |
download | Qt-21ecd608105ed576fd0c76b48c25e599cb160f32.zip Qt-21ecd608105ed576fd0c76b48c25e599cb160f32.tar.gz Qt-21ecd608105ed576fd0c76b48c25e599cb160f32.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/qfxgridview.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 42 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 7 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem_p.h | 7 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxvisualitemmodel.cpp | 8 |
7 files changed, 39 insertions, 35 deletions
diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 240ed08..996141f 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -67,7 +67,7 @@ class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable Q_PROPERTY(Flow flow READ flow WRITE setFlow) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) - Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellSizeChanged) //### columnCount, rowCount + Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellSizeChanged) Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellSizeChanged) Q_CLASSINFO("DefaultProperty", "data") diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index a2c744e..962fee2 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2575,7 +2575,7 @@ bool QFxItem::sceneEvent(QEvent *event) if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) { - activeFocusChanged(hasActiveFocus()); + focusChanged(hasFocus()); } return rv; @@ -2756,39 +2756,33 @@ bool QFxItem::heightValid() const } /*! - \qmlproperty bool Item::focus - This property indicates whether the item has has an active focus request. Set this - property to true to request active focus. -*/ - -bool QFxItem::hasFocus() const -{ - Q_D(const QFxItem); - return d->itemIsFocusedInScope; -} - -void QFxItem::setFocus(bool focus) -{ - if (focus) QGraphicsItem::setFocus(Qt::OtherFocusReason); - else QGraphicsItem::clearFocus(); -} + \qmlproperty bool Item::wantsFocus -void QFxItemPrivate::focusedInScopeChanged() + This property indicates whether the item has has an active focus request. +*/ +bool QFxItem::wantsFocus() const { - Q_Q(QFxItem); - q->focusChanged(q->hasFocus()); + return focusItem() != 0; } /*! - \qmlproperty bool Item::activeFocus - This property indicates whether the item has the active focus. + \qmlproperty bool Item::focus + This property indicates whether the item has keyboard input focus. Set this + property to true to request focus. */ - -bool QFxItem::hasActiveFocus() const +bool QFxItem::hasFocus() const { return QGraphicsItem::hasFocus(); } +void QFxItem::setFocus(bool focus) +{ + if (focus) + QGraphicsItem::setFocus(Qt::OtherFocusReason); + else + QGraphicsItem::clearFocus(); +} + /*! \reimp */ diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index c6a5311..7ec1ab2 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -89,7 +89,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) - Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL) + Q_PROPERTY(bool wantsFocus READ wantsFocus NOTIFY wantsFocusChanged) Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL) Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform) @@ -147,9 +147,9 @@ public: QRectF boundingRect() const; virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - virtual bool hasFocus() const; + bool wantsFocus() const; + bool hasFocus() const; void setFocus(bool); - bool hasActiveFocus() const; bool keepMouseGrab() const; void setKeepMouseGrab(bool); @@ -161,6 +161,7 @@ Q_SIGNALS: void baselineOffsetChanged(); void stateChanged(const QString &); void focusChanged(); + void wantsFocusChanged(); void activeFocusChanged(); void parentChanged(); diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 054bdc7..b2560ee 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -224,8 +224,11 @@ public: q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), width, height), oldGeometry); } - // Inherited from QGraphcisItemPrivate - virtual void focusedInScopeChanged(); + // Reimplemented from QGraphicsItemPrivate + virtual void subFocusItemChange() + { + emit q_func()->wantsFocusChanged(); + } }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 6fa1172..168e4c4 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1076,9 +1076,9 @@ void QFxListView::setHighlightFollowsCurrentItem(bool autoHighlight) } /*! - \qmlproperty real preferredHighlightBegin - \qmlproperty real preferredHighlightEnd - \qmlproperty bool strictlyEnforceHighlightRange + \qmlproperty real ListView::preferredHighlightBegin + \qmlproperty real ListView::preferredHighlightEnd + \qmlproperty bool ListView::strictlyEnforceHighlightRange These properties set the preferred range of the highlight (current item) within the view. diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 1e63272..e5c3138 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -64,7 +64,7 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_ENUMS(CurrentItemPositioning) Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) //### what happens if delegate is not a QFxItem? + Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QFxItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 30879a2..81fbafa 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -50,6 +50,7 @@ #include "private/qmetaobjectbuilder_p.h" #include "qmlopenmetaobject.h" #include "qmllistaccessor.h" +#include "qmlinfo.h" #include "qfxvisualitemmodel.h" #include "private/qguard_p.h" #include <QtCore/qdebug.h> @@ -750,9 +751,14 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp if (package) { QObject *o = package->part(QLatin1String(viewId)); item = qobject_cast<QFxItem *>(o); - d->m_packaged.insertMulti(item, package); + if (item) + d->m_packaged.insertMulti(item, package); } } + if (!item) { + d->m_cache.releaseItem(nobj); + qmlInfo(d->m_delegate) << "Delegate component must be Item type."; + } return item; } |