From f38b9107f95fc71ae53d43678dd1163719f64631 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 30 Jul 2009 10:52:09 +1000 Subject: More QFxItem cleanup. --- doc/src/images/declarative-transformorigin.png | Bin 17468 -> 8927 bytes src/declarative/fx/qfxitem.cpp | 35 +++++++------------------ src/declarative/fx/qfxitem.h | 19 +++++--------- src/declarative/fx/qfxitem_p.h | 4 +-- 4 files changed, 17 insertions(+), 41 deletions(-) diff --git a/doc/src/images/declarative-transformorigin.png b/doc/src/images/declarative-transformorigin.png index fbb3b9b..4af320f 100644 Binary files a/doc/src/images/declarative-transformorigin.png and b/doc/src/images/declarative-transformorigin.png differ diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 4e66f55..cc86b03 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -795,7 +795,7 @@ void QFxItem::setQml(const QUrl &qml) return; if (!d->_qml.isEmpty()) { - QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString()); + QHash::Iterator iter = d->_qmlChildren.find(d->_qml.toString()); if (iter != d->_qmlChildren.end()) (*iter)->setOpacity(0.); } @@ -808,7 +808,7 @@ void QFxItem::setQml(const QUrl &qml) return; } - QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString()); + QHash::Iterator iter = d->_qmlChildren.find(d->_qml.toString()); if (iter != d->_qmlChildren.end()) { (*iter)->setOpacity(1.); d->qmlItem = (*iter); @@ -1793,19 +1793,19 @@ QPointF QFxItemPrivate::computeTransformOrigin() const default: case QFxItem::TopLeft: return QPointF(0, 0); - case QFxItem::TopCenter: + case QFxItem::Top: return QPointF(br.width() / 2., 0); case QFxItem::TopRight: return QPointF(br.width(), 0); - case QFxItem::MiddleLeft: + case QFxItem::Left: return QPointF(0, br.height() / 2.); case QFxItem::Center: return QPointF(br.width() / 2., br.height() / 2.); - case QFxItem::MiddleRight: + case QFxItem::Right: return QPointF(br.width(), br.height() / 2.); case QFxItem::BottomLeft: return QPointF(0, br.height()); - case QFxItem::BottomCenter: + case QFxItem::Bottom: return QPointF(br.width() / 2., br.height()); case QFxItem::BottomRight: return QPointF(br.width(), br.height()); @@ -1891,13 +1891,13 @@ void QFxItem::parentChanged(QFxItem *, QFxItem *) Controls the point about which simple transforms like scale apply. \value TopLeft The top-left corner of the item. - \value TopCenter The center point of the top of the item. + \value Top The center point of the top of the item. \value TopRight The top-right corner of the item. - \value MiddleLeft The left most point of the vertical middle. + \value Left The left most point of the vertical middle. \value Center The center of the item. - \value MiddleRight The right most point of the vertical middle. + \value Right The right most point of the vertical middle. \value BottomLeft The bottom-left corner of the item. - \value BottomCenter The center point of the bottom of the item. + \value Bottom The center point of the bottom of the item. \value BottomRight The bottom-right corner of the item. */ @@ -2085,16 +2085,6 @@ bool QFxItem::hasActiveFocus() const return QGraphicsItem::hasFocus(); } -bool QFxItem::activeFocusPanel() const -{ - return false; -} - -void QFxItem::setActiveFocusPanel(bool b) -{ - Q_UNUSED(b) -} - bool QFxItem::sceneEventFilter(QGraphicsItem *w, QEvent *e) { switch(e->type()) { @@ -2129,11 +2119,6 @@ void QFxItem::setOptions(Options options, bool set) else d->options &= ~options; - if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) { - qWarning("QFxItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset."); - d->options &= ~IsFocusRealm; - } - setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); setFiltersChildEvents(d->options & ChildMouseFilter); setFlag(QGraphicsItem::ItemAcceptsInputMethod, (d->options & AcceptsInputMethods)); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index cd346a7..0ce2a11 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -124,10 +124,10 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QFxItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL) + Q_PROPERTY(QmlList *data READ data DESIGNABLE false) Q_PROPERTY(QmlList* children READ children DESIGNABLE false) Q_PROPERTY(QmlList* resources READ resources DESIGNABLE false) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) - Q_PROPERTY(QmlList *data READ data DESIGNABLE false) Q_PROPERTY(QFxContents * contents READ contents DESIGNABLE false CONSTANT FINAL) Q_PROPERTY(QmlList* states READ states DESIGNABLE false) Q_PROPERTY(QmlList* transitions READ transitions DESIGNABLE false) @@ -147,13 +147,11 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta 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(QmlList* transform READ transform DESIGNABLE false FINAL) // ## QGI/QGO - Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // ### move to QGI + Q_PROPERTY(QmlList* transform READ transform DESIGNABLE false FINAL) + Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") - typedef QHash QmlChildren; // ### - public: enum Option { NoOption = 0x00000000, MouseFilter = 0x00000001, @@ -162,15 +160,14 @@ public: MouseEvents = 0x00000008, HasContents = 0x00000010, SimpleItem = 0x00000020, - IsFocusPanel = 0x00000040, IsFocusRealm = 0x00000080, AcceptsInputMethods = 0x00000100 }; Q_DECLARE_FLAGS(Options, Option) enum TransformOrigin { - TopLeft, TopCenter, TopRight, - MiddleLeft, Center, MiddleRight, - BottomLeft, BottomCenter, BottomRight + TopLeft, Top, TopRight, + Left, Center, Right, + BottomLeft, Bottom, BottomRight }; QFxItem(QFxItem *parent = 0); @@ -185,7 +182,6 @@ public: QmlList *resources(); QFxAnchors *anchors(); - QFxContents *contents(); bool clip() const; @@ -234,9 +230,6 @@ public: virtual bool hasFocus() const; void setFocus(bool); - bool activeFocusPanel() const; - void setActiveFocusPanel(bool); - bool hasActiveFocus() const; QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 77d0673..33200e4 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -71,8 +71,6 @@ class QFxItemPrivate : public QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QFxItem) - typedef QHash QmlChildren; - public: QFxItemPrivate() : _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0), @@ -163,7 +161,7 @@ public: bool _componentComplete:1; bool _keepMouse:1; - QmlChildren _qmlChildren; + QHash _qmlChildren; struct AnchorLines { AnchorLines(QFxItem *); -- cgit v0.12