From 3c6648385e8637536292c1351ef0d52708bd07d2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 30 Jun 2009 12:55:10 +1000 Subject: Support animating dot properties. Make sure we can handle things like PropertyAnimation { property: "anchors.leftMargin" } --- src/declarative/qml/qmlmetaproperty.cpp | 30 +++++++++++++++++++ src/declarative/qml/qmlmetaproperty.h | 1 + src/declarative/util/qmlanimation.cpp | 48 +++++++++++++++++++++++-------- src/declarative/util/qmlanimation_p.h | 2 ++ src/declarative/util/qmlsetproperties.cpp | 37 +++++++----------------- src/declarative/util/qmlstate.cpp | 4 ++- src/declarative/util/qmlstate.h | 3 ++ src/declarative/util/qmlstate_p.h | 4 +++ 8 files changed, 89 insertions(+), 40 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 30e818b..682b8ad 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -1035,4 +1035,34 @@ QMetaMethod QmlMetaProperty::method() const return d->signal; } +/*! + \internal + + Creates a QmlMetaProperty for the property \a name of \a obj. Unlike + the QmlMetaProperty(QObject*, QString) constructor, this static function + will correctly handle dot properties. +*/ +QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, const QString &name) +{ + QStringList path = name.split('.'); + + QObject *object = obj; + + for (int jj = 0; jj < path.count() - 1; ++jj) { + const QString &pathName = path.at(jj); + QmlMetaProperty prop(object, pathName); + QObject *objVal = QmlMetaType::toQObject(prop.read()); + if (!objVal) + return QmlMetaProperty(); + object = objVal; + } + + const QString &propName = path.last(); + QmlMetaProperty prop(object, propName); + if (!prop.isValid()) + return QmlMetaProperty(); + else + return prop; +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index ce2fbcf..6c28a86 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -127,6 +127,7 @@ public: QmlBindableValue *setBinding(QmlBindableValue *) const; static int findSignal(const QObject *, const char *); + static QmlMetaProperty createProperty(QObject *, const QString &); int coreIndex() const; private: diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4ee5545..da26bdd 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -45,6 +45,7 @@ #include "qfile.h" #include "qmlpropertyvaluesource.h" #include "qml.h" +#include "qmlinfo.h" #include "qmlanimation_p.h" #include "qmlbehaviour.h" #include @@ -225,6 +226,21 @@ void QmlAbstractAnimationPrivate::commence() } } +//### make static? +QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str) +{ + Q_Q(QmlAbstractAnimation); + QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str); + if (!prop.isValid()) { + qmlInfo(q) << "Cannot animate non-existant property" << str; + return QmlMetaProperty(); + } else if (!prop.isWritable()) { + qmlInfo(q) << "Cannot animate read-only property" << str; + return QmlMetaProperty(); + } + return prop; +} + void QmlAbstractAnimation::setRunning(bool r) { Q_D(QmlAbstractAnimation); @@ -434,7 +450,7 @@ void QmlAbstractAnimation::setTarget(QObject *o) d->target = o; if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = QmlMetaProperty(d->target, d->propertyName); + d->userProperty = d->createProperty(d->target, d->propertyName); } else { d->userProperty.invalidate(); } @@ -463,7 +479,7 @@ void QmlAbstractAnimation::setProperty(const QString &n) d->propertyName = n; if (d->target && !d->propertyName.isEmpty()) { - d->userProperty = QmlMetaProperty(d->target, d->propertyName); + d->userProperty = d->createProperty(d->target, d->propertyName); } else { d->userProperty.invalidate(); } @@ -1031,10 +1047,14 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions, QObject *obj = action.property.object(); QString propertyName = action.property.name(); - - if ((d->filter.isEmpty() || d->filter.contains(obj)) && - (!d->exclude.contains(obj)) && props.contains(propertyName) && - (!target() || target() == obj)) { + QObject *sObj = action.specifiedObject; + QString sPropertyName = action.specifiedProperty; + bool same = (obj == sObj); + + if ((d->filter.isEmpty() || d->filter.contains(obj) || (!same && d->filter.contains(sObj))) && + (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) && + (props.contains(propertyName) || (!same && props.contains(sPropertyName))) && + (!target() || target() == obj || (!same && target() == sObj))) { objs.insert(obj); Action myAction = action; @@ -1051,7 +1071,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions, QObject *obj = target(); for (int jj = 0; jj < props.count(); ++jj) { Action myAction; - myAction.property = QmlMetaProperty(obj, props.at(jj)); + myAction.property = d->createProperty(obj, props.at(jj)); myAction.toValue = d->value; data->actions << myAction; } @@ -1841,10 +1861,14 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, QObject *obj = action.property.object(); QString propertyName = action.property.name(); - - if ((d->filter.isEmpty() || d->filter.contains(obj)) && - (!d->exclude.contains(obj)) && props.contains(propertyName) && - (!target() || target() == obj)) { + QObject *sObj = action.specifiedObject; + QString sPropertyName = action.specifiedProperty; + bool same = (obj == sObj); + + if ((d->filter.isEmpty() || d->filter.contains(obj) || (!same && d->filter.contains(sObj))) && + (!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) && + (props.contains(propertyName) || (!same && props.contains(sPropertyName))) && + (!target() || target() == obj || (!same && target() == sObj))) { objs.insert(obj); Action myAction = action; @@ -1870,7 +1894,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, QObject *obj = target(); for (int jj = 0; jj < props.count(); ++jj) { Action myAction; - myAction.property = QmlMetaProperty(obj, props.at(jj)); + myAction.property = d->createProperty(obj, props.at(jj)); if (d->fromIsDefined) { d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType())); diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index da5ed97..b801d01 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -193,6 +193,8 @@ public: QmlMetaProperty property; QmlAnimationGroup *group; + + QmlMetaProperty createProperty(QObject *obj, const QString &str); }; class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index 240e37b..7ceed5e 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -282,39 +282,19 @@ void QmlSetProperties::setRestoreEntryValues(bool v) d->restore = v; } -QmlMetaProperty -QmlSetPropertiesPrivate::property(const QByteArray &property) +QmlMetaProperty +QmlSetPropertiesPrivate::property(const QByteArray &property) { Q_Q(QmlSetProperties); - QList path = property.split('.'); - - QObject *obj = this->object; - - for (int jj = 0; jj < path.count() - 1; ++jj) { - const QByteArray &pathName = path.at(jj); - QmlMetaProperty prop(obj, QLatin1String(pathName)); - QObject *objVal = QmlMetaType::toQObject(prop.read()); - if (!objVal) { - qmlInfo(q) << obj->metaObject()->className() - << "has no object property named" << pathName; - return QmlMetaProperty(); - } - obj = objVal; - } - - const QByteArray &name = path.last(); - QmlMetaProperty prop(obj, QLatin1String(name)); + QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromLatin1(property)); if (!prop.isValid()) { - qmlInfo(q) << obj->metaObject()->className() - << "has no property named" << name; + qmlInfo(q) << "Cannot assign to non-existant property" << property; return QmlMetaProperty(); } else if (!prop.isWritable()) { - qmlInfo(q) << obj->metaObject()->className() - << name << "is not writable, and cannot be set."; + qmlInfo(q) << "Cannot assign to read-only property" << property; return QmlMetaProperty(); - } else { - return prop; } + return prop; } QmlSetProperties::ActionList QmlSetProperties::actions() @@ -336,6 +316,8 @@ QmlSetProperties::ActionList QmlSetProperties::actions() a.property = prop; a.fromValue = a.property.read(); a.toValue = d->properties.at(ii).second; + a.specifiedObject = d->object; + a.specifiedProperty = QString::fromLatin1(property); list << a; } @@ -351,6 +333,8 @@ QmlSetProperties::ActionList QmlSetProperties::actions() a.restore = restoreEntryValues(); a.property = prop; a.fromValue = a.property.read(); + a.specifiedObject = d->object; + a.specifiedProperty = QString::fromLatin1(property); if (d->isExplicit) { a.toValue = d->expressions.at(ii).second->value(); @@ -361,7 +345,6 @@ QmlSetProperties::ActionList QmlSetProperties::actions() list << a; } - } return list; diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index fe215e7..8ac1b33 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); -Action::Action() : restore(true), actionDone(false), fromBinding(0), toBinding(0), event(0) +Action::Action() : restore(true), actionDone(false), fromBinding(0), toBinding(0), event(0), specifiedObject(0) { } @@ -403,6 +403,8 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever a.fromValue = cur; a.toValue = d->revertList.at(ii).value; a.toBinding = d->revertList.at(ii).binding; + a.specifiedObject = d->revertList.at(ii).specifiedObject; //### + a.specifiedProperty = d->revertList.at(ii).specifiedProperty; applyList << a; // Store these special reverts in the reverting list d->reverting << d->revertList.at(ii).property; diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h index e9a173c..b219b99 100644 --- a/src/declarative/util/qmlstate.h +++ b/src/declarative/util/qmlstate.h @@ -71,6 +71,9 @@ public: QmlBindableValue *toBinding; ActionEvent *event; + QObject *specifiedObject; + QString specifiedProperty; + void deleteFromBinding(); }; diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index b4ec476..2f6ff42 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -55,6 +55,8 @@ public: SimpleAction(const Action &a, State state = StartState) { property = a.property; + specifiedObject = a.specifiedObject; + specifiedProperty = a.specifiedProperty; if (state == StartState) { value = a.fromValue; binding = property.binding(); @@ -67,6 +69,8 @@ public: QmlMetaProperty property; QVariant value; QmlBindableValue *binding; + QObject *specifiedObject; + QString specifiedProperty; }; class QmlStatePrivate : public QObjectPrivate -- cgit v0.12 From 518cbf7d241cdbd2a4414df289f4bc91e7583edc Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 30 Jun 2009 13:13:55 +1000 Subject: Change geometry-related properties from int to qreal. Most related properties were already qreal. --- src/declarative/fx/qfxanchors.cpp | 25 +++++++------ src/declarative/fx/qfxanchors.h | 45 +++++++++++------------- src/declarative/fx/qfxanchors_p.h | 14 ++++---- src/declarative/fx/qfxitem.cpp | 74 ++++++++++++++++++++------------------- src/declarative/fx/qfxitem.h | 26 +++++++------- src/declarative/fx/qfxitem_p.h | 2 +- 6 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 84ccadf..9a5c516 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(QFxAnchors,Anchors) //TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)? -//TODO: baseline support //TODO: support non-parent, non-sibling (need to find lowest common ancestor) //### const item? @@ -760,13 +759,13 @@ void QFxAnchors::resetHorizontalCenter() d->updateHorizontalAnchors(); } -int QFxAnchors::leftMargin() const +qreal QFxAnchors::leftMargin() const { Q_D(const QFxAnchors); return d->leftMargin; } -void QFxAnchors::setLeftMargin(int offset) +void QFxAnchors::setLeftMargin(qreal offset) { Q_D(QFxAnchors); if (d->leftMargin == offset) @@ -776,13 +775,13 @@ void QFxAnchors::setLeftMargin(int offset) emit leftMarginChanged(); } -int QFxAnchors::rightMargin() const +qreal QFxAnchors::rightMargin() const { Q_D(const QFxAnchors); return d->rightMargin; } -void QFxAnchors::setRightMargin(int offset) +void QFxAnchors::setRightMargin(qreal offset) { Q_D(QFxAnchors); if (d->rightMargin == offset) @@ -792,13 +791,13 @@ void QFxAnchors::setRightMargin(int offset) emit rightMarginChanged(); } -int QFxAnchors::horizontalCenterOffset() const +qreal QFxAnchors::horizontalCenterOffset() const { Q_D(const QFxAnchors); return d->hCenterOffset; } -void QFxAnchors::setHorizontalCenterOffset(int offset) +void QFxAnchors::setHorizontalCenterOffset(qreal offset) { Q_D(QFxAnchors); if (d->hCenterOffset == offset) @@ -808,13 +807,13 @@ void QFxAnchors::setHorizontalCenterOffset(int offset) emit horizontalCenterOffsetChanged(); } -int QFxAnchors::topMargin() const +qreal QFxAnchors::topMargin() const { Q_D(const QFxAnchors); return d->topMargin; } -void QFxAnchors::setTopMargin(int offset) +void QFxAnchors::setTopMargin(qreal offset) { Q_D(QFxAnchors); if (d->topMargin == offset) @@ -824,13 +823,13 @@ void QFxAnchors::setTopMargin(int offset) emit topMarginChanged(); } -int QFxAnchors::bottomMargin() const +qreal QFxAnchors::bottomMargin() const { Q_D(const QFxAnchors); return d->bottomMargin; } -void QFxAnchors::setBottomMargin(int offset) +void QFxAnchors::setBottomMargin(qreal offset) { Q_D(QFxAnchors); if (d->bottomMargin == offset) @@ -840,13 +839,13 @@ void QFxAnchors::setBottomMargin(int offset) emit bottomMarginChanged(); } -int QFxAnchors::verticalCenterOffset() const +qreal QFxAnchors::verticalCenterOffset() const { Q_D(const QFxAnchors); return d->vCenterOffset; } -void QFxAnchors::setVerticalCenterOffset(int offset) +void QFxAnchors::setVerticalCenterOffset(qreal offset) { Q_D(QFxAnchors); if (d->vCenterOffset == offset) diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 206a05c..94c22a6 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -46,15 +46,13 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxItem; -class QFxAnchorsPrivate; +class QFxItem; class QFxAnchorLine { public: @@ -93,12 +91,12 @@ class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom) Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline) - Q_PROPERTY(int leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged) - Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged) - Q_PROPERTY(int horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged()) - Q_PROPERTY(int topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged) - Q_PROPERTY(int bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) - Q_PROPERTY(int verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged()) + Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged) + Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged) + Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged()) + Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged) + Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) + Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged()) Q_PROPERTY(QFxItem *fill READ fill WRITE setFill) Q_PROPERTY(QFxItem *centeredIn READ centeredIn WRITE setCenteredIn) @@ -121,7 +119,7 @@ public: QFxAnchorLine left() const; void setLeft(const QFxAnchorLine &edge); - Q_INVOKABLE void resetLeft(); //### temporarily invokable for testing + void resetLeft(); QFxAnchorLine right() const; void setRight(const QFxAnchorLine &edge); @@ -147,23 +145,23 @@ public: void setBaseline(const QFxAnchorLine &edge); void resetBaseline(); - int leftMargin() const; - void setLeftMargin(int); + qreal leftMargin() const; + void setLeftMargin(qreal); - int rightMargin() const; - void setRightMargin(int); + qreal rightMargin() const; + void setRightMargin(qreal); - int horizontalCenterOffset() const; - void setHorizontalCenterOffset(int); + qreal horizontalCenterOffset() const; + void setHorizontalCenterOffset(qreal); - int topMargin() const; - void setTopMargin(int); + qreal topMargin() const; + void setTopMargin(qreal); - int bottomMargin() const; - void setBottomMargin(int); + qreal bottomMargin() const; + void setBottomMargin(qreal); - int verticalCenterOffset() const; - void setVerticalCenterOffset(int); + qreal verticalCenterOffset() const; + void setVerticalCenterOffset(qreal); QFxItem *fill() const; void setFill(QFxItem *); @@ -188,11 +186,10 @@ private: Q_DISABLE_COPY(QFxAnchors) Q_DECLARE_PRIVATE(QFxAnchors) }; - QML_DECLARE_TYPE(QFxAnchors) - QT_END_NAMESPACE QT_END_HEADER + #endif diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h index 9ff6869..a7c904b 100644 --- a/src/declarative/fx/qfxanchors_p.h +++ b/src/declarative/fx/qfxanchors_p.h @@ -56,8 +56,8 @@ #include "qfxanchors.h" #include "private/qobject_p.h" - QT_BEGIN_NAMESPACE + class QFxAnchorsPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QFxAnchors) @@ -119,12 +119,12 @@ public: QFxAnchorLine hCenter; QFxAnchorLine baseline; - int leftMargin; - int rightMargin; - int topMargin; - int bottomMargin; - int vCenterOffset; - int hCenterOffset; + qreal leftMargin; + qreal rightMargin; + qreal topMargin; + qreal bottomMargin; + qreal vCenterOffset; + qreal hCenterOffset; }; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 73786a8..3764e3d 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -65,10 +65,10 @@ #include #include - QT_BEGIN_NAMESPACE -#ifndef INT_MAX -#define INT_MAX 2147483647 + +#ifndef FLT_MAX +#define FLT_MAX 1E+37 #endif QML_DEFINE_NOCREATE_TYPE(QFxContents) @@ -123,7 +123,7 @@ QML_DEFINE_NOCREATE_TYPE(QSimpleCanvasFilter) */ -QFxContents::QFxContents() : _height(0), _width(0) +QFxContents::QFxContents() : m_height(0), m_width(0) { } @@ -131,70 +131,71 @@ QFxContents::QFxContents() : _height(0), _width(0) \property QFxContents::height \brief The height of the contents. */ -int QFxContents::height() const +qreal QFxContents::height() const { - return _height; + return m_height; } /*! \property QFxContents::width \brief The width of the contents. */ -int QFxContents::width() const +qreal QFxContents::width() const { - return _width; + return m_width; } //TODO: optimization: only check sender(), if there is one void QFxContents::calcHeight() { - int oldheight = _height; + qreal oldheight = m_height; - int top = INT_MAX; - int bottom = 0; + qreal top = FLT_MAX; + qreal bottom = 0; - const QList &children = _item->QSimpleCanvasItem::children(); + const QList &children = m_item->QSimpleCanvasItem::children(); for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); - int y = int(child->y()); + qreal y = child->y(); if (y + child->height() > bottom) bottom = y + child->height(); if (y < top) top = y; } - _height = bottom - top; + m_height = qMax(bottom - top, qreal(0.0)); - if (_height != oldheight) + if (m_height != oldheight) emit heightChanged(); } //TODO: optimization: only check sender(), if there is one void QFxContents::calcWidth() { - int oldwidth = _width; + qreal oldwidth = m_width; + + qreal left = FLT_MAX; + qreal right = 0; - int left = INT_MAX; - int right = 0; - const QList &children = _item->QSimpleCanvasItem::children(); + const QList &children = m_item->QSimpleCanvasItem::children(); for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); - int x = int(child->x()); + qreal x = int(child->x()); if (x + child->width() > right) right = x + child->width(); if (x < left) left = x; } - _width = right - left; + m_width = qMax(right - left, qreal(0.0)); - if (_width != oldwidth) + if (m_width != oldwidth) emit widthChanged(); } void QFxContents::setItem(QFxItem *item) { - _item = item; + m_item = item; - const QList &children = _item->QSimpleCanvasItem::children(); + const QList &children = m_item->QSimpleCanvasItem::children(); for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); @@ -925,8 +926,8 @@ void QFxItem::qmlLoaded() /*! \qmlproperty real Item::x \qmlproperty real Item::y - \qmlproperty int Item::width - \qmlproperty int Item::height + \qmlproperty real Item::width + \qmlproperty real Item::height Defines the item's position and size relative to its parent. @@ -1346,13 +1347,14 @@ QFxAnchorLine QFxItem::baseline() const \qmlproperty AnchorLine Item::anchors.baseline \qmlproperty Item Item::anchors.fill - - \qmlproperty int Item::anchors.topMargin - \qmlproperty int Item::anchors.bottomMargin - \qmlproperty int Item::anchors.leftMargin - \qmlproperty int Item::anchors.rightMargin - \qmlproperty int Item::anchors.horizontalCenterOffset - \qmlproperty int Item::anchors.verticalCenterOffset + \qmlproperty Item Item::anchors.centeredIn + + \qmlproperty real Item::anchors.topMargin + \qmlproperty real Item::anchors.bottomMargin + \qmlproperty real Item::anchors.leftMargin + \qmlproperty real Item::anchors.rightMargin + \qmlproperty real Item::anchors.horizontalCenterOffset + \qmlproperty real Item::anchors.verticalCenterOffset Anchors provide a way to position an item by specifying its relationship with other items. @@ -1411,11 +1413,11 @@ QFxAnchorLine QFxItem::baseline() const For non-text items, a default baseline offset of 0 is used. */ -int QFxItem::baselineOffset() const +qreal QFxItem::baselineOffset() const { Q_D(const QFxItem); if (!d->_baselineOffset.isValid()) { - return 0; + return 0.0; } else return d->_baselineOffset; } @@ -1423,7 +1425,7 @@ int QFxItem::baselineOffset() const /*! \internal */ -void QFxItem::setBaselineOffset(int offset) +void QFxItem::setBaselineOffset(qreal offset) { Q_D(QFxItem); if (offset == d->_baselineOffset) diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 3c872e1..f0f1177 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -53,7 +53,6 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -63,14 +62,14 @@ QT_MODULE(Declarative) class Q_DECLARATIVE_EXPORT QFxContents : public QObject { Q_OBJECT - Q_PROPERTY(int height READ height NOTIFY heightChanged) - Q_PROPERTY(int width READ width NOTIFY widthChanged) + Q_PROPERTY(qreal height READ height NOTIFY heightChanged) + Q_PROPERTY(qreal width READ width NOTIFY widthChanged) public: QFxContents(); - int height() const; + qreal height() const; - int width() const; + qreal width() const; void setItem(QFxItem *item); @@ -83,9 +82,9 @@ Q_SIGNALS: void widthChanged(); private: - QFxItem *_item; - int _height; - int _width; + QFxItem *m_item; + qreal m_height; + qreal m_width; }; QML_DECLARE_TYPE(QFxContents) Q_DECLARE_OPERATORS_FOR_FLAGS(QFxAnchors::UsedAnchors) @@ -116,11 +115,11 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(qreal x READ x WRITE setX NOTIFY leftChanged) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY topChanged) Q_PROPERTY(qreal z READ z WRITE setZ) - Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) + Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged) Q_PROPERTY(bool flipVertically READ flipVertically WRITE setFlipVertically) Q_PROPERTY(bool flipHorizontally READ flipHorizontally WRITE setFlipHorizontally) - Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(int baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) + Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged) + Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QFxAnchorLine left READ left) Q_PROPERTY(QFxAnchorLine right READ right) Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter) @@ -179,8 +178,8 @@ public: bool flipHorizontally() const; void setFlipHorizontally(bool); - int baselineOffset() const; - void setBaselineOffset(int); + qreal baselineOffset() const; + void setBaselineOffset(qreal); qreal rotation() const; void setRotation(qreal); @@ -274,4 +273,5 @@ QML_DECLARE_TYPE(QSimpleCanvasFilter) QT_END_NAMESPACE QT_END_HEADER + #endif // QFXITEM_H diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index b38d877..32e8aef 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -138,7 +138,7 @@ public: QList _qmlnewloading; QList _qmlnewcomp; - QmlNullableValue _baselineOffset; + QmlNullableValue _baselineOffset; float _rotation; bool _classComplete:1; -- cgit v0.12 From 1674eeb1b331f000a6dc651ec12b682ba5b7fd77 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 30 Jun 2009 13:29:26 +1000 Subject: Rename notifiers: topChanged -> yChanged; leftChanged -> xChanged. --- examples/declarative/follow/pong.qml | 2 +- src/declarative/fx/qfxflickable.cpp | 4 ++-- src/declarative/fx/qfxgridview.cpp | 12 ++++++------ src/declarative/fx/qfxitem.cpp | 16 ++++++++-------- src/declarative/fx/qfxitem.h | 8 ++++---- src/declarative/fx/qfxlistview.cpp | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml index 93ee6a7..c101d8d 100644 --- a/examples/declarative/follow/pong.qml +++ b/examples/declarative/follow/pong.qml @@ -26,7 +26,7 @@ Rect { y: Follow { source: Ball.targetY; velocity: 200 } // Detect the ball hitting the top or bottom of the view and bounce it - onTopChanged: { + onYChanged: { if (y <= 0) targetY = Page.height-20; else if (y >= Page.height-20) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index bc4a5fc..3580edb 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -112,8 +112,8 @@ void QFxFlickablePrivate::init() QObject::connect(&_tl, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); q->setOptions(QSimpleCanvasItem::ChildMouseFilter | QSimpleCanvasItem::MouseEvents); - QObject::connect(_flick, SIGNAL(leftChanged()), q, SIGNAL(positionChanged())); - QObject::connect(_flick, SIGNAL(topChanged()), q, SIGNAL(positionChanged())); + QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionChanged())); + QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&elasticY, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange())); diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index a6ffbb9..11b630a 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -368,8 +368,8 @@ void QFxGridViewPrivate::releaseItem(FxGridItem *item) if (!item) return; if (trackedItem == item) { - QObject::disconnect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, SIGNAL(yChanged()), q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, SIGNAL(xChanged()), q, SLOT(trackedPositionChanged())); trackedItem = 0; } if (model->release(item->item) == 0) { @@ -548,15 +548,15 @@ void QFxGridViewPrivate::updateTrackedItem() item = highlight; if (trackedItem && item != trackedItem) { - QObject::disconnect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, SIGNAL(yChanged()), q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, SIGNAL(xChanged()), q, SLOT(trackedPositionChanged())); trackedItem = 0; } if (!trackedItem && item) { trackedItem = item; - QObject::connect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); - QObject::connect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); + QObject::connect(trackedItem->item, SIGNAL(yChanged()), q, SLOT(trackedPositionChanged())); + QObject::connect(trackedItem->item, SIGNAL(xChanged()), q, SLOT(trackedPositionChanged())); q->trackedPositionChanged(); } if (trackedItem) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 3764e3d..5ef6106 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -199,9 +199,9 @@ void QFxContents::setItem(QFxItem *item) for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); - connect(child, SIGNAL(topChanged()), this, SLOT(calcHeight())); + connect(child, SIGNAL(yChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); - connect(child, SIGNAL(leftChanged()), this, SLOT(calcWidth())); + connect(child, SIGNAL(xChanged()), this, SLOT(calcWidth())); } calcHeight(); @@ -269,15 +269,15 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::leftChanged() + \fn void QFxItem::xChanged() - This signal is emitted when the left coordinate of the item changes. + This signal is emitted when the x coordinate of the item changes. */ /*! - \fn void QFxItem::topChanged() + \fn void QFxItem::yChanged() - This signal is emitted when the top coordinate of the item changes. + This signal is emitted when the y coordinate of the item changes. */ /*! @@ -1068,11 +1068,11 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, } if (newGeometry.x() != oldGeometry.x()) - emit leftChanged(); + emit xChanged(); if (newGeometry.width() != oldGeometry.width()) emit widthChanged(); if (newGeometry.y() != oldGeometry.y()) - emit topChanged(); + emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index f0f1177..d66d24b 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -112,8 +112,8 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY leftChanged) - Q_PROPERTY(qreal y READ y WRITE setY NOTIFY topChanged) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(qreal z READ z WRITE setZ) Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged) Q_PROPERTY(bool flipVertically READ flipVertically WRITE setFlipVertically) @@ -212,10 +212,10 @@ public Q_SLOTS: void newChild(const QString &url); Q_SIGNALS: - void leftChanged(); + void xChanged(); + void yChanged(); void widthChanged(); void heightChanged(); - void topChanged(); void baselineOffsetChanged(); void stateChanged(const QString &); void focusChanged(); diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index a8c0747..889cfdd 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -444,7 +444,7 @@ void QFxListViewPrivate::releaseItem(FxListItem *item) else QObject::disconnect(item->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); if (trackedItem == item) { - const char *notifier1 = orient == Qt::Vertical ? SIGNAL(topChanged()) : SIGNAL(leftChanged()); + const char *notifier1 = orient == Qt::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); const char *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); @@ -588,7 +588,7 @@ void QFxListViewPrivate::updateTrackedItem() if (highlight) item = highlight; - const char *notifier1 = orient == Qt::Vertical ? SIGNAL(topChanged()) : SIGNAL(leftChanged()); + const char *notifier1 = orient == Qt::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); const char *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); if (trackedItem && item != trackedItem) { -- cgit v0.12 From a77153a64e8559b21a7e6ea53fe26eb2719ce9f5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 30 Jun 2009 14:26:23 +1000 Subject: Cleanup Fix up license headers and private warnings, as well as other general cleanups. --- src/declarative/debugger/qmldebugclient.cpp | 4 +- src/declarative/debugger/qmldebugger.cpp | 3 ++ src/declarative/debugger/qmldebugger.h | 1 - src/declarative/debugger/qmldebuggerstatus.h | 1 - src/declarative/debugger/qmldebugserver.cpp | 4 +- src/declarative/debugger/qmlobjecttree.cpp | 3 ++ src/declarative/debugger/qmlobjecttree_p.h | 15 ++++++++ src/declarative/debugger/qmlpropertyview.cpp | 4 ++ src/declarative/debugger/qmlpropertyview_p.h | 11 ++++++ src/declarative/debugger/qmlwatches.cpp | 4 ++ src/declarative/debugger/qmlwatches_p.h | 11 ++++++ src/declarative/debugger/qpacketprotocol.cpp | 41 ++++++++++++++++++-- src/declarative/debugger/qpacketprotocol.h | 47 +++++++++++++++++++++-- src/declarative/fx/qfxevents_p.h | 11 ++++++ src/declarative/fx/qfxitem.cpp | 7 ++++ src/declarative/fx/qfxitem.h | 6 +-- src/declarative/qml/parser/qmljs.g | 2 +- src/declarative/qml/parser/qmljsast_p.h | 2 +- src/declarative/qml/parser/qmljsengine_p.cpp | 38 +++++++++++------- src/declarative/qml/parser/qmljsengine_p.h | 49 +++++++++++++++++------- src/declarative/qml/parser/qmljslexer.cpp | 2 +- src/declarative/qml/parser/qmljsmemorypool_p.h | 2 +- src/declarative/qml/parser/qmljsnodepool_p.h | 2 +- src/declarative/qml/parser/qmljsprettypretty.cpp | 2 +- src/declarative/qml/parser/qmljsprettypretty_p.h | 2 +- src/declarative/qml/qmlbasicscript.cpp | 34 +++++++++++++++- src/declarative/qml/qmlbasicscript_p.h | 47 +++++++++++++++++++++-- src/declarative/qml/qmlbindablevalue.h | 4 +- src/declarative/qml/qmlbindablevalue_p.h | 11 ++++++ src/declarative/qml/qmlboundsignal_p.h | 15 +++++++- src/declarative/qml/qmlclassfactory.cpp | 3 ++ src/declarative/qml/qmlclassfactory_p.h | 11 ++++++ src/declarative/qml/qmlcompiledcomponent_p.h | 15 +++++++- src/declarative/qml/qmlcompiler_p.h | 12 ++++++ src/declarative/qml/qmlcomponent.cpp | 2 + src/declarative/qml/qmlcomponent.h | 1 + src/declarative/qml/qmlcomponent_p.h | 15 +++++++- src/declarative/qml/qmlcompositetypemanager.cpp | 4 ++ src/declarative/qml/qmlcompositetypemanager_p.h | 11 ++++++ src/declarative/qml/qmlcontext.h | 1 - src/declarative/qml/qmlcontext_p.h | 13 +++++++ src/declarative/qml/qmlcustomparser_p.h | 11 ++++++ src/declarative/qml/qmlcustomparser_p_p.h | 11 ++++++ src/declarative/qml/qmldeclarativedata_p.h | 11 ++++++ src/declarative/qml/qmldom.cpp | 1 - src/declarative/qml/qmldom_p.h | 11 ++++++ src/declarative/qml/qmlengine_p.h | 14 ++++++- src/declarative/qml/qmlexpression.h | 1 - src/declarative/qml/qmlinstruction.cpp | 1 + src/declarative/qml/qmlinstruction_p.h | 17 ++++++-- src/declarative/qml/qmllist.h | 1 - src/declarative/qml/qmlmetaproperty.cpp | 1 - src/declarative/qml/qmlmetaproperty_p.h | 12 +++++- src/declarative/qml/qmlmetatype.cpp | 1 + src/declarative/qml/qmlparser_p.h | 11 ++++++ src/declarative/qml/qmlparserstatus.h | 1 - src/declarative/qml/qmlprivate.h | 6 +-- src/declarative/qml/qmlpropertyvaluesource.cpp | 2 +- src/declarative/qml/qmlpropertyvaluesource.h | 7 ++-- src/declarative/qml/qmlproxymetaobject.cpp | 2 +- src/declarative/qml/qmlproxymetaobject_p.h | 12 ++++++ src/declarative/qml/qmlrefcount.cpp | 4 ++ src/declarative/qml/qmlrefcount_p.h | 11 ++++++ src/declarative/qml/qmlscriptparser.cpp | 1 - src/declarative/qml/qmlscriptparser_p.h | 14 ++++++- src/declarative/qml/qmlstringconverters_p.h | 11 ++++++ src/declarative/qml/qmlvme_p.h | 13 +++++++ src/declarative/qml/qmlvmemetaobject.cpp | 2 +- src/declarative/qml/qmlvmemetaobject_p.h | 12 ++++++ src/declarative/qml/qpodvector_p.h | 12 ++++++ src/declarative/util/qfxglobal.h | 4 +- src/declarative/util/qfxperf.cpp | 3 +- src/declarative/util/qfxperf.h | 11 +++--- src/declarative/util/qfxview.cpp | 3 +- src/declarative/util/qmlanimation_p.h | 15 +++++++- src/declarative/util/qmlbind.cpp | 1 + src/declarative/util/qmlconnection.cpp | 2 +- src/declarative/util/qmlfollow.cpp | 2 +- src/declarative/util/qmlfont.cpp | 3 +- src/declarative/util/qmllistmodel.cpp | 1 + src/declarative/util/qmllistmodel.h | 1 - src/declarative/util/qmlnullablevalue_p.h | 16 +++++++- src/declarative/util/qmlopenmetaobject.cpp | 1 - src/declarative/util/qmlpackage.cpp | 3 +- src/declarative/util/qmlscript.h | 3 ++ src/declarative/util/qmlsetproperties.cpp | 2 +- src/declarative/util/qmlsetproperties.h | 1 - src/declarative/util/qmlstate_p.h | 11 ++++++ src/declarative/util/qmlstategroup.cpp | 2 +- src/declarative/util/qperformancelog.cpp | 3 ++ src/declarative/util/qperformancelog.h | 5 +++ src/declarative/widgets/graphicslayouts.h | 4 +- src/declarative/widgets/graphicswidgets.cpp | 4 +- 93 files changed, 677 insertions(+), 111 deletions(-) diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qmldebugclient.cpp index 3dacf01..e442333 100644 --- a/src/declarative/debugger/qmldebugclient.cpp +++ b/src/declarative/debugger/qmldebugclient.cpp @@ -185,6 +185,6 @@ void QmlDebugClientPlugin::messageReceived(const QByteArray &) { } -#include "qmldebugclient.moc" - QT_END_NAMESPACE + +#include "qmldebugclient.moc" diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp index 9ab3247..aad11de 100644 --- a/src/declarative/debugger/qmldebugger.cpp +++ b/src/declarative/debugger/qmldebugger.cpp @@ -62,6 +62,8 @@ #include #include +QT_BEGIN_NAMESPACE + QmlDebugger::QmlDebugger(QWidget *parent) : QWidget(parent), m_tree(0), m_warnings(0), m_watchTable(0), m_watches(0), m_properties(0), m_text(0), m_highlightedItem(0) @@ -353,3 +355,4 @@ void QmlDebugger::setDebugObject(QObject *obj) item->setExpanded(true); } +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qmldebugger.h b/src/declarative/debugger/qmldebugger.h index 10b2f9a..03efeb6 100644 --- a/src/declarative/debugger/qmldebugger.h +++ b/src/declarative/debugger/qmldebugger.h @@ -101,4 +101,3 @@ QT_END_NAMESPACE QT_END_HEADER #endif // QMLDEBUGGER_H - diff --git a/src/declarative/debugger/qmldebuggerstatus.h b/src/declarative/debugger/qmldebuggerstatus.h index 62336de..a8480f4 100644 --- a/src/declarative/debugger/qmldebuggerstatus.h +++ b/src/declarative/debugger/qmldebuggerstatus.h @@ -64,4 +64,3 @@ QT_END_NAMESPACE QT_END_HEADER #endif // QLMDEBUGGERSTATUS_P_H - diff --git a/src/declarative/debugger/qmldebugserver.cpp b/src/declarative/debugger/qmldebugserver.cpp index 23e59e0..e055ad5 100644 --- a/src/declarative/debugger/qmldebugserver.cpp +++ b/src/declarative/debugger/qmldebugserver.cpp @@ -294,6 +294,6 @@ void QmlDebugServerPlugin::messageReceived(const QByteArray &) { } -#include "qmldebugserver.moc" - QT_END_NAMESPACE + +#include "qmldebugserver.moc" diff --git a/src/declarative/debugger/qmlobjecttree.cpp b/src/declarative/debugger/qmlobjecttree.cpp index 27dc000..8a2358a 100644 --- a/src/declarative/debugger/qmlobjecttree.cpp +++ b/src/declarative/debugger/qmlobjecttree.cpp @@ -48,6 +48,8 @@ #include #include +QT_BEGIN_NAMESPACE + QmlObjectTree::QmlObjectTree(QWidget *parent) : QTreeWidget(parent) { @@ -73,3 +75,4 @@ void QmlObjectTree::mousePressEvent(QMouseEvent *me) } } +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qmlobjecttree_p.h b/src/declarative/debugger/qmlobjecttree_p.h index 4e6d484..54d6d8e 100644 --- a/src/declarative/debugger/qmlobjecttree_p.h +++ b/src/declarative/debugger/qmlobjecttree_p.h @@ -42,10 +42,23 @@ #ifndef QMLOBJECTTREE_P_H #define QMLOBJECTTREE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include +QT_BEGIN_NAMESPACE + class QmlBindableValue; class QmlDebuggerItem : public QTreeWidgetItem { @@ -82,5 +95,7 @@ protected: virtual void mousePressEvent(QMouseEvent *); }; +QT_END_NAMESPACE + #endif // QMLOBJECTTREE_P_H diff --git a/src/declarative/debugger/qmlpropertyview.cpp b/src/declarative/debugger/qmlpropertyview.cpp index abe1902..76a192d 100644 --- a/src/declarative/debugger/qmlpropertyview.cpp +++ b/src/declarative/debugger/qmlpropertyview.cpp @@ -47,6 +47,8 @@ #include #include +QT_BEGIN_NAMESPACE + QmlPropertyView::QmlPropertyView(QmlWatches *watches, QWidget *parent) : QWidget(parent), m_tree(0), m_watches(watches) { @@ -221,4 +223,6 @@ void QmlPropertyView::refresh() setObject(m_object); } +QT_END_NAMESPACE + #include "qmlpropertyview.moc" diff --git a/src/declarative/debugger/qmlpropertyview_p.h b/src/declarative/debugger/qmlpropertyview_p.h index 469a08d..4694482 100644 --- a/src/declarative/debugger/qmlpropertyview_p.h +++ b/src/declarative/debugger/qmlpropertyview_p.h @@ -42,6 +42,17 @@ #ifndef QMLPROPERTYVIEW_P_H #define QMLPROPERTYVIEW_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/debugger/qmlwatches.cpp b/src/declarative/debugger/qmlwatches.cpp index bac4cbd..8fc9e89 100644 --- a/src/declarative/debugger/qmlwatches.cpp +++ b/src/declarative/debugger/qmlwatches.cpp @@ -46,6 +46,8 @@ #include #include +QT_BEGIN_NAMESPACE + QString QmlWatches::objectToString(QObject *obj) { if(!obj) @@ -301,4 +303,6 @@ QVariant QmlWatches::data(const QModelIndex &idx, int role) const } } +QT_END_NAMESPACE + #include "qmlwatches.moc" diff --git a/src/declarative/debugger/qmlwatches_p.h b/src/declarative/debugger/qmlwatches_p.h index 6c383a1..dfec979 100644 --- a/src/declarative/debugger/qmlwatches_p.h +++ b/src/declarative/debugger/qmlwatches_p.h @@ -42,6 +42,17 @@ #ifndef QMLWATCHES_P_H #define QMLWATCHES_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 6911b89..7be23b7 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -1,16 +1,49 @@ /**************************************************************************** ** -** This file is part of the $PACKAGE_NAME$. +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_EXTENDED_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qpacketprotocol.h" #include +QT_BEGIN_NAMESPACE + #define MAX_PACKET_SIZE 0x7FFFFFFF /*! @@ -458,5 +491,7 @@ QPacketAutoSend::~QPacketAutoSend() p->send(*this); } +QT_END_NAMESPACE + #include "qpacketprotocol.moc" diff --git a/src/declarative/debugger/qpacketprotocol.h b/src/declarative/debugger/qpacketprotocol.h index 6dd8bda..f3fb44b 100644 --- a/src/declarative/debugger/qpacketprotocol.h +++ b/src/declarative/debugger/qpacketprotocol.h @@ -1,10 +1,41 @@ /**************************************************************************** ** -** This file is part of the $PACKAGE_NAME$. +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_EXTENDED_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -14,6 +45,12 @@ #include #include +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + class QIODevice; class QBuffer; class QPacket; @@ -78,4 +115,8 @@ private: QPacketProtocol * p; }; +QT_END_NAMESPACE + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qfxevents_p.h b/src/declarative/fx/qfxevents_p.h index 2eb29af..60494e6 100644 --- a/src/declarative/fx/qfxevents_p.h +++ b/src/declarative/fx/qfxevents_p.h @@ -42,6 +42,17 @@ #ifndef QFXEVENTS_P_H #define QFXEVENTS_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 5ef6106..1c35290 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -128,6 +128,13 @@ QFxContents::QFxContents() : m_height(0), m_width(0) } /*! + \qmlproperty qreal Item::contents.width + \qmlproperty qreal Item::contents.height + + The contents properties allow an item access to the size of its + children. This property is useful if you have an item that needs to be + sized to fit its children. +/*! \property QFxContents::height \brief The height of the contents. */ diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index d66d24b..67a4553 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -116,10 +116,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(qreal z READ z WRITE setZ) Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged) - Q_PROPERTY(bool flipVertically READ flipVertically WRITE setFlipVertically) - Q_PROPERTY(bool flipHorizontally READ flipHorizontally WRITE setFlipHorizontally) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QFxAnchorLine left READ left) Q_PROPERTY(QFxAnchorLine right READ right) Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter) @@ -127,6 +124,9 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(QFxAnchorLine bottom READ bottom) Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter) Q_PROPERTY(QFxAnchorLine baseline READ baseline) + Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) + Q_PROPERTY(bool flipVertically READ flipVertically WRITE setFlipVertically) + Q_PROPERTY(bool flipHorizontally READ flipHorizontally WRITE setFlipHorizontally) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index 907ca52..ed5f653 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -3,7 +3,7 @@ -- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -- Contact: Qt Software Information (qt-info@nokia.com) -- --- This file is part of the QtScript module of the Qt Toolkit. +-- This file is part of the QtDeclarative module of the Qt Toolkit. -- -- $QT_BEGIN_LICENSE:LGPL$ -- No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h index 8dc32ed..1db037a 100644 --- a/src/declarative/qml/parser/qmljsast_p.h +++ b/src/declarative/qml/parser/qmljsast_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsengine_p.cpp b/src/declarative/qml/parser/qmljsengine_p.cpp index 42885d8..02d9b9c 100644 --- a/src/declarative/qml/parser/qmljsengine_p.cpp +++ b/src/declarative/qml/parser/qmljsengine_p.cpp @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage -** ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the @@ -22,10 +20,24 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** -**************************************************************************/ +****************************************************************************/ #include "qmljsengine_p.h" #include "qmljsnodepool_p.h" diff --git a/src/declarative/qml/parser/qmljsengine_p.h b/src/declarative/qml/parser/qmljsengine_p.h index b9ff042..5aea983 100644 --- a/src/declarative/qml/parser/qmljsengine_p.h +++ b/src/declarative/qml/parser/qmljsengine_p.h @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage -** ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the @@ -22,14 +20,39 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** -**************************************************************************/ +****************************************************************************/ #ifndef QMLJSENGINE_P_H #define QMLJSENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index 843f6ae..e0de71a 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsmemorypool_p.h b/src/declarative/qml/parser/qmljsmemorypool_p.h index d7506be..6bd21f8 100644 --- a/src/declarative/qml/parser/qmljsmemorypool_p.h +++ b/src/declarative/qml/parser/qmljsmemorypool_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsnodepool_p.h b/src/declarative/qml/parser/qmljsnodepool_p.h index 1a5b7f6..e2f0a3c 100644 --- a/src/declarative/qml/parser/qmljsnodepool_p.h +++ b/src/declarative/qml/parser/qmljsnodepool_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsprettypretty.cpp b/src/declarative/qml/parser/qmljsprettypretty.cpp index 1045792..b6733e5 100644 --- a/src/declarative/qml/parser/qmljsprettypretty.cpp +++ b/src/declarative/qml/parser/qmljsprettypretty.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsprettypretty_p.h b/src/declarative/qml/parser/qmljsprettypretty_p.h index fe82ca2..3227e7d 100644 --- a/src/declarative/qml/parser/qmljsprettypretty_p.h +++ b/src/declarative/qml/parser/qmljsprettypretty_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index f02a176..80ca5a9 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h index 43c0d36..c7ab280 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -3,15 +3,56 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QMLBASICSCRIPT_P_H #define QMLBASICSCRIPT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -109,5 +150,3 @@ QT_END_NAMESPACE QT_END_HEADER #endif // QMLBASICSCRIPT_P_H - - diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h index 50bbf36..00da57e 100644 --- a/src/declarative/qml/qmlbindablevalue.h +++ b/src/declarative/qml/qmlbindablevalue.h @@ -48,12 +48,12 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlExpression; class QmlContext; class QmlBindableValuePrivate; @@ -90,8 +90,8 @@ private: }; QML_DECLARE_TYPE(QmlBindableValue) - QT_END_NAMESPACE QT_END_HEADER + #endif // QMLBINDABLEVALUE_H diff --git a/src/declarative/qml/qmlbindablevalue_p.h b/src/declarative/qml/qmlbindablevalue_p.h index b55a314..a37b2c0 100644 --- a/src/declarative/qml/qmlbindablevalue_p.h +++ b/src/declarative/qml/qmlbindablevalue_p.h @@ -42,6 +42,17 @@ #ifndef QMLBINDABLEVALUE_P_H #define QMLBINDABLEVALUE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/qml/qmlboundsignal_p.h b/src/declarative/qml/qmlboundsignal_p.h index 2c05770..39c0c46 100644 --- a/src/declarative/qml/qmlboundsignal_p.h +++ b/src/declarative/qml/qmlboundsignal_p.h @@ -42,10 +42,22 @@ #ifndef QMLBOUNDSIGNAL_P_H #define QMLBOUNDSIGNAL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include QT_BEGIN_NAMESPACE + class QmlBoundSignal : public QmlExpressionObject { Q_OBJECT @@ -98,7 +110,6 @@ private: QmlBoundSignalParameters *params; }; +QT_END_NAMESPACE #endif // QMLBOUNDSIGNAL_P_H - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlclassfactory.cpp b/src/declarative/qml/qmlclassfactory.cpp index 7e5b929..ddfbd78 100644 --- a/src/declarative/qml/qmlclassfactory.cpp +++ b/src/declarative/qml/qmlclassfactory.cpp @@ -41,7 +41,10 @@ #include "qmlclassfactory_p.h" +QT_BEGIN_NAMESPACE + QmlClassFactory::~QmlClassFactory() { } +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlclassfactory_p.h b/src/declarative/qml/qmlclassfactory_p.h index e3e71c9..cd80ffc 100644 --- a/src/declarative/qml/qmlclassfactory_p.h +++ b/src/declarative/qml/qmlclassfactory_p.h @@ -42,6 +42,17 @@ #ifndef QMLCLASSFACTORY_P_H #define QMLCLASSFACTORY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlcompiledcomponent_p.h b/src/declarative/qml/qmlcompiledcomponent_p.h index 2201423..0945892 100644 --- a/src/declarative/qml/qmlcompiledcomponent_p.h +++ b/src/declarative/qml/qmlcompiledcomponent_p.h @@ -42,13 +42,26 @@ #ifndef QMLCOMPILEDCOMPONENT_P_H #define QMLCOMPILEDCOMPONENT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include #include QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + namespace QmlParser { class Property; class Object; @@ -72,8 +85,8 @@ private: friend class QmlDomDocument; }; - QT_END_NAMESPACE + QT_END_HEADER #endif // QMLCOMPILEDCOMPONENT_P_H diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 2559b14..2c722b9 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPILER_P_H #define QMLCOMPILER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -215,4 +226,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLCOMPILER_P_H diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 3429813..1144639 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -58,6 +58,7 @@ #include "qmlscriptparser_p.h" QT_BEGIN_NAMESPACE + class QByteArray; int statusId = qRegisterMetaType("QmlComponent::Status"); @@ -564,4 +565,5 @@ void QmlComponent::completeCreate() d->completePending = false; } } + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index ae2f362..2e80b6b 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -54,6 +54,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlCompiledComponent; class QByteArray; class QmlComponentPrivate; diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h index 254d9ba..0be3dc6 100644 --- a/src/declarative/qml/qmlcomponent_p.h +++ b/src/declarative/qml/qmlcomponent_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPONENT_P_H #define QMLCOMPONENT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -87,6 +98,6 @@ public: void clear(); }; -#endif // QMLCOMPONENT_P_H - QT_END_NAMESPACE + +#endif // QMLCOMPONENT_P_H diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 9950b48..ef77803 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -50,6 +50,8 @@ #include #include +QT_BEGIN_NAMESPACE + QmlCompositeTypeData::QmlCompositeTypeData() : status(Invalid), errorType(NoError), component(0), compiledComponent(0) { @@ -365,3 +367,5 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) doComplete(unit); } } + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index 9312819..96e77d6 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPOSITETYPEMANAGER_P_H #define QMLCOMPOSITETYPEMANAGER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qmlcontext.h index 935c7ca..ce5fe52 100644 --- a/src/declarative/qml/qmlcontext.h +++ b/src/declarative/qml/qmlcontext.h @@ -99,7 +99,6 @@ private: QmlContext(QmlEngine *); }; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 4d88fc2..569b320 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -42,6 +42,17 @@ #ifndef QMLCONTEXT_P_H #define QMLCONTEXT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -50,6 +61,7 @@ #include QT_BEGIN_NAMESPACE + class QmlContext; class QmlExpression; class QmlEngine; @@ -99,6 +111,7 @@ public: QmlSimpleDeclarativeData contextData; QObjectList contextObjects; }; + QT_END_NAMESPACE #endif // QMLCONTEXT_P_H diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h index 75da579..67f39d9 100644 --- a/src/declarative/qml/qmlcustomparser_p.h +++ b/src/declarative/qml/qmlcustomparser_p.h @@ -42,6 +42,17 @@ #ifndef QMLCUSTOMPARSER_H #define QMLCUSTOMPARSER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/qml/qmlcustomparser_p_p.h b/src/declarative/qml/qmlcustomparser_p_p.h index 96e9b32..0011c3b 100644 --- a/src/declarative/qml/qmlcustomparser_p_p.h +++ b/src/declarative/qml/qmlcustomparser_p_p.h @@ -42,6 +42,17 @@ #ifndef QMLCUSTOMPARSER_P_H #define QMLCUSTOMPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include "qmlcustomparser_p.h" diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h index 85a80fa..559f0ee 100644 --- a/src/declarative/qml/qmldeclarativedata_p.h +++ b/src/declarative/qml/qmldeclarativedata_p.h @@ -42,6 +42,17 @@ #ifndef QMLDECLARATIVEDATA_P_H #define QMLDECLARATIVEDATA_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 5271dc5..8497bea 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -1571,4 +1571,3 @@ void QmlDomComponent::setComponentRoot(const QmlDomObject &root) } QT_END_NAMESPACE - diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h index 441269c..a7c3cc7 100644 --- a/src/declarative/qml/qmldom_p.h +++ b/src/declarative/qml/qmldom_p.h @@ -42,6 +42,17 @@ #ifndef QMLDOM_P_H #define QMLDOM_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index a1028e6..93ae704 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -42,6 +42,17 @@ #ifndef QMLENGINE_P_H #define QMLENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -61,6 +72,7 @@ #include QT_BEGIN_NAMESPACE + class QmlContext; class QmlEngine; class QmlContextPrivate; @@ -288,7 +300,7 @@ public: void addLog(const QmlExpressionLog &); QList *log; }; + QT_END_NAMESPACE #endif // QMLENGINE_P_H - diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index 15d026a..e8cac7a 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -109,7 +109,6 @@ Q_SIGNALS: void valueChanged(); }; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index a618fe7..1647a12 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -44,6 +44,7 @@ #include QT_BEGIN_NAMESPACE + void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) { QByteArray lineNumber = QByteArray::number(instr->line); diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index e3b0dfe..f2f3ac2 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -42,10 +42,21 @@ #ifndef QMLINSTRUCTION_P_H #define QMLINSTRUCTION_P_H -#include +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// +#include QT_BEGIN_NAMESPACE + class QmlCompiledComponent; class Q_DECLARATIVE_EXPORT QmlInstruction { @@ -283,6 +294,6 @@ public: void dump(QmlCompiledComponent *); }; -#endif // QMLINSTRUCTION_P_H - QT_END_NAMESPACE + +#endif // QMLINSTRUCTION_P_H diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qmllist.h index cc13924..80c3138 100644 --- a/src/declarative/qml/qmllist.h +++ b/src/declarative/qml/qmllist.h @@ -119,7 +119,6 @@ class Qml_ProxyList_ ##ListName : public QmlList \ friend class Qml_ProxyList_ ##ListName ; \ Qml_ProxyList_##ListName ListName; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 682b8ad..218fdf8 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -50,7 +50,6 @@ #include #include - QT_BEGIN_NAMESPACE class QMetaPropertyEx : public QMetaProperty diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index 738bfec..3bd9089 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -42,6 +42,17 @@ #ifndef QMLMETAPROPERTY_P_H #define QMLMETAPROPERTY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qmlmetaproperty.h" class QmlContext; @@ -79,4 +90,3 @@ public: }; #endif // QMLMETAPROPERTY_P_H - diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 8ce8571..f69e5e5 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -60,6 +60,7 @@ #include QT_BEGIN_NAMESPACE + #ifdef QT_BOOTSTRAPPED # ifndef QT_NO_GEOM_VARIANT # define QT_NO_GEOM_VARIANT diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 78040da..ef038f9 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -42,6 +42,17 @@ #ifndef QMLPARSER_P_H #define QMLPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/qml/qmlparserstatus.h b/src/declarative/qml/qmlparserstatus.h index 7c2e141..4db6d8c 100644 --- a/src/declarative/qml/qmlparserstatus.h +++ b/src/declarative/qml/qmlparserstatus.h @@ -68,7 +68,6 @@ private: }; Q_DECLARE_INTERFACE(QmlParserStatus, "com.trolltech.qml.QmlParserStatus") - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index ed1304a..3d5fa61 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -394,10 +394,8 @@ int QmlPrivate::list_interface_op(QmlPrivate::ListOp op, int val, return 0; } - -#endif // QMLPRIVATE_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLPRIVATE_H diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp index 18092c8..c6ff596 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.cpp +++ b/src/declarative/qml/qmlpropertyvaluesource.cpp @@ -42,8 +42,8 @@ #include "qmlpropertyvaluesource.h" #include "qml.h" - QT_BEGIN_NAMESPACE + /*! \class QmlPropertyValueSource \brief The QmlPropertyValueSource class is inherited by property value sources such as animations and bindings. diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qmlpropertyvaluesource.h index 9cef150..c142095 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.h +++ b/src/declarative/qml/qmlpropertyvaluesource.h @@ -46,12 +46,12 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QObjectPrivate; class QmlMetaProperty; class Q_DECLARATIVE_EXPORT QmlPropertyValueSource : public QObject @@ -71,9 +71,8 @@ private: }; QML_DECLARE_TYPE(QmlPropertyValueSource) -#endif // QMLPROPERTYVALUESOURCE_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLPROPERTYVALUESOURCE_H diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp index 06d8a50..5568bab 100644 --- a/src/declarative/qml/qmlproxymetaobject.cpp +++ b/src/declarative/qml/qmlproxymetaobject.cpp @@ -41,8 +41,8 @@ #include "qmlproxymetaobject_p.h" - QT_BEGIN_NAMESPACE + QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList *mList) : metaObjects(mList), proxies(0), parent(0), object(obj) { diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h index c0ce36e..736bd91 100644 --- a/src/declarative/qml/qmlproxymetaobject_p.h +++ b/src/declarative/qml/qmlproxymetaobject_p.h @@ -42,6 +42,17 @@ #ifndef QMLPROXYMETAOBJECT_P_H #define QMLPROXYMETAOBJECT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -53,6 +64,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlProxyMetaObject : public QAbstractDynamicMetaObject { public: diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp index 8f71f1b..6c409e1 100644 --- a/src/declarative/qml/qmlrefcount.cpp +++ b/src/declarative/qml/qmlrefcount.cpp @@ -41,6 +41,8 @@ #include "qmlrefcount_p.h" +QT_BEGIN_NAMESPACE + QmlRefCount::QmlRefCount() : refCount(1) { @@ -64,3 +66,5 @@ void QmlRefCount::release() delete this; } +QT_END_NAMESPACE + diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qmlrefcount_p.h index 1355c86..a87d596 100644 --- a/src/declarative/qml/qmlrefcount_p.h +++ b/src/declarative/qml/qmlrefcount_p.h @@ -42,6 +42,17 @@ #ifndef QMLREFCOUNT_P_H #define QMLREFCOUNT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index fb7492d..24e26de 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -886,5 +886,4 @@ void QmlScriptParser::addNamespacePath(const QString &path) _nameSpacePaths.insertMulti(QString(), path); } - QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h index b057e2b..15f165c 100644 --- a/src/declarative/qml/qmlscriptparser_p.h +++ b/src/declarative/qml/qmlscriptparser_p.h @@ -41,13 +41,24 @@ #ifndef QMLSCRIPTPARSER_P_H #define QMLSCRIPTPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include #include "qmlparser_p.h" - QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE QT_MODULE(Declarative) @@ -107,6 +118,7 @@ public: }; QT_END_NAMESPACE + QT_END_HEADER #endif // QMLSCRIPTPARSER_P_H diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qmlstringconverters_p.h index ed1f959..52426a7 100644 --- a/src/declarative/qml/qmlstringconverters_p.h +++ b/src/declarative/qml/qmlstringconverters_p.h @@ -42,6 +42,17 @@ #ifndef QMLSTRINGCONVERTERS_P_H #define QMLSTRINGCONVERTERS_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include class QColor; class QPointF; diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h index 149c82c..2da7bb4 100644 --- a/src/declarative/qml/qmlvme_p.h +++ b/src/declarative/qml/qmlvme_p.h @@ -42,11 +42,23 @@ #ifndef QMLVME_P_H #define QMLVME_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include QT_BEGIN_NAMESPACE + class QObject; class QmlInstruction; class QmlCompiledComponent; @@ -70,4 +82,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLVME_P_H diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index 4b2c64c..3b784a4 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -48,8 +48,8 @@ #include #include - QT_BEGIN_NAMESPACE + QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj, const QMetaObject *other, QList *strData, diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h index 17140ef..7b6fd2d 100644 --- a/src/declarative/qml/qmlvmemetaobject_p.h +++ b/src/declarative/qml/qmlvmemetaobject_p.h @@ -42,6 +42,17 @@ #ifndef QMLVMEMETAOBJECT_P_H #define QMLVMEMETAOBJECT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -73,4 +84,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLVMEMETAOBJECT_P_H diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h index 55c04e7..101c62d 100644 --- a/src/declarative/qml/qpodvector_p.h +++ b/src/declarative/qml/qpodvector_p.h @@ -42,6 +42,17 @@ #ifndef QPODVECTOR_P_H #define QPODVECTOR_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE @@ -119,6 +130,7 @@ private: int m_capacity; T *m_data; }; + QT_END_NAMESPACE #endif diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h index 6ba9409..6f2a9fb 100644 --- a/src/declarative/util/qfxglobal.h +++ b/src/declarative/util/qfxglobal.h @@ -45,12 +45,12 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + #if defined(QT_OPENGL_ES_1) #define QFX_CONFIGURATION_OPENGL1 #elif defined(QT_OPENGL_ES_2) @@ -117,8 +117,8 @@ inline void QFx_setParent_noEvent(QObject *object, QObject *parent) static_cast(object)->setParent_noEvent(parent); } - QT_END_NAMESPACE QT_END_HEADER + #endif // QFXGLOBAL_H diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index e4f0c53..9ac9e8d 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -41,8 +41,8 @@ #include "qfxperf.h" - QT_BEGIN_NAMESPACE + Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "Compilation: QML Parsing") Q_DEFINE_PERFORMANCE_METRIC(Compilation, " QML Compilation") @@ -64,4 +64,5 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, " QFxText::setText") Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine") } + QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h index 9fcf1d6..0bc0cc9 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -38,17 +38,17 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef _QFXPERF_H_ -#define _QFXPERF_H_ +#ifndef QFXPERF_H +#define QFXPERF_H #include "qperformancelog.h" - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(QmlParsing) @@ -73,9 +73,8 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(AddScript) } -#endif // _QFXPERF_H_ - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QFXPERF_H diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index d8d9ba1..0855224 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -62,8 +62,8 @@ #include #include - QT_BEGIN_NAMESPACE + DEFINE_BOOL_CONFIG_OPTION(itemTreeDump, ITEMTREE_DUMP); DEFINE_BOOL_CONFIG_OPTION(qmlDebugger, QML_DEBUGGER); @@ -561,4 +561,5 @@ void QFxView::dumpRoot() { root()->dump(); } + QT_END_NAMESPACE diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index b801d01..051516d 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -42,6 +42,17 @@ #ifndef QMLANIMATION_P_H #define QMLANIMATION_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -336,6 +347,6 @@ public: static void convertVariant(QVariant &variant, QVariant::Type type); }; -#endif // QMLANIMATION_P_H - QT_END_NAMESPACE + +#endif // QMLANIMATION_P_H diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index b45d07d..bb342bc 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -52,6 +52,7 @@ #include "qmlbind.h" QT_BEGIN_NAMESPACE + class QmlBindPrivate : public QObjectPrivate { public: diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 6c7b158..95f4573 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -46,8 +46,8 @@ #include #include - QT_BEGIN_NAMESPACE + class QmlConnectionPrivate : public QObjectPrivate { public: diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp index d3b3617..c6d806a 100644 --- a/src/declarative/util/qmlfollow.cpp +++ b/src/declarative/util/qmlfollow.cpp @@ -45,8 +45,8 @@ #include "qmlfollow.h" #include "private/qmlanimation_p.h" - QT_BEGIN_NAMESPACE + QML_DEFINE_TYPE(QmlFollow,Follow) class QmlFollowPrivate : public QObjectPrivate diff --git a/src/declarative/util/qmlfont.cpp b/src/declarative/util/qmlfont.cpp index c537a83..3075b82 100644 --- a/src/declarative/util/qmlfont.cpp +++ b/src/declarative/util/qmlfont.cpp @@ -43,8 +43,8 @@ #include "qfont.h" #include "qmlfont.h" - QT_BEGIN_NAMESPACE + class QmlFontPrivate : public QObjectPrivate { public: @@ -144,4 +144,5 @@ QFont QmlFont::font() const Q_D(const QmlFont); return d->font; } + QT_END_NAMESPACE diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index cc85661..1884e8b 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -567,4 +567,5 @@ ModelNode::~ModelNode() } QT_END_NAMESPACE + #include "qmllistmodel.moc" diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel.h index ddf1e13..56ed8fb 100644 --- a/src/declarative/util/qmllistmodel.h +++ b/src/declarative/util/qmllistmodel.h @@ -51,7 +51,6 @@ #include #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlnullablevalue_p.h b/src/declarative/util/qmlnullablevalue_p.h index f16ddd6..6455642 100644 --- a/src/declarative/util/qmlnullablevalue_p.h +++ b/src/declarative/util/qmlnullablevalue_p.h @@ -42,6 +42,19 @@ #ifndef QMLNULLABLEVALUE_P_H #define QMLNULLABLEVALUE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + template struct QmlNullableValue { @@ -63,5 +76,6 @@ struct QmlNullableValue T value; }; -#endif // QMLNULLABLEVALUE_P_H +QT_END_NAMESPACE +#endif // QMLNULLABLEVALUE_P_H diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp index d0dd817..7305362 100644 --- a/src/declarative/util/qmlopenmetaobject.cpp +++ b/src/declarative/util/qmlopenmetaobject.cpp @@ -43,7 +43,6 @@ #include "private/qmetaobjectbuilder_p.h" #include - QT_BEGIN_NAMESPACE class QmlOpenMetaObjectPrivate diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index e527c1f..eec769e 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -42,8 +42,8 @@ #include "private/qobject_p.h" #include "qmlpackage.h" - QT_BEGIN_NAMESPACE + class QmlPackagePrivate : public QObjectPrivate { public: @@ -150,4 +150,5 @@ QmlPackageAttached *QmlPackage::qmlAttachedProperties(QObject *o) QML_DEFINE_TYPE(QmlPackage, Package) QT_END_NAMESPACE + #include "qmlpackage.moc" diff --git a/src/declarative/util/qmlscript.h b/src/declarative/util/qmlscript.h index 09ebc2c..5b62da5 100644 --- a/src/declarative/util/qmlscript.h +++ b/src/declarative/util/qmlscript.h @@ -47,6 +47,7 @@ #include QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE QT_MODULE(Declarative) @@ -76,5 +77,7 @@ private Q_SLOTS: QML_DECLARE_TYPE(QmlScript) QT_END_NAMESPACE + QT_END_HEADER + #endif diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index 7ceed5e..7a68ba2 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -49,8 +49,8 @@ #include #include - QT_BEGIN_NAMESPACE + /*! \qmlclass SetProperties QmlSetProperties \brief The SetProperties element describes new property values for a state. diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index fe98900..717d0ee 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -44,7 +44,6 @@ #include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 2f6ff42..1b784f3 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -42,6 +42,17 @@ #ifndef QMLSTATE_P_H #define QMLSTATE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index 57ccd37..2b1cf7d 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -45,8 +45,8 @@ #include "qmltransition.h" #include - QT_BEGIN_NAMESPACE + DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); QML_DEFINE_TYPE(QmlStateGroup,StateGroup) diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp index 8065f9d..932e4b3 100644 --- a/src/declarative/util/qperformancelog.cpp +++ b/src/declarative/util/qperformancelog.cpp @@ -43,6 +43,7 @@ #include #include +QT_BEGIN_NAMESPACE #ifdef Q_ENABLE_PERFORMANCE_LOG @@ -175,3 +176,5 @@ void QPerformanceLog::clear() } #endif // Q_ENABLE_PERFORMANCE_LOG + +QT_END_NAMESPACE diff --git a/src/declarative/util/qperformancelog.h b/src/declarative/util/qperformancelog.h index 3203685..6655a8d 100644 --- a/src/declarative/util/qperformancelog.h +++ b/src/declarative/util/qperformancelog.h @@ -43,6 +43,9 @@ #define QPERFORMANCELOG_H #include + +QT_BEGIN_NAMESPACE + namespace QPerformanceLog { Q_DECLARATIVE_EXPORT void displayData(); @@ -133,4 +136,6 @@ namespace QPerformanceLog #endif // Q_ENABLE_PERFORMANCE_LOG +QT_END_NAMESPACE + #endif // QPERFORMANCELOG_H diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts.h index 303f749..525a848 100644 --- a/src/declarative/widgets/graphicslayouts.h +++ b/src/declarative/widgets/graphicslayouts.h @@ -183,8 +183,8 @@ private: }; QML_DECLARE_TYPE(QGraphicsGridLayoutObject) -#endif // GRAPHICSLAYOUTS_H - QT_END_NAMESPACE QT_END_HEADER + +#endif // GRAPHICSLAYOUTS_H diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp index 86509f5..e7d01e3 100644 --- a/src/declarative/widgets/graphicswidgets.cpp +++ b/src/declarative/widgets/graphicswidgets.cpp @@ -168,6 +168,6 @@ QML_DEFINE_EXTENDED_TYPE(QGraphicsWidget,QGraphicsWidget,QGraphicsWidgetDeclarat QML_DEFINE_INTERFACE(QGraphicsItem) -#include "graphicswidgets.moc" - QT_END_NAMESPACE + +#include "graphicswidgets.moc" -- cgit v0.12 From dba327eec1a308e61c2bd21941ba982fb9283827 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 30 Jun 2009 14:39:52 +1000 Subject: Add a simple folder model. --- src/declarative/extra/extra.pri | 2 + src/declarative/extra/qmlfolderlistmodel.cpp | 178 +++++++++++++++++++++++++++ src/declarative/extra/qmlfolderlistmodel.h | 100 +++++++++++++++ 3 files changed, 280 insertions(+) create mode 100644 src/declarative/extra/qmlfolderlistmodel.cpp create mode 100644 src/declarative/extra/qmlfolderlistmodel.h diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index 2590fbc..7244f98 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -2,12 +2,14 @@ SOURCES += \ extra/qnumberformat.cpp \ extra/qmlnumberformatter.cpp \ extra/qfxintegermodel.cpp \ + extra/qmlfolderlistmodel.cpp \ extra/qmltimer.cpp HEADERS += \ extra/qnumberformat.h \ extra/qmlnumberformatter.h \ extra/qfxintegermodel.h \ + extra/qmlfolderlistmodel.h \ extra/qmltimer.h contains(QT_CONFIG, xmlpatterns) { diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp new file mode 100644 index 0000000..43ffd5c --- /dev/null +++ b/src/declarative/extra/qmlfolderlistmodel.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qobject_p.h" +#include +#include +#include "qmlfolderlistmodel.h" + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlFolderListModelPrivate : public QObjectPrivate +{ +public: + QmlFolderListModelPrivate() { + folderIndex = model.index(0,0); + } + + QDirModel model; + QString folder; + QStringList nameFilters; + QModelIndex folderIndex; +}; + +QmlFolderListModel::QmlFolderListModel(QObject *parent) + : QListModelInterface(*(new QmlFolderListModelPrivate), parent) +{ + Q_D(QmlFolderListModel); + d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives); + connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) + , this, SLOT(inserted(const QModelIndex&,int,int))); +} + +QmlFolderListModel::~QmlFolderListModel() +{ +} + +QHash QmlFolderListModel::data(int index, const QList &roles) const +{ + Q_D(const QmlFolderListModel); + QHash folderData; + QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex); + if (modelIndex.isValid()) { + folderData[QDirModel::FileNameRole] = d->model.data(modelIndex, QDirModel::FileNameRole); + folderData[QDirModel::FilePathRole] = d->model.data(modelIndex, QDirModel::FilePathRole); + } + + return folderData; +} + +int QmlFolderListModel::count() const +{ + Q_D(const QmlFolderListModel); + if (!d->folderIndex.isValid()) + return 0; + return d->model.rowCount(d->folderIndex); +} + +QList QmlFolderListModel::roles() const +{ + QList r; + r << QDirModel::FileNameRole; + r << QDirModel::FilePathRole; + return r; +} + +QString QmlFolderListModel::toString(int role) const +{ + switch (role) { + case QDirModel::FileNameRole: + return QLatin1String("fileName"); + case QDirModel::FilePathRole: + return QLatin1String("filePath"); + } + + return QString(); +} + +QString QmlFolderListModel::folder() const +{ + Q_D(const QmlFolderListModel); + return d->folder; +} + +void QmlFolderListModel::setFolder(const QString &folder) +{ + Q_D(QmlFolderListModel); + QModelIndex index = d->model.index(folder); + if (index.isValid() && d->model.isDir(index)) { + d->folder = folder; + QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); + } +} + +QStringList QmlFolderListModel::nameFilters() const +{ + Q_D(const QmlFolderListModel); + return d->nameFilters; +} + +void QmlFolderListModel::setNameFilters(const QStringList &filters) +{ + Q_D(QmlFolderListModel); + d->nameFilters = filters; + QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); +} + +void QmlFolderListModel::classComplete() +{ +} + +bool QmlFolderListModel::isFolder(int index) const +{ + Q_D(const QmlFolderListModel); + return d->model.isDir(d->model.index(index, 0, d->folderIndex)); +} + +void QmlFolderListModel::refresh() +{ + Q_D(QmlFolderListModel); + int prevCount = count(); + d->folderIndex = QModelIndex(); + emit itemsRemoved(0, prevCount); + d->folderIndex = d->model.index(d->folder); + emit itemsInserted(0, count()); +} + +void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) +{ + Q_D(QmlFolderListModel); + qDebug() << "inserted" << start << end; + if (index == d->folderIndex) + emit itemsInserted(start, end - start + 1); +} + +QML_DEFINE_TYPE(QmlFolderListModel,FolderListModel) + +QT_END_NAMESPACE + diff --git a/src/declarative/extra/qmlfolderlistmodel.h b/src/declarative/extra/qmlfolderlistmodel.h new file mode 100644 index 0000000..c8b605a --- /dev/null +++ b/src/declarative/extra/qmlfolderlistmodel.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLFOLDERLISTMODEL_H +#define QMLFOLDERLISTMODEL_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlContext; +class QModelIndex; + +class QmlFolderListModelPrivate; +class Q_DECLARATIVE_EXPORT QmlFolderListModel : public QListModelInterface, public QmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QmlParserStatus) + + Q_PROPERTY(QString folder READ folder WRITE setFolder) + Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) + +public: + QmlFolderListModel(QObject *parent = 0); + ~QmlFolderListModel(); + + virtual QHash data(int index, const QList &roles = (QList())) const; + virtual int count() const; + virtual QList roles() const; + virtual QString toString(int role) const; + + QString folder() const; + void setFolder(const QString &folder); + + QStringList nameFilters() const; + void setNameFilters(const QStringList &filters); + + virtual void classComplete(); + + Q_INVOKABLE bool isFolder(int index) const; + +private Q_SLOTS: + void refresh(); + void inserted(const QModelIndex &index, int start, int end); + +private: + Q_DECLARE_PRIVATE(QmlFolderListModel) + Q_DISABLE_COPY(QmlFolderListModel) +}; + +QML_DECLARE_TYPE(QmlFolderListModel) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLFOLDERLISTMODEL_H -- cgit v0.12 From 5732bf283683f0444dbec740cc26c995d9464de6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 30 Jun 2009 16:26:44 +1000 Subject: Simple QML browser/loader. --- examples/declarative/loader/loader.pro | 9 ++++++ examples/declarative/loader/loader.qml | 41 ++++++++++++++++++++++++++++ examples/declarative/loader/loader.qrc | 5 ++++ examples/declarative/loader/main.cpp | 18 ++++++++++++ src/declarative/extra/qmlfolderlistmodel.cpp | 18 +++++++++--- src/declarative/extra/qmlfolderlistmodel.h | 5 +++- 6 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 examples/declarative/loader/loader.pro create mode 100644 examples/declarative/loader/loader.qml create mode 100644 examples/declarative/loader/loader.qrc create mode 100644 examples/declarative/loader/main.cpp diff --git a/examples/declarative/loader/loader.pro b/examples/declarative/loader/loader.pro new file mode 100644 index 0000000..baa5b8c --- /dev/null +++ b/examples/declarative/loader/loader.pro @@ -0,0 +1,9 @@ +SOURCES = main.cpp +RESOURCES = loader.qrc + +QT += script declarative + +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/loader +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS loader.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/loader +INSTALLS += target sources diff --git a/examples/declarative/loader/loader.qml b/examples/declarative/loader/loader.qml new file mode 100644 index 0000000..4dd7a03 --- /dev/null +++ b/examples/declarative/loader/loader.qml @@ -0,0 +1,41 @@ +Rect { + id: Root + width: 300 + height: 400 + FolderListModel { + id: folders + nameFilters: [ "*.qml" ] + } + + Component { + id: FolderDelegate + Text { + id: Wrapper + width: Root.width + text: fileName + font.bold: true + font.size: 14 + MouseRegion { + anchors.fill: parent + onClicked: { + if (folders.isFolder(index)) { + folders.folder = filePath; + } else { + Root.qml = filePath; + } + } + } + } + } + + Text { id: DirText; text: folders.folder } + + ListView { + anchors.top: DirText.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + model: folders + delegate: FolderDelegate + } +} diff --git a/examples/declarative/loader/loader.qrc b/examples/declarative/loader/loader.qrc new file mode 100644 index 0000000..8c80052 --- /dev/null +++ b/examples/declarative/loader/loader.qrc @@ -0,0 +1,5 @@ + + + loader.qml + + diff --git a/examples/declarative/loader/main.cpp b/examples/declarative/loader/main.cpp new file mode 100644 index 0000000..31bff07 --- /dev/null +++ b/examples/declarative/loader/main.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QFxView *canvas = new QFxView; + canvas->setUrl(QUrl("qrc:/loader.qml")); + canvas->execute(); + canvas->resize(210,240); + canvas->show(); + + return app.exec(); +} + + diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp index 43ffd5c..abec01e 100644 --- a/src/declarative/extra/qmlfolderlistmodel.cpp +++ b/src/declarative/extra/qmlfolderlistmodel.cpp @@ -52,7 +52,8 @@ class QmlFolderListModelPrivate : public QObjectPrivate { public: QmlFolderListModelPrivate() { - folderIndex = model.index(0,0); + folder = QDir::currentPath(); + nameFilters << "*"; } QDirModel model; @@ -124,10 +125,13 @@ QString QmlFolderListModel::folder() const void QmlFolderListModel::setFolder(const QString &folder) { Q_D(QmlFolderListModel); + if (folder == d->folder) + return; QModelIndex index = d->model.index(folder); if (index.isValid() && d->model.isDir(index)) { d->folder = folder; QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); + emit folderChanged(); } } @@ -141,11 +145,14 @@ void QmlFolderListModel::setNameFilters(const QStringList &filters) { Q_D(QmlFolderListModel); d->nameFilters = filters; - QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); + d->model.setNameFilters(d->nameFilters); } void QmlFolderListModel::classComplete() { + Q_D(QmlFolderListModel); + if (!d->folderIndex.isValid()) + QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); } bool QmlFolderListModel::isFolder(int index) const @@ -159,9 +166,12 @@ void QmlFolderListModel::refresh() Q_D(QmlFolderListModel); int prevCount = count(); d->folderIndex = QModelIndex(); - emit itemsRemoved(0, prevCount); + if (prevCount) + emit itemsRemoved(0, prevCount); d->folderIndex = d->model.index(d->folder); - emit itemsInserted(0, count()); + qDebug() << "count" << count(); + if (count()) + emit itemsInserted(0, count()); } void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) diff --git a/src/declarative/extra/qmlfolderlistmodel.h b/src/declarative/extra/qmlfolderlistmodel.h index c8b605a..a6e8526 100644 --- a/src/declarative/extra/qmlfolderlistmodel.h +++ b/src/declarative/extra/qmlfolderlistmodel.h @@ -60,7 +60,7 @@ class Q_DECLARATIVE_EXPORT QmlFolderListModel : public QListModelInterface, publ Q_OBJECT Q_INTERFACES(QmlParserStatus) - Q_PROPERTY(QString folder READ folder WRITE setFolder) + Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) public: @@ -82,6 +82,9 @@ public: Q_INVOKABLE bool isFolder(int index) const; +Q_SIGNALS: + void folderChanged(); + private Q_SLOTS: void refresh(); void inserted(const QModelIndex &index, int start, int end); -- cgit v0.12