diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-22 03:47:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-22 03:47:36 (GMT) |
commit | 8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8 (patch) | |
tree | e4306daf00a4deb05e1a4ad447c9e3327494aebc | |
parent | 6ddbc147cadc4d450bb8e20cedf1b99e0fcbf894 (diff) | |
parent | 2575eac4c26ad92dde95959a82f576edc3e76e1d (diff) | |
download | Qt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.zip Qt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.tar.gz Qt-8858ba20bc2b9f5bcb58cf95a50bd6dfc4dc29a8.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
143 files changed, 2970 insertions, 1227 deletions
diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index b113f56..da77d93 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -122,6 +122,8 @@ Item { Image { source: "content/pics/background.png"; opaque: true; anchors.fill: parent } + Loading { anchors.centeredIn: parent; visible: FeedModel.status != 0 } + GridView { id: PhotoGridView; model: FeedModel; delegate: PhotoDelegate; cacheBuffer: 100 cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1 diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml index 5368e75..3258ea6 100644 --- a/examples/declarative/follow/follow.qml +++ b/examples/declarative/follow/follow.qml @@ -8,8 +8,12 @@ Rect { y: SequentialAnimation { running: true; repeat: true NumericAnimation { + to: 20; duration: 500 + easing: "easeInOutQuad" + } + NumericAnimation { to: 200; duration: 2000 - easing: "easeOutBounce(amplitude:180)" + easing: "easeOutBounce" } PauseAnimation { duration: 1000 } } diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index cd50945..fbd5014 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -957,9 +957,14 @@ bool QSimpleCanvas::event(QEvent *e) queueUpdate(); return true; - } else { - return QWidget::event(e); } + + if (e->type() == QEvent::ShortcutOverride) { + if (QSimpleCanvasItem *focus = focusItem()) + return focus->event(e); + } + + return QWidget::event(e); } void QSimpleCanvas::paintEvent(QPaintEvent *) diff --git a/src/declarative/debugger/qmlcanvasdebugger.cpp b/src/declarative/debugger/qmlcanvasdebugger.cpp index fe57bf4..21abd2d 100644 --- a/src/declarative/debugger/qmlcanvasdebugger.cpp +++ b/src/declarative/debugger/qmlcanvasdebugger.cpp @@ -76,7 +76,7 @@ QmlCanvasDebugger::QmlCanvasDebugger(QmlWatches *w, QWidget *parent) QObject::connect(y, SIGNAL(valueChanged(int)), this, SLOT(setY(int))); hlayout->addWidget(x); hlayout->addWidget(y); - QPushButton *pb = new QPushButton("Refresh", this); + QPushButton *pb = new QPushButton(tr("Refresh"), this); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(refresh())); hlayout->addWidget(pb); @@ -233,7 +233,7 @@ void QmlCanvasDebugger::setCanvas(QSimpleCanvas *canvas) return; QTreeWidgetItem *root = new QmlCanvasDebuggerItem(m_tree); - root->setText(0, "Root"); + root->setText(0, tr("Root")); root->setExpanded(true); clone(root, m_canvasRoot, m_debugCanvas->root()); } diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp index 49ad8d9..0bbcb2c 100644 --- a/src/declarative/debugger/qmldebugger.cpp +++ b/src/declarative/debugger/qmldebugger.cpp @@ -85,7 +85,7 @@ QmlDebugger::QmlDebugger(QWidget *parent) QObject::connect(m_tree, SIGNAL(addWatch(QObject*,QString)), this, SLOT(addWatch(QObject*,QString))); vlayout->addWidget(m_tree); - QPushButton *pb = new QPushButton("Refresh", treeWid); + QPushButton *pb = new QPushButton(tr("Refresh"), treeWid); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(refresh())); vlayout->addWidget(pb); @@ -93,28 +93,28 @@ QmlDebugger::QmlDebugger(QWidget *parent) m_text = new QPlainTextEdit(this); m_text->setReadOnly(true); - tabs->addTab(m_text, "File"); + tabs->addTab(m_text, tr("File")); m_warnings = new QTreeWidget(this); m_warnings->setHeaderHidden(true); - tabs->addTab(m_warnings, "Warnings"); + tabs->addTab(m_warnings, tr("Warnings")); m_watches = new QmlWatches(this); m_watchTable = new QTableView(this); m_watchTable->setSelectionMode(QTableWidget::NoSelection); m_watchTable->setModel(m_watches); - tabs->addTab(m_watchTable, "Watches"); + tabs->addTab(m_watchTable, tr("Watches")); m_properties = new QmlPropertyView(m_watches, this); QObject::connect(m_properties, SIGNAL(objectClicked(quint32)), this, SLOT(highlightObject(quint32))); - tabs->addTab(m_properties, "Properties"); + tabs->addTab(m_properties, tr("Properties")); tabs->setCurrentWidget(m_properties); m_canvas = new QmlCanvasDebugger(m_watches, this); QObject::connect(m_canvas, SIGNAL(objectClicked(quint32)), this, SLOT(highlightObject(quint32))); - tabs->addTab(m_canvas, "Canvas"); + tabs->addTab(m_canvas, tr("Canvas")); splitter->addWidget(tabs); splitter->setStretchFactor(1, 2); @@ -229,7 +229,7 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) if(QmlBindableValue *bv = qobject_cast<QmlBindableValue *>(obj)) { QmlExpressionPrivate *p = bv->d; - text = bv->property().name() + ": " + bv->expression(); + text = bv->property().name() + QLatin1String(": ") + bv->expression(); item->setForeground(0, Qt::green); item->bindableValue = bv; @@ -281,13 +281,13 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) QString toolTipString; if(!p->url.toString().isEmpty()) { item->url = p->url; - toolTipString = "URL: " + p->url.toString(); + toolTipString = QLatin1String("URL: ") + p->url.toString(); } if(!p->typeName.isEmpty()) { if(!toolTipString.isEmpty()) - toolTipString.prepend("\n"); - toolTipString.prepend("Root type: " + text); + toolTipString.prepend(QLatin1Char('\n')); + toolTipString.prepend(tr("Root type: ") + text); text = p->typeName; } diff --git a/src/declarative/debugger/qmlobjecttree.cpp b/src/declarative/debugger/qmlobjecttree.cpp index fb6825a..27dc000 100644 --- a/src/declarative/debugger/qmlobjecttree.cpp +++ b/src/declarative/debugger/qmlobjecttree.cpp @@ -57,7 +57,7 @@ void QmlObjectTree::mousePressEvent(QMouseEvent *me) { QTreeWidget::mousePressEvent(me); if(me->button() == Qt::RightButton && me->type() == QEvent::MouseButtonPress) { - QAction action("Add watch...", 0); + QAction action(tr("Add watch..."), 0); QList<QAction *> actions; actions << &action; QmlDebuggerItem *item = static_cast<QmlDebuggerItem *>(currentItem()); @@ -65,7 +65,7 @@ void QmlObjectTree::mousePressEvent(QMouseEvent *me) QMenu::exec(actions, me->globalPos())) { bool ok = false; - QString watch = QInputDialog::getText(this, "Watch expression", "Expression:", QLineEdit::Normal, QString(), &ok); + QString watch = QInputDialog::getText(this, tr("Watch expression"), tr("Expression:"), QLineEdit::Normal, QString(), &ok); if(ok && !watch.isEmpty()) emit addWatch(item->object, watch); diff --git a/src/declarative/debugger/qmlpropertyview.cpp b/src/declarative/debugger/qmlpropertyview.cpp index e32393c..0d34fd9 100644 --- a/src/declarative/debugger/qmlpropertyview.cpp +++ b/src/declarative/debugger/qmlpropertyview.cpp @@ -56,7 +56,7 @@ QmlPropertyView::QmlPropertyView(QmlWatches *watches, QWidget *parent) setLayout(layout); m_tree = new QTreeWidget(this); - m_tree->setHeaderLabels(QStringList() << "Property" << "Value"); + m_tree->setHeaderLabels(QStringList() << tr("Property") << tr("Value")); QObject::connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem *))); QObject::connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index bba817d..9259c83 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -45,6 +45,10 @@ #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlengine.h> #include <QDebug> +#include <QApplication> +#include <QThread> +#include <QMutex> +#include <QWaitCondition> #include <QXmlQuery> #include <QXmlResultItems> #include <QXmlNodeModelIndex> @@ -57,6 +61,197 @@ QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(XmlListModelRole, Role); QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); + +class QmlXmlListModelPrivate; +struct QmlXmlRoleList : public QmlConcreteList<XmlListModelRole *> +{ + QmlXmlRoleList(QmlXmlListModelPrivate *p) + : model(p) {} + virtual void append(XmlListModelRole *role); + //XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well + // (and the model should emit the appropriate signals) + virtual void clear(); + virtual void removeAt(int i); + virtual void insert(int i, XmlListModelRole *role); + + QmlXmlListModelPrivate *model; +}; + + + +class QmlXmlQuery : public QThread +{ + Q_OBJECT +public: + QmlXmlQuery(QObject *parent=0) + : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) { + } + ~QmlXmlQuery() { + m_mutex.lock(); + m_quit = true; + m_condition.wakeOne(); + m_mutex.unlock(); + + wait(); + } + + void abort() { + QMutexLocker locker(&m_mutex); + m_abort = true; + } + + int doQuery(QString query, QString namespaces, QByteArray data, QmlXmlRoleList *roleObjects) { + QMutexLocker locker(&m_mutex); + m_modelData.clear(); + m_size = 0; + m_data = data; + m_query = query; + m_namespaces = namespaces; + m_roleObjects = roleObjects; + if (!isRunning()) { + m_abort = false; + start(); + } else { + m_restart = true; + m_condition.wakeOne(); + } + m_queryId++; + return m_queryId; + } + + QList<QList<QVariant> > modelData() { + QMutexLocker locker(&m_mutex); + return m_modelData; + } + +signals: + void queryCompleted(int queryId, int size); + +protected: + void run() { + while (!m_quit) { + m_mutex.lock(); + int queryId = m_queryId; + doQueryJob(); + if (m_size > 0) + doSubQueryJob(); + m_data.clear(); // no longer needed + m_mutex.unlock(); + + m_mutex.lock(); + if (!m_abort && m_size > 0) + emit queryCompleted(queryId, m_size); + if (!m_restart) + m_condition.wait(&m_mutex); + m_abort = false; + m_restart = false; + m_mutex.unlock(); + } + } + +private: + void doQueryJob(); + void doSubQueryJob(); + +private: + QMutex m_mutex; + QWaitCondition m_condition; + bool m_quit; + bool m_restart; + bool m_abort; + QByteArray m_data; + QString m_query; + QString m_namespaces; + QString m_prefix; + int m_size; + int m_queryId; + const QmlXmlRoleList *m_roleObjects; + QList<QList<QVariant> > m_modelData; +}; + +void QmlXmlQuery::doQueryJob() +{ + QString r; + QXmlQuery query; + QBuffer buffer(&m_data); + buffer.open(QIODevice::ReadOnly); + query.bindVariable(QLatin1String("src"), &buffer); + query.setQuery(m_namespaces + m_query); + query.evaluateTo(&r); + + //qDebug() << r; + + //always need a single root element + QByteArray xml = "<dummy:items xmlns:dummy=\"http://qtsotware.com/dummy\">\n" + r.toUtf8() + "</dummy:items>"; + QBuffer b(&xml); + b.open(QIODevice::ReadOnly); + //qDebug() << xml; + + QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + m_namespaces; + QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + + m_query.mid(m_query.lastIndexOf(QLatin1Char('/'))); + + //figure out how many items we are dealing with + int count = -1; + { + QXmlResultItems result; + QXmlQuery countquery; + countquery.bindVariable(QLatin1String("inputDocument"), &b); + countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1String(")")); + countquery.evaluateTo(&result); + QXmlItem item(result.next()); + if (item.isAtomicValue()) + count = item.toAtomicValue().toInt(); + prefix += QLatin1String("[%1]/"); + } + //qDebug() << count; + + m_prefix = namespaces + prefix; + m_data = xml; + if (count > 0) + m_size = count; +} + +void QmlXmlQuery::doSubQueryJob() +{ + m_modelData.clear(); + + QBuffer b(&m_data); + b.open(QIODevice::ReadOnly); + + QXmlQuery subquery; + subquery.bindVariable(QLatin1String("inputDocument"), &b); + + //XXX should we use an array of objects or something else rather than a table? + for (int j = 0; j < m_size; ++j) { + QList<QVariant> resultList; + for (int i = 0; i < m_roleObjects->size(); ++i) { + XmlListModelRole *role = m_roleObjects->at(i); + subquery.setQuery(m_prefix.arg(j+1) + role->query()); + if (role->isStringList()) { + QStringList data; + subquery.evaluateTo(&data); + resultList << QVariant(data); + //qDebug() << data; + } else { + QString s; + subquery.evaluateTo(&s); + if (role->isCData()) { + //un-escape + s.replace(QLatin1String("<"), QLatin1String("<")); + s.replace(QLatin1String(">"), QLatin1String(">")); + s.replace(QLatin1String("&"), QLatin1String("&")); + } + resultList << s.trimmed(); + //qDebug() << s; + } + b.seek(0); + } + m_modelData << resultList; + } +} + + //TODO: do something smart while waiting for data to load // error handling (currently quite fragile) // profile doQuery and doSubquery @@ -64,6 +259,62 @@ QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); // support complex/nested objects? // how do we handle data updates (like rss feed -- usually items inserted at beginning) + +class QmlXmlListModelPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlXmlListModel) +public: + QmlXmlListModelPrivate() + : isClassComplete(false), size(-1), highestRole(Qt::UserRole) + , reply(0), status(QmlXmlListModel::Idle), progress(0.0) + , queryId(-1), roleObjects(this) {} + + bool isClassComplete; + QString src; + QString query; + QString namespaces; + int size; + QList<int> roles; + QStringList roleNames; + int highestRole; + QNetworkReply *reply; + QmlXmlListModel::Status status; + qreal progress; + QmlXmlQuery qmlXmlQuery; + int queryId; + QmlXmlRoleList roleObjects; + QList<QList<QVariant> > data; +}; + + +void QmlXmlRoleList::append(XmlListModelRole *role) { + QmlConcreteList<XmlListModelRole *>::append(role); + model->roles << model->highestRole; + model->roleNames << role->name(); + ++model->highestRole; +} +//XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well +// (and the model should emit the appropriate signals) +void QmlXmlRoleList::clear() +{ + model->roles.clear(); + model->roleNames.clear(); + QmlConcreteList<XmlListModelRole *>::clear(); +} +void QmlXmlRoleList::removeAt(int i) +{ + model->roles.removeAt(i); + model->roleNames.removeAt(i); + QmlConcreteList<XmlListModelRole *>::removeAt(i); +} +void QmlXmlRoleList::insert(int i, XmlListModelRole *role) +{ + QmlConcreteList<XmlListModelRole *>::insert(i, role); + model->roles.insert(i, model->highestRole); + model->roleNames.insert(i, role->name()); + ++model->highestRole; +} + /*! \qmlclass XmlListModel \brief The XmlListModel class allows you to specify a model using XQuery. @@ -86,67 +337,12 @@ QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); \note The model is currently static, so the above is really just a snapshot of an RSS feed. */ -class QmlXmlListModelPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlXmlListModel) -public: - QmlXmlListModelPrivate() : isClassComplete(false), size(-1), highestRole(Qt::UserRole), reply(0), roleObjects(this) {} - - bool isClassComplete; - QString src; - QString query; - QString namespaces; - QList<int> roles; - QStringList roleNames; - mutable QList<QList<QVariant> > data; - int size; - int highestRole; - QNetworkReply *reply; - mutable QByteArray xml; - QString prefix; - - struct RoleList : public QmlConcreteList<XmlListModelRole *> - { - RoleList(QmlXmlListModelPrivate *p) - : model(p) {} - virtual void append(XmlListModelRole *role) { - QmlConcreteList<XmlListModelRole *>::append(role); - model->roles << model->highestRole; - model->roleNames << role->name(); - ++model->highestRole; - } - //XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well - // (and the model should emit the appropriate signals) - virtual void clear() - { - model->roles.clear(); - model->roleNames.clear(); - QmlConcreteList<XmlListModelRole *>::clear(); - } - virtual void removeAt(int i) - { - model->roles.removeAt(i); - model->roleNames.removeAt(i); - QmlConcreteList<XmlListModelRole *>::removeAt(i); - } - virtual void insert(int i, XmlListModelRole *role) - { - QmlConcreteList<XmlListModelRole *>::insert(i, role); - model->roles.insert(i, model->highestRole); - model->roleNames.insert(i, role->name()); - ++model->highestRole; - } - - QmlXmlListModelPrivate *model; - }; - - RoleList roleObjects; -}; - QmlXmlListModel::QmlXmlListModel(QObject *parent) : QListModelInterface(*(new QmlXmlListModelPrivate), parent) { Q_D(QmlXmlListModel); + connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)), + this, SLOT(queryCompleted(int,int))); } QmlXmlListModel::~QmlXmlListModel() @@ -163,10 +359,6 @@ QHash<int,QVariant> QmlXmlListModel::data(int index, const QList<int> &roles) co { Q_D(const QmlXmlListModel); QHash<int, QVariant> rv; - - if (index > d->data.count() - 1) - doSubquery(index); - for (int i = 0; i < roles.size(); ++i) { int role = roles.at(i); int roleIndex = d->roles.indexOf(role); @@ -240,6 +432,17 @@ void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations) reload(); } } +QmlXmlListModel::Status QmlXmlListModel::status() const +{ + Q_D(const QmlXmlListModel); + return d->status; +} + +qreal QmlXmlListModel::progress() const +{ + Q_D(const QmlXmlListModel); + return d->progress; +} void QmlXmlListModel::classComplete() { @@ -255,6 +458,9 @@ void QmlXmlListModel::reload() if (!d->isClassComplete) return; + d->qmlXmlQuery.abort(); + d->queryId = -1; + //clear existing data d->size = 0; int count = d->data.count(); @@ -272,12 +478,17 @@ void QmlXmlListModel::reload() d->reply->deleteLater(); d->reply = 0; } + d->progress = 0.0; + d->status = Loading; + emit progressChanged(d->progress); + emit statusChanged(d->status); QNetworkRequest req((QUrl(d->src))); req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req); - QObject::connect(d->reply, SIGNAL(finished()), - this, SLOT(requestFinished())); + QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(requestFinished())); + QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(requestProgress(qint64,qint64))); } void QmlXmlListModel::requestFinished() @@ -286,100 +497,40 @@ void QmlXmlListModel::requestFinished() if (d->reply->error() != QNetworkReply::NoError) { d->reply->deleteLater(); d->reply = 0; + d->status = Error; } else { + d->status = Idle; QByteArray data = d->reply->readAll(); - doQuery(data); + d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); d->reply->deleteLater(); d->reply = 0; } + d->progress = 1.0; + emit progressChanged(d->progress); + emit statusChanged(d->status); } -void QmlXmlListModel::doQuery(QByteArray &rawData) +void QmlXmlListModel::requestProgress(qint64 received, qint64 total) { Q_D(QmlXmlListModel); - QString r; - QXmlQuery query; - QBuffer rawBuffer(&rawData); - rawBuffer.open(QIODevice::ReadOnly); - query.bindVariable(QLatin1String("src"), &rawBuffer); - query.setQuery(d->namespaces + d->query); - query.evaluateTo(&r); - //qDebug() << r; - - //always need a single root element - QByteArray xml = "<dummy:items xmlns:dummy=\"http://qtsotware.com/dummy\">\n" + r.toUtf8() + "</dummy:items>"; - QBuffer b(&xml); - b.open(QIODevice::ReadOnly); - //qDebug() << xml; - - QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + d->namespaces; - QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + - d->query.mid(d->query.lastIndexOf(QLatin1Char('/'))); - - //figure out how many items we are dealing with - int count = -1; - { - QXmlResultItems result; - QXmlQuery countquery; - countquery.bindVariable(QLatin1String("inputDocument"), &b); - countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1String(")")); - countquery.evaluateTo(&result); - QXmlItem item(result.next()); - if (item.isAtomicValue()) - count = item.toAtomicValue().toInt(); - b.seek(0); - prefix += QLatin1String("[%1]/"); + if (d->status == Loading && total > 0) { + d->progress = qreal(received)/total; + emit progressChanged(d->progress); } - //qDebug() << count; - - QXmlQuery subquery; - subquery.bindVariable(QLatin1String("inputDocument"), &b); - d->prefix = namespaces + prefix; - d->xml = xml; - - d->size = count; - - if (count > 0) - emit itemsInserted(0, count); } -void QmlXmlListModel::doSubquery(int index) const +void QmlXmlListModel::queryCompleted(int id, int size) { - Q_D(const QmlXmlListModel); - //qDebug() << "doSubQuery" << index; - QBuffer b(&d->xml); - b.open(QIODevice::ReadOnly); - - QXmlQuery subquery; - subquery.bindVariable(QLatin1String("inputDocument"), &b); - - //XXX should we use an array of objects or something else rather than a table? - for (int j = d->data.count(); j <= index; ++j) { - QList<QVariant> resultList; - for (int i = 0; i < d->roleObjects.size(); ++i) { - XmlListModelRole *role = d->roleObjects.at(i); - subquery.setQuery(d->prefix.arg(j+1) + role->query()); - if (role->isStringList()) { - QStringList data; - subquery.evaluateTo(&data); - resultList << QVariant(data); - //qDebug() << data; - } else { - QString s; - subquery.evaluateTo(&s); - if (role->isCData()) { - //un-escape - s.replace(QLatin1String("<"), QLatin1String("<")); - s.replace(QLatin1String(">"), QLatin1String(">")); - s.replace(QLatin1String("&"), QLatin1String("&")); - } - resultList << s.trimmed(); - //qDebug() << s; - } - b.seek(0); - } - d->data << resultList; + Q_D(QmlXmlListModel); + if (id != d->queryId) + return; + d->size = size; + if (size > 0) { + d->data = d->qmlXmlQuery.modelData(); + emit itemsInserted(0, d->size); } } +#include "qmlxmllistmodel.moc" + QT_END_NAMESPACE diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index 9371448..cf2f5f4 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -89,7 +89,10 @@ class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public { Q_OBJECT Q_INTERFACES(QmlParserStatus) + Q_ENUMS(Status) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(QString source READ source WRITE setSource) Q_PROPERTY(QString query READ query WRITE setQuery) Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations) @@ -115,17 +118,23 @@ public: QString namespaceDeclarations() const; void setNamespaceDeclarations(const QString&); + enum Status { Idle, Loading, Error }; + Status status() const; + qreal progress() const; + virtual void classComplete(); +signals: + void statusChanged(Status); + void progressChanged(qreal progress); + public Q_SLOTS: void reload(); -protected: - void doQuery(QByteArray &rawData); - void doSubquery(int index) const; - private Q_SLOTS: void requestFinished(); + void requestProgress(qint64,qint64); + void queryCompleted(int,int); private: Q_DECLARE_PRIVATE(QmlXmlListModel) diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 235511f..681a9fa 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -146,6 +146,7 @@ QFxAnchors::~QFxAnchors() d->remDepend(d->bottom.item); d->remDepend(d->vCenter.item); d->remDepend(d->hCenter.item); + d->remDepend(d->baseline.item); } void QFxAnchorsPrivate::fillChanged() @@ -210,6 +211,10 @@ void QFxAnchorsPrivate::clearItem(QFxItem *item) hCenter.item = 0; usedAnchors &= ~QFxAnchors::HasHCenterAnchor; } + if (baseline.item == item) { + baseline.item = 0; + usedAnchors &= ~QFxAnchors::HasBaselineAnchor; + } } void QFxAnchorsPrivate::addDepend(QFxItem *item) @@ -430,8 +435,6 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (bottom.item->itemParent() == item->itemParent()) { setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); } - - } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { //(stetching handled above) @@ -442,6 +445,11 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (vCenter.item->itemParent() == item->itemParent()) { setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset); } + } else if (usedAnchors & QFxAnchors::HasBaselineAnchor) { + //Handle baseline + if (baseline.item->itemParent() == item->itemParent()) { + setItemY(position(baseline.item, baseline.anchorLine) - item->baselineOffset()); + } } updatingVerticalAnchor = false; } else { @@ -599,6 +607,36 @@ void QFxAnchors::resetVerticalCenter() setVerticalCenter(QFxAnchorLine()); } +QFxAnchorLine QFxAnchors::baseline() const +{ + Q_D(const QFxAnchors); + return d->baseline; +} + +void QFxAnchors::setBaseline(const QFxAnchorLine &edge) +{ + Q_D(QFxAnchors); + if (!d->checkVAnchorValid(edge)) + return; + + if (edge.item) + d->usedAnchors |= HasBaselineAnchor; + else + d->usedAnchors &= ~HasBaselineAnchor; + + d->checkVValid(); + + d->remDepend(d->baseline.item); + d->baseline = edge; + d->addDepend(d->baseline.item); + d->updateVerticalAnchors(); +} + +void QFxAnchors::resetBaseline() +{ + setBaseline(QFxAnchorLine()); +} + QFxAnchorLine QFxAnchors::left() const { Q_D(const QFxAnchors); @@ -797,7 +835,7 @@ bool QFxAnchorsPrivate::checkHValid() const if (usedAnchors & QFxAnchors::HasLeftAnchor && usedAnchors & QFxAnchors::HasRightAnchor && usedAnchors & QFxAnchors::HasHCenterAnchor) { - qmlInfo(item) << "Can't specify left, right, and hcenter anchors"; + qmlInfo(item) << "Can't specify left, right, and hcenter anchors."; return false; } @@ -822,7 +860,13 @@ bool QFxAnchorsPrivate::checkVValid() const if (usedAnchors & QFxAnchors::HasTopAnchor && usedAnchors & QFxAnchors::HasBottomAnchor && usedAnchors & QFxAnchors::HasVCenterAnchor) { - qmlInfo(item) << "Can't specify top, bottom, and vcenter anchors"; + qmlInfo(item) << "Can't specify top, bottom, and vcenter anchors."; + return false; + } else if (usedAnchors & QFxAnchors::HasBaselineAnchor && + (usedAnchors & QFxAnchors::HasTopAnchor || + usedAnchors & QFxAnchors::HasBottomAnchor || + usedAnchors & QFxAnchors::HasVCenterAnchor)) { + qmlInfo(item) << "Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."; return false; } diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 9d776ab..3f142c4 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -91,6 +91,7 @@ class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop RESET resetTop); 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()); @@ -141,6 +142,10 @@ public: void setVerticalCenter(const QFxAnchorLine &edge); void resetVerticalCenter(); + QFxAnchorLine baseline() const; + void setBaseline(const QFxAnchorLine &edge); + void resetBaseline(); + int leftMargin() const; void setLeftMargin(int); diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h index b90380a..32d8b75 100644 --- a/src/declarative/fx/qfxanchors_p.h +++ b/src/declarative/fx/qfxanchors_p.h @@ -117,6 +117,7 @@ public: QFxAnchorLine bottom; QFxAnchorLine vCenter; QFxAnchorLine hCenter; + QFxAnchorLine baseline; int leftMargin; int rightMargin; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 876172d..db54aea 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -121,9 +121,9 @@ public: qreal rowPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->y() : item->x()); } qreal colPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->x() : item->y()); } qreal endRowPos() const { - return (view->flow() == QFxGridView::LeftToRight - ? item->y() + (item->height() > 0 ? item->height() : 1) - : item->x() + (item->width() > 0 ? item->width() : 1)) - 1; + return view->flow() == QFxGridView::LeftToRight + ? item->y() + view->cellHeight() - 1 + : item->x() + view->cellWidth() - 1; } void setPosition(qreal col, qreal row) { if (view->flow() == QFxGridView::LeftToRight) { @@ -149,7 +149,7 @@ public: QFxGridViewPrivate() : model(0), currentItem(0), tmpCurrent(0), flow(QFxGridView::LeftToRight) , visiblePos(0), visibleIndex(0) , currentIndex(-1) - , cellWidth(100), cellHeight(100), columns(1) + , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) @@ -157,13 +157,14 @@ public: void init(); void clear(); - FxGridItem *getItem(int modelIndex); FxGridItem *createItem(int modelIndex); void releaseItem(FxGridItem *item); void refill(qreal from, qreal to); void updateGrid(); void layout(bool removed=false); + void updateUnrequestedIndexes(); + void updateUnrequestedPositions(); void updateTrackedItem(); void createHighlight(); void updateHighlight(); @@ -290,6 +291,7 @@ public: QFxVisualItemModel *model; QVariant modelVariant; QList<FxGridItem*> visibleItems; + QHash<QFxItem*,int> unrequestedItems; FxGridItem *currentItem; QFxItem *tmpCurrent; QFxGridView::Flow flow; @@ -299,6 +301,7 @@ public: int cellWidth; int cellHeight; int columns; + int requestedIndex; QmlComponent *highlightComponent; FxGridItem *highlight; FxGridItem *trackedItem; @@ -330,29 +333,18 @@ void QFxGridViewPrivate::clear() visibleItems.clear(); visiblePos = 0; visibleIndex = 0; - if (currentItem) { - FxGridItem *tmpItem = currentItem; - currentItem = 0; - currentIndex = -1; - releaseItem(tmpItem); - } + releaseItem(currentItem); + currentItem = 0; + currentIndex = -1; createHighlight(); trackedItem = 0; } -FxGridItem *QFxGridViewPrivate::getItem(int modelIndex) -{ - if (currentItem && modelIndex == currentIndex) - return currentItem; - if (FxGridItem *listItem = visibleItem(modelIndex)) - return listItem; - return createItem(modelIndex); -} - FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) { Q_Q(QFxGridView); // create object + requestedIndex = modelIndex; FxGridItem *listItem = 0; if (QFxItem *item = model->item(modelIndex, false)) { listItem = new FxGridItem(item, q); @@ -362,6 +354,7 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) listItem->item->setZ(modelIndex + 1); listItem->item->setParent(q->viewport()); } + requestedIndex = 0; return listItem; } @@ -369,15 +362,18 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) void QFxGridViewPrivate::releaseItem(FxGridItem *item) { Q_Q(QFxGridView); - if (item != currentItem) { - if (trackedItem == item) { - QObject::disconnect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); - trackedItem = 0; - } - model->release(item->item); - delete 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())); + trackedItem = 0; } + if (model->release(item->item) == 0) { + // item was not destroyed, and we no longer reference it. + unrequestedItems.insert(item->item, model->indexOf(item->item, q)); + } + delete item; } void QFxGridViewPrivate::refill(qreal from, qreal to) @@ -409,7 +405,7 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) FxGridItem *item = 0; while (modelIndex < model->count() && rowPos <= to) { //qDebug() << "refill: append item" << modelIndex; - if (!(item = getItem(modelIndex))) + if (!(item = createItem(modelIndex))) break; item->setPosition(colPos, rowPos); visibleItems.append(item); @@ -432,7 +428,7 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) } while (visibleIndex > 0 && rowPos + rowSize() - 1 >= from){ //qDebug() << "refill: prepend item" << visibleIndex-1 << "top pos" << rowPos << colPos; - if (!(item = getItem(visibleIndex-1))) + if (!(item = createItem(visibleIndex-1))) break; --visibleIndex; item->setPosition(colPos, rowPos); @@ -518,6 +514,27 @@ void QFxGridViewPrivate::layout(bool removed) q->setViewportWidth(endPosition() - startPosition()); fixupX(); } + updateUnrequestedPositions(); +} + +void QFxGridViewPrivate::updateUnrequestedIndexes() +{ + Q_Q(QFxGridView); + QHash<QFxItem*,int>::iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) + *it = model->indexOf(it.key(), q); +} + +void QFxGridViewPrivate::updateUnrequestedPositions() +{ + QHash<QFxItem*,int>::const_iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { + if (flow == QFxGridView::LeftToRight) { + it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); + } else { + it.key()->setPos(QPointF(rowPosAt(*it), colPosAt(*it))); + } + } } void QFxGridViewPrivate::updateTrackedItem() @@ -606,11 +623,11 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) Q_Q(QFxGridView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { - FxGridItem *item = currentItem; + currentItem->attached->setIsCurrentItem(false); + releaseItem(currentItem); currentItem = 0; - currentIndex = 0; + currentIndex = -1; updateHighlight(); - releaseItem(item); emit q->currentIndexChanged(); } return; @@ -625,28 +642,20 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) delete tmpCurrent; tmpCurrent = 0; } - int oldCurrentIndex = currentIndex; FxGridItem *oldCurrentItem = currentItem; - currentIndex = -1; - currentItem = visibleItem(modelIndex); - if (!currentItem) { - currentItem = getItem(modelIndex); - if (currentItem) - currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); - } currentIndex = modelIndex; + currentItem = createItem(modelIndex); fixCurrentVisibility = true; if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); if (currentItem) { + currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); currentItem->item->setFocus(true); currentItem->attached->setIsCurrentItem(true); } updateHighlight(); emit q->currentIndexChanged(); - // Release the old current item - if (oldCurrentItem && !visibleItem(oldCurrentIndex)) - releaseItem(oldCurrentItem); + releaseItem(oldCurrentItem); } //---------------------------------------------------------------------------- @@ -711,6 +720,8 @@ void QFxGridView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); } d->clear(); d->modelVariant = model; @@ -736,6 +747,8 @@ void QFxGridView::setModel(const QVariant &model) d->updateCurrent(d->currentIndex); connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); refill(); emit countChanged(); } @@ -1182,7 +1195,7 @@ void QFxGridView::itemsInserted(int modelIndex, int count) d->visibleIndex += count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxGridItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index += count; } } @@ -1258,10 +1271,8 @@ void QFxGridView::itemsInserted(int modelIndex, int count) // Update the indexes of the following visible items. for (; index < d->visibleItems.count(); ++index) { FxGridItem *listItem = d->visibleItems.at(index); - if (listItem != d->currentItem) { - if (listItem->index != -1) - listItem->index += count; - } + if (listItem->index != -1) + listItem->index += count; } } // everything is in order now - emit add() signal @@ -1274,7 +1285,6 @@ void QFxGridView::itemsInserted(int modelIndex, int count) void QFxGridView::itemsRemoved(int modelIndex, int count) { Q_D(QFxGridView); - int index = d->mapFromModel(modelIndex); if (index == -1) { if (modelIndex + count - 1 < d->visibleIndex) { @@ -1282,7 +1292,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->visibleIndex -= count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxGridItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index -= count; } } @@ -1292,11 +1302,8 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem) { - FxGridItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); + d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); } @@ -1314,8 +1321,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) ++it; } else if (item->index >= modelIndex + count) { // after removed items - if (item != d->currentItem) - item->index -= count; + item->index -= count; ++it; } else { // removed item @@ -1338,11 +1344,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem && !d->currentItem->attached->delayRemove()) { - FxGridItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); @@ -1385,6 +1387,28 @@ void QFxGridView::destroyRemoved() d->layout(); } +void QFxGridView::createdItem(int index, QFxItem *item) +{ + Q_D(QFxGridView); + item->setItemParent(this); + if (d->requestedIndex != index) { + item->setItemParent(this); + d->unrequestedItems.insert(item, index); + if (d->flow == QFxGridView::LeftToRight) { + item->setPos(QPointF(d->colPosAt(index), d->rowPosAt(index))); + } else { + item->setPos(QPointF(d->rowPosAt(index), d->colPosAt(index))); + } + } +} + +void QFxGridView::destroyingItem(QFxItem *item) +{ + Q_D(QFxGridView); + d->unrequestedItems.remove(item); +} + + void QFxGridView::refill() { Q_D(QFxGridView); diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index ff08831..99c7cff 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -131,6 +131,8 @@ private Q_SLOTS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void destroyRemoved(); + void createdItem(int index, QFxItem *item); + void destroyingItem(QFxItem *item); void sizeChange(); private: diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 4197a80..064580e 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -863,6 +863,9 @@ QString QFxImage::source() const void QFxImage::setSource(const QString &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer<QFxPerf::PixmapLoad> perf; +#endif Q_D(QFxImage); if (url == d->source) return; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 3cbcd6a..3e29f13 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -197,8 +197,10 @@ void QFxContents::setItem(QFxItem *item) const QList<QSimpleCanvasItem *> &children = _item->QSimpleCanvasItem::children(); for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); - connect(child, SIGNAL(bottomChanged()), this, SLOT(calcHeight())); - connect(child, SIGNAL(rightChanged()), this, SLOT(calcWidth())); + connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); + connect(child, SIGNAL(topChanged()), this, SLOT(calcHeight())); + connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); + connect(child, SIGNAL(leftChanged()), this, SLOT(calcWidth())); } calcHeight(); @@ -259,24 +261,10 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::baselineChanged() - - This signal is emitted when the baseline of the item changes. - - The baseline may change in response to a change to the baselineOffset - property or due to the geometry of the item changing. -*/ - -/*! \fn void QFxItem::baselineOffsetChanged() - This signal is emitted when the baseline of the item is changed - via the baselineOffset property. - - The baseline corresponds to the baseline of the text contained in - the item. It is useful for aligning the text in items placed - beside each other. The default baseline is positioned at - 2/3 of the height of the item. + This signal is emitted when the baseline offset of the item + is changed. */ /*! @@ -286,24 +274,12 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::rightChanged() - - This signal is emitted when the right coordinate of the item changes. -*/ - -/*! \fn void QFxItem::topChanged() This signal is emitted when the top coordinate of the item changes. */ /*! - \fn void QFxItem::bottomChanged() - - This signal is emitted when the bottom coordinate of the item changes. -*/ - -/*! \fn void QFxItem::widthChanged() This signal is emitted when the width of the item changes. @@ -1282,6 +1258,15 @@ QFxAnchorLine QFxItem::verticalCenter() const } /*! + \internal +*/ +QFxAnchorLine QFxItem::baseline() const +{ + Q_D(const QFxItem); + return d->anchorLines()->baseline; +} + +/*! \property QFxItem::top One of the anchor lines of the item. @@ -1336,6 +1321,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::right \qmlproperty AnchorLine Item::horizontalCenter \qmlproperty AnchorLine Item::verticalCenter + \qmlproperty AnchorLine Item::baseline The anchor lines of the item. @@ -1349,6 +1335,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::anchors.right \qmlproperty AnchorLine Item::anchors.horizontalCenter \qmlproperty AnchorLine Item::anchors.verticalCenter + \qmlproperty AnchorLine Item::anchors.baseline \qmlproperty Item Item::anchors.fill @@ -1408,20 +1395,19 @@ QFxAnchorLine QFxItem::verticalCenter() const /*! \property QFxItem::baselineOffset - \brief The position of the item's baseline in global (scene) coordinates. + \brief The position of the item's baseline in local coordinates. The baseline of a Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. - For non-text items, a default baseline offset of two-thirds of the - item's height is used to determine the baseline. + For non-text items, a default baseline offset of 0 is used. */ int QFxItem::baselineOffset() const { Q_D(const QFxItem); if (!d->_baselineOffset.isValid()) { - return height()*2/3; //### default baseline is 2/3 of the way to the bottom of the item + return 0; } else return d->_baselineOffset; } @@ -1437,6 +1423,11 @@ void QFxItem::setBaselineOffset(int offset) d->_baselineOffset = offset; emit baselineOffsetChanged(); + + for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->updateVerticalAnchors(); + } } /*! @@ -1672,6 +1663,7 @@ void QFxItem::setKeepMouseGrab(bool keep) */ void QFxItem::activeFocusChanged(bool flag) { + Q_UNUSED(flag); emit activeFocusChanged(); } @@ -1681,6 +1673,7 @@ void QFxItem::activeFocusChanged(bool flag) */ void QFxItem::focusChanged(bool flag) { + Q_UNUSED(flag); emit focusChanged(); } @@ -2100,6 +2093,8 @@ QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) bottom.anchorLine = QFxAnchorLine::Bottom; vCenter.item = q; vCenter.anchorLine = QFxAnchorLine::VCenter; + baseline.item = q; + baseline.anchorLine = QFxAnchorLine::Baseline; } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index d34a9fb..0b4f897 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -127,6 +127,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(QFxAnchorLine top READ top) Q_PROPERTY(QFxAnchorLine bottom READ bottom) Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter) + Q_PROPERTY(QFxAnchorLine baseline READ baseline) 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) @@ -258,6 +259,7 @@ private: QFxAnchorLine top() const; QFxAnchorLine bottom() const; QFxAnchorLine verticalCenter() const; + QFxAnchorLine baseline() const; void init(QFxItem *parent); friend class QmlStatePrivate; diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 85ce171..b5f9554 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -157,6 +157,7 @@ public: QFxAnchorLine top; QFxAnchorLine bottom; QFxAnchorLine vCenter; + QFxAnchorLine baseline; }; mutable AnchorLines *_anchorLines; AnchorLines *anchorLines() const { diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 46166e2..247f64b 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -171,15 +171,14 @@ public: QFxListViewPrivate() : model(0), currentItem(0), tmpCurrent(0), orient(Qt::Vertical) , visiblePos(0), visibleIndex(0) - , averageSize(100), currentIndex(-1), currItemMode(QFxListView::Free) - , snapPos(0), highlightComponent(0), highlight(0), trackedItem(0) + , averageSize(100), currentIndex(-1), requestedIndex(-1) + , currItemMode(QFxListView::Free), snapPos(0), highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false) {} void init(); void clear(); - FxListItem *getItem(int modelIndex); FxListItem *createItem(int modelIndex); void releaseItem(FxListItem *item); @@ -333,6 +332,8 @@ public: void refill(qreal from, qreal to); void layout(); + void updateUnrequestedIndexes(); + void updateUnrequestedPositions(); void updateTrackedItem(); void createHighlight(); void updateHighlight(); @@ -347,6 +348,7 @@ public: QFxVisualItemModel *model; QVariant modelVariant; QList<FxListItem*> visibleItems; + QHash<QFxItem*,int> unrequestedItems; FxListItem *currentItem; QFxItem *tmpCurrent; Qt::Orientation orient; @@ -354,6 +356,7 @@ public: int visibleIndex; qreal averageSize; int currentIndex; + int requestedIndex; QFxListView::CurrentItemPositioning currItemMode; int snapPos; QmlComponent *highlightComponent; @@ -390,29 +393,18 @@ void QFxListViewPrivate::clear() visibleItems.clear(); visiblePos = 0; visibleIndex = 0; - if (currentItem) { - FxListItem *tmpItem = currentItem; - currentItem = 0; - currentIndex = -1; - releaseItem(tmpItem); - } + releaseItem(currentItem); + currentItem = 0; + currentIndex = -1; createHighlight(); trackedItem = 0; } -FxListItem *QFxListViewPrivate::getItem(int modelIndex) -{ - if (currentItem && modelIndex == currentIndex) - return currentItem; - if (FxListItem *listItem = visibleItem(modelIndex)) - return listItem; - return createItem(modelIndex); -} - FxListItem *QFxListViewPrivate::createItem(int modelIndex) { Q_Q(QFxListView); // create object + requestedIndex = modelIndex; FxListItem *listItem = 0; if (QFxItem *item = model->item(modelIndex, false)) { listItem = new FxListItem(item, q); @@ -438,6 +430,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) else QObject::connect(listItem->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); } + requestedIndex = -1; return listItem; } @@ -445,21 +438,24 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) void QFxListViewPrivate::releaseItem(FxListItem *item) { Q_Q(QFxListView); - if (item != currentItem) { - if (orient == Qt::Vertical) - QObject::disconnect(item->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); - 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 *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); - QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); - trackedItem = 0; - } - model->release(item->item); - delete item; + if (!item) + return; + if (orient == Qt::Vertical) + QObject::disconnect(item->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); + 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 *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); + QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); + trackedItem = 0; } + if (model->release(item->item) == 0) { + // item was not destroyed, and we no longer reference it. + unrequestedItems.insert(item->item, model->indexOf(item->item, q)); + } + delete item; } void QFxListViewPrivate::refill(qreal from, qreal to) @@ -485,7 +481,7 @@ void QFxListViewPrivate::refill(qreal from, qreal to) int pos = itemEnd + 1; while (modelIndex < model->count() && pos <= to) { //qDebug() << "refill: append item" << modelIndex; - if (!(item = getItem(modelIndex))) + if (!(item = createItem(modelIndex))) break; item->setPosition(pos); pos += item->size(); @@ -495,7 +491,7 @@ void QFxListViewPrivate::refill(qreal from, qreal to) } while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos > from) { //qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos; - if (!(item = getItem(visibleIndex-1))) + if (!(item = createItem(visibleIndex-1))) break; --visibleIndex; visiblePos -= item->size(); @@ -562,6 +558,28 @@ void QFxListViewPrivate::layout() fixupX(); q->setViewportWidth(endPosition() - startPosition()); } + updateUnrequestedPositions(); +} + +void QFxListViewPrivate::updateUnrequestedIndexes() +{ + Q_Q(QFxListView); + QHash<QFxItem*,int>::iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) + *it = model->indexOf(it.key(), q); +} + +void QFxListViewPrivate::updateUnrequestedPositions() +{ + QHash<QFxItem*,int>::const_iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { + if (visibleItem(*it)) + continue; + if (orient == Qt::Vertical) + it.key()->setY(positionAt(*it)); + else + it.key()->setX(positionAt(*it)); + } } void QFxListViewPrivate::updateTrackedItem() @@ -695,13 +713,11 @@ void QFxListViewPrivate::updateCurrent(int modelIndex) Q_Q(QFxListView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { - FxListItem *item = currentItem; - int index = currentIndex; + currentItem->attached->setIsCurrentItem(false); + releaseItem(currentItem); currentItem = 0; - currentIndex = 0; + currentIndex = -1; updateHighlight(); - if (!visibleItem(index)) - releaseItem(item); emit q->currentIndexChanged(); } return; @@ -716,40 +732,28 @@ void QFxListViewPrivate::updateCurrent(int modelIndex) delete tmpCurrent; tmpCurrent = 0; } - int oldCurrentIndex = currentIndex; FxListItem *oldCurrentItem = currentItem; - currentIndex = -1; - currentItem = visibleItem(modelIndex); - if (!currentItem) { - currentItem = getItem(modelIndex); - if (currentItem) { - if (modelIndex == visibleIndex - 1) { - // We can calculate exact postion in this case - currentItem->setPosition(visibleItems.first()->position() - currentItem->size()); - } else { - // Create current item now and position as best we can. - // Its position will be corrected when it becomes visible. - currentItem->setPosition(positionAt(modelIndex)); - } - } - } currentIndex = modelIndex; + currentItem = createItem(modelIndex); fixCurrentVisibility = true; if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); if (currentItem) { + if (modelIndex == visibleIndex - 1) { + // We can calculate exact postion in this case + currentItem->setPosition(visibleItems.first()->position() - currentItem->size()); + } else { + // Create current item now and position as best we can. + // Its position will be corrected when it becomes visible. + currentItem->setPosition(positionAt(modelIndex)); + } currentItem->item->setFocus(true); currentItem->attached->setIsCurrentItem(true); } updateHighlight(); emit q->currentIndexChanged(); // Release the old current item - if (oldCurrentItem && !visibleItem(oldCurrentIndex)) { - if (!currentItem || oldCurrentItem->item == currentItem->item) - delete oldCurrentItem; - else - releaseItem(oldCurrentItem); - } + releaseItem(oldCurrentItem); } void QFxListViewPrivate::updateAverage() @@ -884,6 +888,8 @@ void QFxListView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); } d->clear(); d->modelVariant = model; @@ -909,6 +915,8 @@ void QFxListView::setModel(const QVariant &model) d->updateCurrent(d->currentIndex); connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); refill(); emit countChanged(); } @@ -1417,6 +1425,7 @@ void QFxListView::itemResized() void QFxListView::itemsInserted(int modelIndex, int count) { Q_D(QFxListView); + d->updateUnrequestedIndexes(); if (!d->visibleItems.count() || d->model->count() <= 1) { d->layout(); d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1))); @@ -1437,7 +1446,7 @@ void QFxListView::itemsInserted(int modelIndex, int count) d->visibleIndex += count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxListItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index += count; } } @@ -1487,29 +1496,29 @@ void QFxListView::itemsInserted(int modelIndex, int count) // Update the indexes of the following visible items. for (; index < d->visibleItems.count(); ++index) { FxListItem *listItem = d->visibleItems.at(index); - if (listItem != d->currentItem) { - listItem->setPosition(listItem->position() + (pos - initialPos)); - if (listItem->index != -1) - listItem->index += count; - } + listItem->setPosition(listItem->position() + (pos - initialPos)); + if (listItem->index != -1) + listItem->index += count; } } // everything is in order now - emit add() signal for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->updateUnrequestedPositions(); emit countChanged(); } void QFxListView::itemsRemoved(int modelIndex, int count) { Q_D(QFxListView); + d->updateUnrequestedIndexes(); if (!d->mapRangeFromModel(modelIndex, count)) { if (modelIndex + count - 1 < d->visibleIndex) { // Items removed before our visible items. d->visibleIndex -= count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxListItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index -= count; } } @@ -1519,11 +1528,8 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem) { - FxListItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); + d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); } @@ -1541,8 +1547,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) ++it; } else if (item->index >= modelIndex + count) { // after removed items - if (item != d->currentItem) - item->index -= count; + item->index -= count; ++it; } else { // removed item @@ -1565,11 +1570,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem && !d->currentItem->attached->delayRemove()) { - FxListItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); @@ -1618,6 +1619,25 @@ void QFxListView::destroyRemoved() d->layout(); } +void QFxListView::createdItem(int index, QFxItem *item) +{ + Q_D(QFxListView); + if (d->requestedIndex != index) { + item->setItemParent(viewport()); + d->unrequestedItems.insert(item, index); + if (d->orient == Qt::Vertical) + item->setY(d->positionAt(index)); + else + item->setX(d->positionAt(index)); + } +} + +void QFxListView::destroyingItem(QFxItem *item) +{ + Q_D(QFxListView); + d->unrequestedItems.remove(item); +} + QObject *QFxListView::qmlAttachedProperties(QObject *obj) { return QFxListViewAttached::properties(obj); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 6bf2b54..87a851b 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -141,6 +141,8 @@ private Q_SLOTS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void destroyRemoved(); + void createdItem(int index, QFxItem *item); + void destroyingItem(QFxItem *item); }; QML_DECLARE_TYPE(QFxListView); diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index b7215cf..3f2e77a 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -159,7 +159,7 @@ void QFxPathView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - disconnect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); for (int i=0; i<d->items.count(); i++){ QFxItem *p = d->items[i]; d->model->release(p); @@ -186,7 +186,7 @@ void QFxPathView::setModel(const QVariant &model) if (d->model) { connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - connect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); } d->firstIndex = 0; d->pathOffset = 0; @@ -561,7 +561,7 @@ void QFxPathViewPrivate::regenerate() Q_Q(QFxPathView); for (int i=0; i<items.count(); i++){ QFxItem *p = items[i]; - model->release(p); + releaseItem(p); } items.clear(); @@ -634,7 +634,7 @@ void QFxPathView::refill() while(wrapIndex-- >= 0){ QFxItem* p = d->items.takeFirst(); d->updateItem(p, 0.0); - d->model->release(p); + d->releaseItem(p); d->firstIndex++; d->firstIndex %= d->model->count(); int index = (d->firstIndex + d->items.count())%d->model->count(); @@ -647,7 +647,7 @@ void QFxPathView::refill() while(wrapIndex++ < d->items.count()-1){ QFxItem* p = d->items.takeLast(); d->updateItem(p, 1.0); - d->model->release(p); + d->releaseItem(p); d->firstIndex--; if (d->firstIndex < 0) d->firstIndex = d->model->count() - 1; @@ -733,7 +733,7 @@ void QFxPathView::itemsRemoved(int modelIndex, int count) d->moveOffset.setValue(targetOffset); } -void QFxPathView::itemCreated(int index, QFxItem *item) +void QFxPathView::createdItem(int index, QFxItem *item) { Q_D(QFxPathView); if (d->requestedIndex != index) { @@ -744,6 +744,7 @@ void QFxPathView::itemCreated(int index, QFxItem *item) void QFxPathView::destroyingItem(QFxItem *item) { + Q_UNUSED(item); } void QFxPathView::ticked() diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index 32e03b8..33db566 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -115,7 +115,7 @@ private Q_SLOTS: void ticked(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); - void itemCreated(int index, QFxItem *item); + void createdItem(int index, QFxItem *item); void destroyingItem(QFxItem *item); protected: diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index 358daf6..b5c5ba2 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -101,6 +101,9 @@ public: requestedIndex = -1; return item; } + void releaseItem(QFxItem *item) { + model->release(item); + } bool isValid() const { return model && model->count() > 0 && model->delegate() && path; diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index f1cbb58..f81f9b3 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -55,7 +55,7 @@ QML_DEFINE_TYPE(QFxPen,Pen); By default, the pen is invalid and nothing is drawn. You must either set a color (then the default width is 0) or a width (then the default color is black). - A width of 0 is a single-pixel line on the border of the item being painted. + A width of 0 indicates a cosmetic pen, a single-pixel line on the border of the item being painted. Example: \qml @@ -401,7 +401,7 @@ void QFxRect::generateRoundedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->_radius*2 + 1 + pw*2, d->_radius*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->_radius*2 + 3 + pw*2, d->_radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -421,7 +421,7 @@ void QFxRect::generateBorderedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->pen()->width()*2 + 1 + pw*2, d->pen()->width()*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->pen()->width()*2 + 3 + pw*2, d->pen()->width()*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -533,10 +533,10 @@ void QFxRect::drawRect(QPainter &p) if (d->_radius > 0) { generateRoundedRect(); //### implicit conversion to int - offset = int(d->_radius+0.5+pw); + offset = int(d->_radius+1.5+pw); } else { generateBorderedRect(); - offset = pw; + offset = pw+1; } //basically same code as QFxImage uses to paint sci images diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index e84255d..315b451 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -571,7 +571,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) QFont f; if (_font) f = _font->font(); QFontMetrics fm = QFontMetrics(f); - int leading = fm.leading(); int height = 0; qreal widthUsed = 0; qreal lineWidth = 0; @@ -592,9 +591,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) } layout->endLayout(); - if (layout->lineCount() == 1) - height -= leading; - for (int i = 0; i < layout->lineCount(); ++i) { QTextLine line = layout->lineAt(i); widthUsed = qMax(widthUsed, line.naturalTextWidth()); @@ -607,7 +603,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) { //do layout - Q_Q(const QFxText); QFont f; if (_font) f = _font->font(); QSize size = cachedLayoutSize; diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 8667c9e..f59e0ae 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -427,6 +427,8 @@ void QFxTextEdit::setCursorVisible(bool on) return; d->cursorVisible = on; QFocusEvent focusEvent(on ? QEvent::FocusIn : QEvent::FocusOut); + if (!on && !d->preserveSelection) + d->control->setCursorIsFocusIndicator(true); d->control->processEvent(&focusEvent, QPointF(0, 0)); } @@ -450,6 +452,26 @@ void QFxTextEdit::setFocusOnPress(bool on) d->focusOnPress = on; } +/*! + \qmlproperty bool TextEdit::preserveSelection + + Whether the TextEdit should keep the selection visible when it loses focus to another + item in the scene. By default this is set to true; +*/ +bool QFxTextEdit::preserveSelection() const +{ + Q_D(const QFxTextEdit); + return d->preserveSelection; +} + +void QFxTextEdit::setPreserveSelection(bool on) +{ + Q_D(QFxTextEdit); + if (d->preserveSelection == on) + return; + d->preserveSelection = on; +} + void QFxTextEdit::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { @@ -616,6 +638,20 @@ void QFxTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor:: /*! \overload +Handles the given \a event. +*/ +bool QFxTextEdit::event(QEvent *event) +{ + Q_D(QFxTextEdit); + if (event->type() == QEvent::ShortcutOverride) { + d->control->processEvent(event, QPointF(0, 0)); + return true; + } + return QFxPaintedItem::event(event); +} + +/*! +\overload Handles the given key \a event. */ void QFxTextEdit::keyPressEvent(QKeyEvent *event) diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index f702101..1456cd8 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -78,6 +78,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) + Q_PROPERTY(bool preserveSelection READ preserveSelection WRITE setPreserveSelection) Q_CLASSINFO("DefaultProperty", "text") public: @@ -131,6 +132,9 @@ public: bool focusOnPress() const; void setFocusOnPress(bool on); + bool preserveSelection() const; + void setPreserveSelection(bool on); + virtual void dump(int depth); virtual QString propertyInfo() const; @@ -174,6 +178,7 @@ protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + bool event(QEvent *); void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index a9b7237..78b0018 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -69,7 +69,7 @@ class QFxTextEditPrivate : public QFxPaintedItemPrivate public: QFxTextEditPrivate() : font(0), color("black"), imgDirty(true), hAlign(QFxTextEdit::AlignLeft), vAlign(QFxTextEdit::AlignTop), - dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), + dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), preserveSelection(true), format(QFxTextEdit::AutoText), document(0) { } @@ -98,6 +98,7 @@ public: bool richText; bool cursorVisible; bool focusOnPress; + bool preserveSelection; QFxTextEdit::TextFormat format; QTextDocument *document; QTextControl *control; diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index bc59e0a..d99af27 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -272,7 +272,9 @@ QMatrix4x4 QFxRotation::transform() const if (_dirty) { _transform = QMatrix4x4(); _dirty = false; - _transform.rotate(_angle, _originX, _originY); + _transform.translate(_originX, _originY); + _transform.rotate(_angle, 0, 0, 1); + _transform.translate(-_originX, -_originY); } return _transform; } diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 533917e..039998a 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -73,9 +73,50 @@ public: QList<int> m_roles; QHash<int,QString> m_roleNames; - QHash<int, QObject *> m_cache; + struct ObjectRef { + ObjectRef(QObject *object=0) : obj(object), ref(1) {} + QObject *obj; + int ref; + }; + class Cache : public QHash<int, ObjectRef> { + public: + QObject *getItem(int index) { + QObject *item = 0; + QHash<int,ObjectRef>::iterator it = find(index); + if (it != end()) { + (*it).ref++; + item = (*it).obj; + } + return item; + } + QObject *item(int index) { + QObject *item = 0; + QHash<int, ObjectRef>::const_iterator it = find(index); + if (it != end()) + item = (*it).obj; + return item; + } + void insertItem(int index, QObject *obj) { + insert(index, ObjectRef(obj)); + } + bool releaseItem(QObject *obj) { + QHash<int, ObjectRef>::iterator it = begin(); + for (; it != end(); ++it) { + ObjectRef &objRef = *it; + if (objRef.obj == obj) { + if (--objRef.ref == 0) { + erase(it); + return true; + } + break; + } + } + return false; + } + }; + + Cache m_cache; QHash<QObject *, QmlPackage*> m_packaged; - QHash<QmlPackage*, int> m_packageRef; QFxVisualItemModelParts *m_parts; friend class QFxVisualItemParts; @@ -337,8 +378,8 @@ void QFxVisualItemModel::setModel(const QVariant &model) this, SIGNAL(itemsRemoved(int,int))); QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)), this, SIGNAL(itemsMoved(int,int,int))); - QObject::disconnect(d->m_visualItemModel, SIGNAL(packageCreated(int,QmlPackage*)), - this, SLOT(_q_packageCreated(int,QmlPackage*))); + QObject::disconnect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)), + this, SLOT(_q_createdPackage(int,QmlPackage*))); QObject::disconnect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)), this, SLOT(_q_destroyingPackage(QmlPackage*))); d->m_visualItemModel = 0; @@ -390,8 +431,8 @@ void QFxVisualItemModel::setModel(const QVariant &model) this, SIGNAL(itemsRemoved(int,int))); QObject::connect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)), this, SIGNAL(itemsMoved(int,int,int))); - QObject::connect(d->m_visualItemModel, SIGNAL(packageCreated(int,QmlPackage*)), - this, SLOT(_q_packageCreated(int,QmlPackage*))); + QObject::connect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)), + this, SLOT(_q_createdPackage(int,QmlPackage*))); QObject::connect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)), this, SLOT(_q_destroyingPackage(QmlPackage*))); return; @@ -445,41 +486,39 @@ QFxItem *QFxVisualItemModel::item(int index, bool complete) return item(index, QByteArray(), complete); } -void QFxVisualItemModel::release(QFxItem *item) +/* + Returns ReleaseStatus flags. +*/ +QFxVisualItemModel::ReleaseFlags QFxVisualItemModel::release(QFxItem *item) { Q_D(QFxVisualItemModel); - if (d->m_visualItemModel) { - d->m_visualItemModel->release(item); - return; - } - item->setItemParent(0); - QObject *obj = item; + if (d->m_visualItemModel) + return d->m_visualItemModel->release(item); + ReleaseFlags stat = 0; + QObject *obj = item; bool inPackage = false; - if (QmlPackage *package = d->m_packaged.value(item)) { - static_cast<QObject*>(item)->setParent(package); - d->m_packaged.remove(item); - //XXX Inefficient - for (QHash<QObject *, QmlPackage *>::Iterator iter = d->m_packaged.begin(); - iter != d->m_packaged.end(); ++iter) { - if (*iter == package) - return; - } + + QHash<QObject*,QmlPackage*>::iterator it = d->m_packaged.find(item); + if (it != d->m_packaged.end()) { + QmlPackage *package = *it; + d->m_packaged.erase(it); + if (d->m_packaged.contains(item)) + stat |= Referenced; inPackage = true; obj = package; // fall through and delete } - //XXX Inefficient - for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); - iter != d->m_cache.end(); ++iter) { - if (*iter == obj) { - if (inPackage) - emit destroyingPackage(qobject_cast<QmlPackage*>(obj)); - delete obj; - d->m_cache.erase(iter); - return; - } + if (d->m_cache.releaseItem(obj)) { + if (inPackage) + emit destroyingPackage(qobject_cast<QmlPackage*>(obj)); + stat |= Destroyed; + delete obj; + } else if (!inPackage) { + stat |= Referenced; } + + return stat; } QObject *QFxVisualItemModel::parts() @@ -499,10 +538,8 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (d->modelCount() <= 0 || !d->m_delegate) return 0; - QObject *nobj = 0; - if (d->m_cache.contains(index)) { - nobj = d->m_cache[index]; - } else { + QObject *nobj = d->m_cache.getItem(index); + if (!nobj) { QmlContext *ccontext = d->m_context; if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); @@ -515,8 +552,9 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (nobj) { ctxt->setParent(nobj); data->setParent(nobj); - - d->m_cache.insert(index, nobj); + d->m_cache.insertItem(index, nobj); + if (QmlPackage *package = qobject_cast<QmlPackage *>(nobj)) + emit createdPackage(index, package); } else { delete data; delete ctxt; @@ -529,8 +567,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (package) { QObject *o = package->part(QLatin1String(viewId)); item = qobject_cast<QFxItem *>(o); - d->m_packaged[o] = package; - emit packageCreated(index, package); + d->m_packaged.insertMulti(item, package); } } @@ -558,8 +595,8 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj return QVariant(); QVariant value; - if (d->m_cache.contains(index)) { - QObject *nobj = d->m_cache[index]; + QObject *nobj = d->m_cache.item(index); + if (nobj) { QFxItem *item = qobject_cast<QFxItem *>(nobj); if (item) { QmlExpression e(qmlContext(item), expression, objectContext); @@ -582,6 +619,16 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj return value; } +int QFxVisualItemModel::indexOf(QFxItem *item, QObject *objectContext) const +{ + QmlExpression e(qmlContext(item), QLatin1String("index"), objectContext); + e.setTrackChange(false); + QVariant value = e.value(); + if (value.isValid()) + return value.toInt(); + return -1; +} + void QFxVisualItemModel::_q_itemsChanged(int index, int count, const QList<int> &roles) { @@ -589,9 +636,7 @@ void QFxVisualItemModel::_q_itemsChanged(int index, int count, // XXX - highly inefficient for (int ii = index; ii < index + count; ++ii) { - if (d->m_cache.contains(ii)) { - - QObject *item = d->m_cache[ii]; + if (QObject *item = d->m_cache.item(ii)) { QFxVisualItemModelData *data = d->data(item); for (int prop = 0; prop < data->count(); ++prop) { @@ -615,18 +660,18 @@ void QFxVisualItemModel::_q_itemsInserted(int index, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash<int, QObject *> items; - for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + QHash<int,QFxVisualItemModelPrivate::ObjectRef> items; + for (QHash<int,QFxVisualItemModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() + count; iter = d->m_cache.erase(iter); - items.insert(index, item); + items.insert(index, objRef); - QFxVisualItemModelData *data = d->data(item); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -641,21 +686,21 @@ void QFxVisualItemModel::_q_itemsRemoved(int index, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash<int, QObject *> items; - for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + QHash<int, QFxVisualItemModelPrivate::ObjectRef> items; + for (QHash<int, QFxVisualItemModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index && iter.key() < index + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; iter = d->m_cache.erase(iter); - items.insertMulti(-1, item); //XXX perhaps better to maintain separately - QFxVisualItemModelData *data = d->data(item); + items.insertMulti(-1, objRef); //XXX perhaps better to maintain separately + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(-1); } else if (iter.key() >= index + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - count; iter = d->m_cache.erase(iter); - items.insert(index, item); - QFxVisualItemModelData *data = d->data(item); + items.insert(index, objRef); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -670,18 +715,18 @@ void QFxVisualItemModel::_q_itemsMoved(int from, int to, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash<int, QObject *> items; - for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + QHash<int,QFxVisualItemModelPrivate::ObjectRef> items; + for (QHash<int,QFxVisualItemModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= from && iter.key() < from + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - from + to; iter = d->m_cache.erase(iter); - items.insert(index, item); + items.insert(index, objRef); - QFxVisualItemModelData *data = d->data(item); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -708,10 +753,10 @@ void QFxVisualItemModel::_q_dataChanged(const QModelIndex &begin, const QModelIn _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } -void QFxVisualItemModel::_q_packageCreated(int index, QmlPackage *package) +void QFxVisualItemModel::_q_createdPackage(int index, QmlPackage *package) { Q_D(QFxVisualItemModel); - emit itemCreated(index, qobject_cast<QFxItem*>(package->part(d->m_part))); + emit createdItem(index, qobject_cast<QFxItem*>(package->part(d->m_part))); } void QFxVisualItemModel::_q_destroyingPackage(QmlPackage *package) diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index 586d837..622065c 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -86,21 +86,26 @@ public: QString part() const; void setPart(const QString &); + enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 }; + Q_DECLARE_FLAGS(ReleaseFlags, ReleaseFlag) + int count() const; QFxItem *item(int index, bool complete=true); QFxItem *item(int index, const QByteArray &, bool complete=true); - void release(QFxItem *item); + ReleaseFlags release(QFxItem *item); void completeItem(); QVariant evaluate(int index, const QString &expression, QObject *objectContext); + int indexOf(QFxItem *item, QObject *objectContext) const; + QObject *parts(); Q_SIGNALS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); - void itemCreated(int index, QFxItem *item); - void packageCreated(int index, QmlPackage *package); + void createdItem(int index, QFxItem *item); + void createdPackage(int index, QmlPackage *package); void destroyingItem(QFxItem *item); void destroyingPackage(QmlPackage *package); @@ -112,7 +117,7 @@ private Q_SLOTS: void _q_rowsInserted(const QModelIndex &,int,int); void _q_rowsRemoved(const QModelIndex &,int,int); void _q_dataChanged(const QModelIndex&,const QModelIndex&); - void _q_packageCreated(int index, QmlPackage *package); + void _q_createdPackage(int index, QmlPackage *package); void _q_destroyingPackage(QmlPackage *package); private: diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index e1124a6..0da1a92 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -315,7 +315,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) continue; } - QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url)); + QUrl url = engine->componentUrl(QUrl(QLatin1String(type + ".qml")), QUrl(unit->url)); QmlCompositeTypeData *urlUnit = components.value(url.toString()); if (!urlUnit) { @@ -335,7 +335,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) { QmlError error; error.setUrl(unit->url); - error.setDescription("Type " + type + " unavailable"); + error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(type))); unit->errors << error; } if (urlUnit->errorType != QmlCompositeTypeData::AccessError) diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index ea72ebf..e5016f2 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -73,8 +73,6 @@ void QmlContextPrivate::dump(int depth) void QmlContextPrivate::destroyed(QObject *obj) { - Q_Q(QmlContext); - defaultObjects.removeAll(obj); QVariant variantObject = QVariant::fromValue(obj); diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index a60f783..2e8c8f6 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -224,6 +224,7 @@ QList<QVariant> QmlCustomParserProperty::assignedValues() const QByteArray QmlCustomParser::compile(const QList<QmlCustomParserProperty> &, bool *ok) { + Q_UNUSED(ok); return QByteArray(); } diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index e3e9ff5..3aa4f1d 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -730,19 +730,19 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) switch(t) { case QVariant::Double: { - qreal r; + double d; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + d = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + d = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = &d; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); @@ -906,19 +906,19 @@ void QmlMetaProperty::write(const QVariant &value) const switch(t) { case QVariant::Double: { - qreal r; + double dd; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + dd = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + dd = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = ⅆ QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a); diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..5b3564f 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -10,8 +10,11 @@ #include "parser/javascriptast_p.h" #include <QStack> +#include <QCoreApplication> #include <QtDebug> +#include <qfxperf.h> + QT_BEGIN_NAMESPACE using namespace JavaScript; @@ -203,7 +206,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, LocationSpan location, AST::UiObjectInitializer *initializer) { - bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.')); + int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); + bool isType = !objectType.isEmpty() && + (objectType.at(0).isUpper() || + (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper())); int propertyCount = 0; for (; propertyName; propertyName = propertyName->next){ @@ -216,7 +222,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, if(propertyCount || !currentObject()) { QmlError error; - error.setDescription("Expected type name"); + error.setDescription(QCoreApplication::translate("QmlParser","Expected type name")); error.setLine(typeLocation.startLine); error.setColumn(typeLocation.startColumn); _parser->_errors << error; @@ -234,15 +240,21 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, return 0; } else { - // Class - const int typeId = _parser->findOrCreateTypeId(objectType); + + QString resolvableObjectType = objectType; + if (lastTypeDot >= 0) + resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/')); + const int typeId = _parser->findOrCreateTypeId(resolvableObjectType); Object *obj = new Object; obj->type = typeId; - _scope.append(objectType); + + // XXX this doesn't do anything (_scope never builds up) + _scope.append(resolvableObjectType); obj->typeName = qualifiedNameId().toLatin1(); _scope.removeLast(); + obj->location = location; if (propertyCount) { @@ -416,7 +428,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) if(!typeFound) { QmlError error; - error.setDescription("Expected property type"); + error.setDescription(QCoreApplication::translate("QmlParser","Expected property type")); error.setLine(node->typeToken.startLine); error.setColumn(node->typeToken.startColumn); _parser->_errors << error; @@ -562,7 +574,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node) if(funDecl->formals) { QmlError error; - error.setDescription("Slot declarations must be parameterless"); + error.setDescription(QCoreApplication::translate("QmlParser","Slot declarations must be parameterless")); error.setLine(funDecl->lparenToken.startLine); error.setColumn(funDecl->lparenToken.startColumn); _parser->_errors << error; @@ -576,7 +588,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node) obj->dynamicSlots << slot; } else { QmlError error; - error.setDescription("JavaScript declaration outside Script element"); + error.setDescription(QCoreApplication::translate("QmlParser","JavaScript declaration outside Script element")); error.setLine(node->firstSourceLocation().startLine); error.setColumn(node->firstSourceLocation().startColumn); _parser->_errors << error; @@ -621,6 +633,9 @@ QmlScriptParser::~QmlScriptParser() bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer<QFxPerf::QmlParsing> pt; +#endif const QString fileName = url.toString(); QTextStream stream(data, QIODevice::ReadOnly); diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 1552cb5..a5cc649 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -1017,7 +1017,8 @@ void QmlVME::runStoreInstruction(QStack<QObject *> &stack, QFxCompilerTimer<QFxCompiler::InstrStoreReal> cc; #endif QObject *target = stack.top(); - qreal r = instr.storeReal.value; + //### moc treats qreal properties as having type double + double r = static_cast<double>(instr.storeReal.value); void *a[1]; a[0] = &r; QMetaObject::metacall(target, QMetaObject::WriteProperty, diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp index e0a668a..37a6678 100644 --- a/src/declarative/qml/script/qmlbasicscript.cpp +++ b/src/declarative/qml/script/qmlbasicscript.cpp @@ -139,9 +139,16 @@ static QVariant fetch_value(QObject *o, int idx, int type) } break; case 135: + { + float val; + void *args[] = { &val, 0 }; + QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); + return QVariant(val); + } + break; case QVariant::Double: { - qreal val; + double val; void *args[] = { &val, 0 }; QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); return QVariant(val); diff --git a/src/declarative/test/qfxtestengine.cpp b/src/declarative/test/qfxtestengine.cpp index 70e600d..0d7e5df 100644 --- a/src/declarative/test/qfxtestengine.cpp +++ b/src/declarative/test/qfxtestengine.cpp @@ -62,7 +62,7 @@ class QFxTestEnginePrivate : public QAbstractAnimation { public: QFxTestEnginePrivate(QFxTestEngine *p) - : q(p), canvas(0), testMode(QFxTestEngine::NoTest), fullFrame(true), + : q(p), canvas(0), testMode(QFxTestEngine::NoTest), fullFrame(true), status(Working), exitOnFail(true), mismatchedFrames(0), lastFrameMismatch(false) {} @@ -106,20 +106,25 @@ public: bool compare(const QImage &img1, const QImage &img2); virtual int duration() const { return -1; } + + int elapsed() { return currentTime(); } }; bool QFxTestEnginePrivate::compare(const QImage &img1, const QImage &img2) { - if (img1.size() != img2.size()) + if (img1.size() != img2.size()) { + qWarning() << "Image size mismatch" << img1.size() << img2.size(); return false; + } int errorCount = 0; for (int yy = 0; yy < img1.height(); ++yy) { for (int xx = 0; xx < img1.width(); ++xx) { if (img1.pixel(xx, yy) != img2.pixel(xx, yy)) { errorCount++; - if (errorCount > MAX_MISMATCHED_PIXELS) + if (errorCount > MAX_MISMATCHED_PIXELS) { return false; + } } } } @@ -142,7 +147,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, qWarning("QFxTestEngine: Record ON"); } else if (d->testMode == PlaybackTest) { - QString fileName(d->testDirectory + QLatin1String("/manifest.xml")); + QString fileName(d->testDirectory + QLatin1String("/manifest.qml")); QFile f(fileName); if (!f.open(QIODevice::ReadOnly)) { qWarning() << "QFxTestEngine: Unable to open file" << fileName; @@ -150,13 +155,13 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, } QByteArray data = f.readAll(); - QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.xml"))); + QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.qml"))); QObject *o = c.create(); TestLog *log = qobject_cast<TestLog *>(o); if (log) { log->setParent(this); d->playbackTestData.actions() = log->actions(); - qWarning("QFxTestEngine: Playback ON"); + qWarning() << "QFxTestEngine: Playback ON," << d->playbackTestData.actions().count() << "actions"; } else { delete o; qWarning() << "QFxTestEngine: File" << fileName << "is corrupt."; @@ -165,7 +170,6 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, } if (d->testMode != NoTest) { - QUnifiedTimer::instance()->setConsistentTiming(true); QObject::connect(canvas, SIGNAL(framePainted()), this, SLOT(framePainted())); @@ -173,7 +177,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, canvas->installEventFilter(this); for (int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) { TestObject *o = d->playbackTestData.actions().at(ii); - if (TestMouse *m = qobject_cast<TestMouse *>(o)) + if (TestMouse *m = qobject_cast<TestMouse *>(o)) d->toPost << m; else if (TestKey *k = qobject_cast<TestKey *>(o)) d->toPost << k; @@ -201,7 +205,7 @@ void QFxTestEngine::framePainted() void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img) { TestFullFrame *ff = new TestFullFrame(q); - ff->setTime(QUnifiedTimer::instance()->elapsedTime()); + ff->setTime(elapsed()); ff->setFrameId(fullFrames.count()); fullFrames << img; @@ -211,7 +215,8 @@ void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img) TestFullFrame *pf = qobject_cast<TestFullFrame *>(playbackTestData.next()); QString filename = testDirectory + QLatin1String("/image") + QString::number(pf->frameId()) + QLatin1String(".png"); QImage recImg(filename); - if (!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) { + if (!pf || !compare(recImg, img) || pf->time() != elapsed()) { + qDebug() << pf << pf->time() << elapsed(); message(Fail, "FFrame mismatch"); } else { message(Success, "FFrame OK"); @@ -249,14 +254,14 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img) hexResult.append(toHex(result.at(ii))); TestFrame *f = new TestFrame(q); - f->setTime(QUnifiedTimer::instance()->elapsedTime()); + f->setTime(elapsed()); f->setHash(QLatin1String(hexResult)); testData.actions() << f; if (testMode == QFxTestEngine::PlaybackTest) { TestObject *o = playbackTestData.next(); TestFrame *f = qobject_cast<TestFrame *>(o); - if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!f || f->time() != elapsed() || f->hash() != QLatin1String(hexResult)) { mismatchedFrames++; if (mismatchedFrames > MAX_MISMATCHED_FRAMES || @@ -280,14 +285,13 @@ void QFxTestEnginePrivate::updateCurrentTime(int) return; while(!toPost.isEmpty()) { - int t = QUnifiedTimer::instance()->elapsedTime(); + int t = elapsed(); TestObject *o = toPost.first(); if (testMode == QFxTestEngine::RecordTest) o->setTime(t); else if (o->time() != t) return; toPost.takeFirst(); - if (TestMouse *m = qobject_cast<TestMouse *>(o)) { QMouseEvent e((QEvent::Type)m->type(), m->pos(), m->globalPos(), (Qt::MouseButton)m->button(), (Qt::MouseButtons)m->buttons(), (Qt::KeyboardModifiers)0); postedEvents.insert(&e); @@ -336,7 +340,7 @@ bool QFxTestEngine::eventFilter(QObject *, QEvent *event) void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) { TestMouse *m = new TestMouse(q); - m->setTime(QUnifiedTimer::instance()->elapsedTime()); + m->setTime(elapsed()); m->setType(e->type()); m->setButton(e->button()); m->setButtons(e->buttons()); @@ -346,14 +350,16 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) if (testMode == QFxTestEngine::PlaybackTest) { TestMouse *m = qobject_cast<TestMouse *>(playbackTestData.next()); - if (!m || m->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!m || m->time() != elapsed() || m->type() != e->type() || m->button() != e->button() || m->buttons() != e->buttons() || - m->globalPos() != e->globalPos() || - m->pos() != e->pos()) +// m->globalPos() != e->globalPos() || + m->pos() != e->pos()) { + if (m) + qWarning() << m->time() << elapsed(); message(Fail, "Mouse mismatch"); - else + } else message(Success, "Mouse OK"); testPass(); @@ -366,7 +372,7 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e) { TestKey *k = new TestKey(q); - k->setTime(QUnifiedTimer::instance()->elapsedTime()); + k->setTime(elapsed()); k->setType(e->type()); k->setModifiers(e->QInputEvent::modifiers()); k->setText(e->text()); @@ -374,7 +380,7 @@ void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e) testData.actions() << k; if (testMode == QFxTestEngine::PlaybackTest) { TestKey *f = qobject_cast<TestKey *>(playbackTestData.next()); - if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!f || f->time() != elapsed() || f->type() != e->type() || f->modifiers() != e->QInputEvent::modifiers() || f->text() != e->text() || @@ -400,7 +406,7 @@ void QFxTestEnginePrivate::message(MessageType t, const char *message) qWarning("%s", message); if (t == Fail) { if (exitOnFail) { - save(QLatin1String("manifest-fail.xml"), false); + save(QLatin1String("manifest-fail.qml"), false); qFatal("Failed"); } else { status = Failed; @@ -428,7 +434,7 @@ void QFxTestEngine::save() if (d->testMode != RecordTest) return; - d->save(QLatin1String("manifest.xml")); + d->save(QLatin1String("manifest.qml")); } void QFxTestEnginePrivate::testPass() @@ -436,7 +442,7 @@ void QFxTestEnginePrivate::testPass() if (playbackTestData.atEnd()) { qWarning("Test PASSED"); if (exitOnFail) { - save(QLatin1String("manifest-play.xml")); + save(QLatin1String("manifest-play.qml")); exit(0); } else { status = Passed; diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp index be1ab07..5beefd9 100644 --- a/src/declarative/test/qfxtestobjects.cpp +++ b/src/declarative/test/qfxtestobjects.cpp @@ -42,7 +42,8 @@ #include "qfxtestobjects.h" #include <qml.h> -#include <QIODevice> +#include <QDebug> +#include <QTextStream> QT_BEGIN_NAMESPACE @@ -59,6 +60,14 @@ QML_DEFINE_TYPE(TestKey,TestKey); QML_DECLARE_TYPE(TestLog); QML_DEFINE_TYPE(TestLog,TestLog); +static QString padding(int pad) +{ + QString p; + while (pad--) + p += QLatin1Char(' '); + return p; +} + TestObject::TestObject(QObject *parent) : QObject(parent), _time(-1) { @@ -77,11 +86,11 @@ void TestObject::setTime(int t) emit dataChanged(); } -void TestObject::save(QXmlStreamWriter *device) +void TestObject::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestObject")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestObject {") << endl; + device << padding(pad) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad) << QLatin1String("}") << endl; } @@ -103,12 +112,12 @@ void TestFrame::setHash(const QString &h) emit frameChanged(); } -void TestFrame::save(QXmlStreamWriter *device) +void TestFrame::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestFrame")); - device->writeAttribute(QLatin1String("time"), QLatin1String(QByteArray::number(time()))); - device->writeAttribute(QLatin1String("hash"), hash()); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestFrame {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; + device << padding(pad+4)<< QLatin1String("hash: '") << hash() << QLatin1String("'") << endl; + device << padding(pad) << QLatin1Char('}') << endl; } TestFullFrame::TestFullFrame(QObject *parent) @@ -129,12 +138,12 @@ void TestFullFrame::setFrameId(int id) emit frameChanged(); } -void TestFullFrame::save(QXmlStreamWriter *device) +void TestFullFrame::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestFullFrame")); - device->writeAttribute(QLatin1String("time"), QLatin1String(QByteArray::number(time()))); - device->writeAttribute(QLatin1String("frameId"), QLatin1String(QByteArray::number(frameId()))); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestFullFrame {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; + device << padding(pad+4) << QLatin1String("frameId: ") << QLatin1String(QByteArray::number(frameId())) << endl; + device << padding(pad) << QLatin1String("}") << endl; } TestMouse::TestMouse(QObject *parent) @@ -207,16 +216,16 @@ void TestMouse::setPos(const QPoint &p) emit mouseChanged(); } -void TestMouse::save(QXmlStreamWriter *device) +void TestMouse::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestMouse")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeAttribute(QLatin1String("type"), QString::number(type())); - device->writeAttribute(QLatin1String("button"), QString::number(button())); - device->writeAttribute(QLatin1String("buttons"), QString::number(buttons())); - device->writeAttribute(QLatin1String("globalPos"), QString::number(globalPos().x()) + QLatin1String(",") + QString::number(globalPos().y())); - device->writeAttribute(QLatin1String("pos"), QString::number(pos().x()) + QLatin1String(",") + QString::number(pos().y())); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestMouse {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; + device << padding(pad+4) << QLatin1String("button: ") << QString::number(button()) << endl; + device << padding(pad+4) << QLatin1String("buttons: ") << QString::number(buttons()) << endl; + device << padding(pad+4) << QLatin1String("globalPos: '") << QString::number(globalPos().x()) + QLatin1String(",") + QString::number(globalPos().y()) << QLatin1String("'") << endl; + device << padding(pad+4) << QLatin1String("pos: '") << QString::number(pos().x()) + QLatin1String(",") + QString::number(pos().y()) << QLatin1String("'") << endl; + device << padding(pad) << QLatin1String("}") << endl; } TestKey::TestKey(QObject *parent) @@ -276,16 +285,16 @@ void TestKey::setKey(int k) emit keyChanged(); } -void TestKey::save(QXmlStreamWriter *device) +void TestKey::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestKey")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeAttribute(QLatin1String("type"), QString::number(type())); - device->writeAttribute(QLatin1String("modifiers"), QString::number(modifiers())); - device->writeAttribute(QLatin1String("key"), QString::number(key())); + device << padding(pad) << QLatin1String("TestKey {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; + device << padding(pad+4) << QLatin1String("modifiers: ") << QString::number(modifiers()) << endl; + device << padding(pad+4) << QLatin1String("key: ") << QString::number(key()) << endl; if (key() != Qt::Key_Escape) - device->writeAttribute(QLatin1String("text"), text()); - device->writeEndElement(); + device << padding(pad+4) << QLatin1String("text: '") << text() << QLatin1String("'")<< endl; + device << padding(pad) << QLatin1String("}") << endl; } TestLog::TestLog(QObject *parent) @@ -313,14 +322,11 @@ void TestLog::save(QIODevice *device) // Order correctly qStableSort(_actions.begin(), _actions.end(), lessThan); - QXmlStreamWriter writer(device); - writer.setAutoFormatting(true); - writer.writeStartDocument(QLatin1String("1.0")); - writer.writeStartElement(QLatin1String("TestLog")); + QTextStream writer(device); + writer << QLatin1String("TestLog {") << endl; for (int ii = 0; ii < _actions.count(); ++ii) - _actions.at(ii)->save(&writer); - writer.writeEndElement(); - writer.writeEndDocument(); + _actions.at(ii)->save(writer, 4); + writer << QLatin1String("}") << endl; } TestObject *TestLog::next() diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h index 653656e..de4d94b 100644 --- a/src/declarative/test/qfxtestobjects.h +++ b/src/declarative/test/qfxtestobjects.h @@ -45,7 +45,7 @@ #include <QtCore/QObject> #include <QtCore/QPoint> #include <QtCore/QList> -#include <QtCore/QXmlStreamWriter> +#include <QtCore/QTextStream> QT_BEGIN_HEADER @@ -64,7 +64,7 @@ public: int time() const; void setTime(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void dataChanged(); @@ -82,7 +82,7 @@ public: QString hash() const; void setHash(const QString &); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void frameChanged(); @@ -100,7 +100,7 @@ public: int frameId() const; void setFrameId(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void frameChanged(); @@ -134,7 +134,7 @@ public: QPoint pos() const; void setPos(const QPoint &); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void mouseChanged(); @@ -169,7 +169,7 @@ public: int key() const; void setKey(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void keyChanged(); diff --git a/src/declarative/test/qfxtestview.cpp b/src/declarative/test/qfxtestview.cpp index 94bcb30..0bd5a6b 100644 --- a/src/declarative/test/qfxtestview.cpp +++ b/src/declarative/test/qfxtestview.cpp @@ -57,6 +57,7 @@ QFxTestView::QFxTestView(const QString &filename, const QString &testdir) testEngine = new QFxTestEngine(QFxTestEngine::PlaybackTest, testdir, this, this); + qWarning() << "Testing:" << filename; QFile file(filename); file.open(QFile::ReadOnly); QString qml = QString::fromUtf8(file.readAll()); @@ -67,6 +68,8 @@ QFxTestView::QFxTestView(const QString &filename, const QString &testdir) void QFxTestView::setSceneSize(QSize s) { + if (s.isNull()) + qWarning() << "Scene size is invalid"; setFixedSize(s); } diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 5ce8646..01ac878 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -44,16 +44,20 @@ QT_BEGIN_NAMESPACE Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { - Q_DEFINE_PERFORMANCE_METRIC(XmlParsing, "XML Parsing"); - Q_DEFINE_PERFORMANCE_METRIC(Compile, "XML Compilation"); - Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "XML Compilation Run"); - Q_DEFINE_PERFORMANCE_METRIC(CssParsing, "CSS Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "QML Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(Compile, "QML Compilation"); + Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "QML Compilation Run"); Q_DEFINE_PERFORMANCE_METRIC(CreateComponent, "Component creation"); Q_DEFINE_PERFORMANCE_METRIC(BindInit, "BindValue Initialization"); Q_DEFINE_PERFORMANCE_METRIC(BindCompile, "BindValue compile"); Q_DEFINE_PERFORMANCE_METRIC(BindValue, "BindValue execution"); Q_DEFINE_PERFORMANCE_METRIC(BindValueSSE, "BindValue execution SSE"); Q_DEFINE_PERFORMANCE_METRIC(BindValueQt, "BindValue execution QtScript"); + Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); + Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBindableValue::update"); Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading"); Q_DEFINE_PERFORMANCE_METRIC(MetaProperty, "Meta property resolution"); @@ -65,11 +69,7 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete, "QFxComponentInstance::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, "QFxBaseLayout::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, "QFxText::componentComplete"); - Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); - Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); 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 b1f9bd0..3430658 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -50,16 +50,20 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { - Q_DECLARE_PERFORMANCE_METRIC(XmlParsing); + Q_DECLARE_PERFORMANCE_METRIC(QmlParsing); Q_DECLARE_PERFORMANCE_METRIC(Compile); Q_DECLARE_PERFORMANCE_METRIC(CompileRun); - Q_DECLARE_PERFORMANCE_METRIC(CssParsing); Q_DECLARE_PERFORMANCE_METRIC(CreateComponent); Q_DECLARE_PERFORMANCE_METRIC(BindInit); Q_DECLARE_PERFORMANCE_METRIC(BindCompile); Q_DECLARE_PERFORMANCE_METRIC(BindValue); Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE); Q_DECLARE_PERFORMANCE_METRIC(BindValueQt); + Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); + Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); + Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate); Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad); Q_DECLARE_PERFORMANCE_METRIC(MetaProperty); @@ -71,12 +75,8 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete); - Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); - Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); - Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText); + Q_DECLARE_PERFORMANCE_METRIC(AddScript); } #endif // _QFXPERF_H_ diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index aa7ed38..bfad44c 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -98,6 +98,11 @@ QmlPackage::QmlPackage(QObject *parent) QmlPackage::~QmlPackage() { + Q_D(QmlPackage); + for (int ii = 0; ii < d->dataList.count(); ++ii) { + QObject *obj = d->dataList.at(ii); + delete obj; + } } QmlList<QObject *> *QmlPackage::data() diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index d986b7a..d6d610a 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -55,11 +55,10 @@ #include <QNetworkReply> #include <QNetworkRequest> #include <QtDeclarative/qmlinfo.h> +#include <qfxperf.h> QT_BEGIN_NAMESPACE - - class QmlScriptPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlScript); @@ -183,6 +182,9 @@ void QmlScript::replyFinished() void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &fileName) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer<QFxPerf::AddScript> pt; +#endif Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 480a2dc..f8ea8de 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -268,10 +268,16 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, XVisualInfo vi; - int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); - if (err == 0) { - qWarning("Error: Couldn't get a matching X visual for format"); - return; + if (parentWidget()) { + vi.depth = parentWidget()->x11Info().depth(); + vi.screen = parentWidget()->x11Info().screen(); + vi.visual = (Visual *)(parentWidget()->x11Info().visual()); + } else { + int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); + if (err == 0) { + qWarning("Error: Couldn't get a matching X visual for format"); + return; + } } XSetWindowAttributes a; diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 7d617a3..dbad4dc 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -758,6 +758,9 @@ void Generator::generateMetacall() else if (cdef->enumDeclarations.value(p.type, false)) fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s()); break;\n", propindex, p.read.constData()); + else if (p.type == "qreal") + fprintf(out, " case %d: *reinterpret_cast< double*>(_v) = %s(); break;\n", + propindex, p.read.constData()); else fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s(); break;\n", propindex, p.type.constData(), p.read.constData()); @@ -782,6 +785,9 @@ void Generator::generateMetacall() if (cdef->enumDeclarations.value(p.type, false)) { fprintf(out, " case %d: %s(QFlag(*reinterpret_cast<int*>(_v))); break;\n", propindex, p.write.constData()); + } else if(p.type == "qreal") { + fprintf(out, " case %d: %s(*reinterpret_cast< double*>(_v)); break;\n", + propindex, p.write.constData()); } else { fprintf(out, " case %d: %s(*reinterpret_cast< %s*>(_v)); break;\n", propindex, p.write.constData(), p.type.constData()); diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml new file mode 100644 index 0000000..635bf95 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal1.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Rect { id: TheRect; width: 100; height: 100 } + Rect { + anchors.left: TheRect.left + anchors.right: TheRect.right + anchors.horizontalCenter: TheRect.horizontalCenter + } +} diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml new file mode 100644 index 0000000..425d0e4 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal2.qml @@ -0,0 +1,11 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Text { id: Text1; text: "Hello" } + Text { + id: Text2; + anchors.baseline: Text1.baseline; + anchors.top: Text1.top; + text: "World" + } +} diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml new file mode 100644 index 0000000..fa48b78 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal3.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Item { + Rect { id: TheRect; width: 100; height: 100 } + } + Rect { + anchors.left: TheRect.left + } +} diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 8087d6e..587b4ab 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -16,6 +16,7 @@ public: private slots: void basicAnchors(); void loops(); + void illegalSets(); }; /* @@ -118,6 +119,48 @@ void tst_anchors::loops() } } +void tst_anchors::illegalSets() +{ + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); + + //### ignoreMessage doesn't seem to work + //QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors."); + view->execute(); + qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."); + view->execute(); + //qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "Can't anchor to an item that isn't a parent or sibling."); + view->execute(); + qApp->processEvents(); + + delete view; + } +} + QTEST_MAIN(tst_anchors) #include "tst_anchors.moc" diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 25f546a..8cf0a85 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -169,7 +169,7 @@ tst_QFxListView::tst_QFxListView() template <class T> void tst_QFxListView::items() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -205,7 +205,7 @@ void tst_QFxListView::items() template <class T> void tst_QFxListView::changed() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -238,7 +238,7 @@ void tst_QFxListView::changed() template <class T> void tst_QFxListView::inserted() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -305,7 +305,7 @@ void tst_QFxListView::inserted() template <class T> void tst_QFxListView::removed() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; for (int i = 0; i < 30; i++) @@ -445,8 +445,8 @@ QFxView *tst_QFxListView::createView(const QString &filename) QFile file(filename); file.open(QFile::ReadOnly); - QString xml = file.readAll(); - canvas->setQml(xml, filename); + QString qml = file.readAll(); + canvas->setQml(qml, filename); return canvas; } @@ -459,8 +459,10 @@ template<typename T> T *tst_QFxListView::findItem(QFxItem *parent, const QString &id, int index) { const QMetaObject &mo = T::staticMetaObject; + qDebug() << parent->children()->count() << "children"; for (int i = 0; i < parent->children()->count(); ++i) { QFxItem *item = parent->children()->at(i); + qDebug() << "try" << item; if (mo.cast(item) && (id.isEmpty() || item->id() == id)) { if (index != -1) { QmlExpression e(qmlContext(item), "index", item); diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.qml b/tests/auto/declarative/visual/ListView/basic1/basic1.qml new file mode 100644 index 0000000..d9cd030 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic1/basic1.qml @@ -0,0 +1,25 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + ListView { + anchors.fill: parent + delegate: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + model: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.xml b/tests/auto/declarative/visual/ListView/basic1/basic1.xml deleted file mode 100644 index 5038c0a..0000000 --- a/tests/auto/declarative/visual/ListView/basic1/basic1.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <ListView anchors.fill="{parent}"> - <delegate> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </delegate> - <model> - <ListModel> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - </model> - </ListView> -</Rect> diff --git a/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png Binary files differdeleted file mode 100644 index 403b407..0000000 --- a/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..f8a4830 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic1/test b/tests/auto/declarative/visual/ListView/basic1/test index 62f0665..49fcf5a 100644 --- a/tests/auto/declarative/visual/ListView/basic1/test +++ b/tests/auto/declarative/visual/ListView/basic1/test @@ -1 +1 @@ -basic1.xml +basic1.qml diff --git a/tests/auto/declarative/visual/ListView/basic2/basic2.qml b/tests/auto/declarative/visual/ListView/basic2/basic2.qml new file mode 100644 index 0000000..e5996cf --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic2/basic2.qml @@ -0,0 +1,29 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + ListView { + anchors.fill: parent + delegate: Delegate + model: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic2/basic2.xml b/tests/auto/declarative/visual/ListView/basic2/basic2.xml deleted file mode 100644 index 5e139fe..0000000 --- a/tests/auto/declarative/visual/ListView/basic2/basic2.xml +++ /dev/null @@ -1,20 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <Component id="Delegate"> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </Component> - - <ListView anchors.fill="{parent}" delegate="{Delegate}"> - <model> - <ListModel> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - </model> - </ListView> -</Rect> diff --git a/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png Binary files differdeleted file mode 100644 index 403b407..0000000 --- a/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml deleted file mode 100644 index f3fa6c9..0000000 --- a/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="31" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..f8a4830 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic2/test b/tests/auto/declarative/visual/ListView/basic2/test index ae974fe..eb79495 100644 --- a/tests/auto/declarative/visual/ListView/basic2/test +++ b/tests/auto/declarative/visual/ListView/basic2/test @@ -1 +1 @@ -basic2.xml +basic2.qml diff --git a/tests/auto/declarative/visual/ListView/basic3/basic3.qml b/tests/auto/declarative/visual/ListView/basic3/basic3.qml new file mode 100644 index 0000000..98aa5fb --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic3/basic3.qml @@ -0,0 +1,27 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + ListModel { + id: Model + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + ListView { + anchors.fill: parent + model: Model + delegate: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic3/basic3.xml b/tests/auto/declarative/visual/ListView/basic3/basic3.xml deleted file mode 100644 index a587b82..0000000 --- a/tests/auto/declarative/visual/ListView/basic3/basic3.xml +++ /dev/null @@ -1,18 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <ListModel id="Model"> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - - <ListView anchors.fill="{parent}" model="{Model}"> - <delegate> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </delegate> - </ListView> -</Rect> diff --git a/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png Binary files differdeleted file mode 100644 index 403b407..0000000 --- a/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..f8a4830 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic3/test b/tests/auto/declarative/visual/ListView/basic3/test index ea3154e..9ec306b 100644 --- a/tests/auto/declarative/visual/ListView/basic3/test +++ b/tests/auto/declarative/visual/ListView/basic3/test @@ -1 +1 @@ -basic3.xml +basic3.qml diff --git a/tests/auto/declarative/visual/ListView/basic4/basic4.qml b/tests/auto/declarative/visual/ListView/basic4/basic4.qml new file mode 100644 index 0000000..9e5229a --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic4/basic4.qml @@ -0,0 +1,31 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + ListModel { + id: Model + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + ListView { + anchors.fill: parent + model: Model + delegate: Delegate + } +} diff --git a/tests/auto/declarative/visual/ListView/basic4/basic4.xml b/tests/auto/declarative/visual/ListView/basic4/basic4.xml deleted file mode 100644 index 4b9201c..0000000 --- a/tests/auto/declarative/visual/ListView/basic4/basic4.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <ListModel id="Model"> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - - <Component id="Delegate"> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </Component> - - <ListView anchors.fill="{parent}" model="{Model}" delegate="{Delegate}"> - </ListView> -</Rect> diff --git a/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png Binary files differdeleted file mode 100644 index 403b407..0000000 --- a/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..f8a4830 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic4/test b/tests/auto/declarative/visual/ListView/basic4/test index 891e0be..2a7f227 100644 --- a/tests/auto/declarative/visual/ListView/basic4/test +++ b/tests/auto/declarative/visual/ListView/basic4/test @@ -1 +1 @@ -basic4.xml +basic4.qml diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml new file mode 100644 index 0000000..61cedc2 --- /dev/null +++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml @@ -0,0 +1,40 @@ +Rect { + color: "blue" + width: 320 + height: 240 + id: Page + Rect { + id: MyRect + width: 100 + height: 100 + color: "red" + x: 10 + } + states: [ + State { + name: "hello" + SetProperty { + target: MyRect + property: "x" + binding: 100 + } + SetProperty { + target: MyMouseRegion + property: "onClicked" + value: "Page.currentState = ''" + } + } + ] + transitions: [ + Transition { + NumericAnimation { + properties: "x" + } + } + ] + MouseRegion { + id: MyMouseRegion + anchors.fill: parent + onClicked: { Page.state= 'hello' } + } +} diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml deleted file mode 100644 index 30b0b6a..0000000 --- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Rect color="blue" width="320" height="240" id="Page"> - <Rect id="MyRect" width="100" height="100" color="red" x="{10}" /> - - <states> - <State name="hello"> - <SetProperty target="{MyRect}" property="x" binding="100" /> - <SetProperty target="{MyMouseRegion}" property="onClick" value="Page.currentState = ''" /> - </State> - </states> - - <transitions> - <Transition> - <NumericAnimation properties="x" /> - </Transition> - </transitions> - - <MouseRegion id="MyMouseRegion" anchors.fill="{parent}" onClick="Page.currentState= 'hello'" /> - -</Rect> diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml b/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml deleted file mode 100644 index 6c5856f..0000000 --- a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> - <TestMouse time="1770" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="1860" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="1860" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="1920" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="1950" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="1980" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="2010" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="2040" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="2070" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="2100" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="2130" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="2160" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="2190" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="2220" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="2250" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="2280" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="2310" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="2340" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="2370" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="2400" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestMouse time="2820" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="2910" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="2910" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestFrame time="2970" hash="ADC501A3A2B8AAF72F58BA985B57424E"/> - <TestFrame time="3000" hash="BFA51B7C19753EF7B16D78AFFFC7B9DD"/> - <TestFrame time="3030" hash="A93F930EC8528F954CD4A770C9A8171B"/> - <TestFrame time="3060" hash="0B0C6419E1E5B016D9C22BD98FD452B1"/> - <TestFrame time="3090" hash="1D5CD86AB732DA3705A7BB1DEAB77923"/> - <TestFrame time="3120" hash="69058485CED6BC992A1A7C5EE34ADD4C"/> - <TestFrame time="3150" hash="72731478D80F024076EA639B55152360"/> - <TestFrame time="3180" hash="37739777A5979F3EBF85E47E63341660"/> - <TestFrame time="3210" hash="FCAE0317F81A3DDD713F4DB1349A9DA0"/> - <TestFrame time="3240" hash="82363265ED2B611A54F8D48B2AF22F11"/> - <TestFrame time="3270" hash="5FAE0BDC65C609CB766CE585B8C649DB"/> - <TestFrame time="3300" hash="2D21B4AF3780EF2BBCCFCEC957CE49C8"/> - <TestFrame time="3330" hash="4AB21E266919FB8D340F87091D8E1F62"/> - <TestFrame time="3360" hash="5F5DA43901938FA244F536336FFD2DFC"/> - <TestFrame time="3390" hash="9B7685F5933C5E06883EE4D1BB2BD2C6"/> - <TestFrame time="3420" hash="96C077E3A572EDFF04FA9B2F7020FFD0"/> - <TestFrame time="3450" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestMouse time="3840" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="3930" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="3930" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="3990" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="4020" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="4050" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="4080" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="4110" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="4140" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="4170" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="4200" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="4230" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="4260" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="4290" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="4320" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="4350" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="4380" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="4410" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="4440" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="4470" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestMouse time="4920" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="5010" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="5010" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestFrame time="5070" hash="ADC501A3A2B8AAF72F58BA985B57424E"/> - <TestFrame time="5100" hash="BFA51B7C19753EF7B16D78AFFFC7B9DD"/> - <TestFrame time="5130" hash="A93F930EC8528F954CD4A770C9A8171B"/> - <TestFrame time="5160" hash="0B0C6419E1E5B016D9C22BD98FD452B1"/> - <TestFrame time="5190" hash="1D5CD86AB732DA3705A7BB1DEAB77923"/> - <TestFrame time="5220" hash="69058485CED6BC992A1A7C5EE34ADD4C"/> - <TestFrame time="5250" hash="72731478D80F024076EA639B55152360"/> - <TestFrame time="5280" hash="37739777A5979F3EBF85E47E63341660"/> - <TestFrame time="5310" hash="FCAE0317F81A3DDD713F4DB1349A9DA0"/> - <TestFrame time="5340" hash="82363265ED2B611A54F8D48B2AF22F11"/> - <TestFrame time="5370" hash="5FAE0BDC65C609CB766CE585B8C649DB"/> - <TestFrame time="5400" hash="2D21B4AF3780EF2BBCCFCEC957CE49C8"/> - <TestFrame time="5430" hash="4AB21E266919FB8D340F87091D8E1F62"/> - <TestFrame time="5460" hash="5F5DA43901938FA244F536336FFD2DFC"/> - <TestFrame time="5490" hash="9B7685F5933C5E06883EE4D1BB2BD2C6"/> - <TestFrame time="5520" hash="96C077E3A572EDFF04FA9B2F7020FFD0"/> - <TestFrame time="5550" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestMouse time="5910" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="6030" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="6030" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="6090" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="6120" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="6150" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="6180" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="6210" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="6240" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="6270" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="6300" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="6330" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="6360" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="6390" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="6420" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="6450" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="6480" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="6510" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="6540" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="6570" hash="383BA6B9EFCC58FCA512982A207631F6"/> -</TestLog> diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml b/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml deleted file mode 100644 index 6c5856f..0000000 --- a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> - <TestMouse time="1770" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="1860" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="1860" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="1920" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="1950" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="1980" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="2010" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="2040" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="2070" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="2100" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="2130" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="2160" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="2190" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="2220" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="2250" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="2280" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="2310" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="2340" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="2370" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="2400" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestMouse time="2820" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="2910" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="2910" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestFrame time="2970" hash="ADC501A3A2B8AAF72F58BA985B57424E"/> - <TestFrame time="3000" hash="BFA51B7C19753EF7B16D78AFFFC7B9DD"/> - <TestFrame time="3030" hash="A93F930EC8528F954CD4A770C9A8171B"/> - <TestFrame time="3060" hash="0B0C6419E1E5B016D9C22BD98FD452B1"/> - <TestFrame time="3090" hash="1D5CD86AB732DA3705A7BB1DEAB77923"/> - <TestFrame time="3120" hash="69058485CED6BC992A1A7C5EE34ADD4C"/> - <TestFrame time="3150" hash="72731478D80F024076EA639B55152360"/> - <TestFrame time="3180" hash="37739777A5979F3EBF85E47E63341660"/> - <TestFrame time="3210" hash="FCAE0317F81A3DDD713F4DB1349A9DA0"/> - <TestFrame time="3240" hash="82363265ED2B611A54F8D48B2AF22F11"/> - <TestFrame time="3270" hash="5FAE0BDC65C609CB766CE585B8C649DB"/> - <TestFrame time="3300" hash="2D21B4AF3780EF2BBCCFCEC957CE49C8"/> - <TestFrame time="3330" hash="4AB21E266919FB8D340F87091D8E1F62"/> - <TestFrame time="3360" hash="5F5DA43901938FA244F536336FFD2DFC"/> - <TestFrame time="3390" hash="9B7685F5933C5E06883EE4D1BB2BD2C6"/> - <TestFrame time="3420" hash="96C077E3A572EDFF04FA9B2F7020FFD0"/> - <TestFrame time="3450" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestMouse time="3840" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="3930" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="3930" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="3990" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="4020" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="4050" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="4080" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="4110" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="4140" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="4170" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="4200" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="4230" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="4260" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="4290" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="4320" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="4350" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="4380" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="4410" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="4440" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="4470" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestMouse time="4920" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="5010" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="5010" hash="383BA6B9EFCC58FCA512982A207631F6"/> - <TestFrame time="5070" hash="ADC501A3A2B8AAF72F58BA985B57424E"/> - <TestFrame time="5100" hash="BFA51B7C19753EF7B16D78AFFFC7B9DD"/> - <TestFrame time="5130" hash="A93F930EC8528F954CD4A770C9A8171B"/> - <TestFrame time="5160" hash="0B0C6419E1E5B016D9C22BD98FD452B1"/> - <TestFrame time="5190" hash="1D5CD86AB732DA3705A7BB1DEAB77923"/> - <TestFrame time="5220" hash="69058485CED6BC992A1A7C5EE34ADD4C"/> - <TestFrame time="5250" hash="72731478D80F024076EA639B55152360"/> - <TestFrame time="5280" hash="37739777A5979F3EBF85E47E63341660"/> - <TestFrame time="5310" hash="FCAE0317F81A3DDD713F4DB1349A9DA0"/> - <TestFrame time="5340" hash="82363265ED2B611A54F8D48B2AF22F11"/> - <TestFrame time="5370" hash="5FAE0BDC65C609CB766CE585B8C649DB"/> - <TestFrame time="5400" hash="2D21B4AF3780EF2BBCCFCEC957CE49C8"/> - <TestFrame time="5430" hash="4AB21E266919FB8D340F87091D8E1F62"/> - <TestFrame time="5460" hash="5F5DA43901938FA244F536336FFD2DFC"/> - <TestFrame time="5490" hash="9B7685F5933C5E06883EE4D1BB2BD2C6"/> - <TestFrame time="5520" hash="96C077E3A572EDFF04FA9B2F7020FFD0"/> - <TestFrame time="5550" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestMouse time="5910" type="2" button="1" buttons="1" globalPos="614,528" pos="175,131"/> - <TestMouse time="6030" type="3" button="1" buttons="0" globalPos="614,528" pos="175,131"/> - <TestFrame time="6030" hash="7CB5FC371040E587DE9F06CE14A4B29A"/> - <TestFrame time="6090" hash="8F88EE8780C32F038C9ACDC7172DE04E"/> - <TestFrame time="6120" hash="BE859D598C5DB953A8FC506DED4940EB"/> - <TestFrame time="6150" hash="16FE17B15900FF0464AB20EA921E5B1F"/> - <TestFrame time="6180" hash="FCB17070EF24575C61046928A8BBE440"/> - <TestFrame time="6210" hash="4F58226BDBDA7339D972ECA065F75766"/> - <TestFrame time="6240" hash="D9AF30557F99B086BB1A185A946B580D"/> - <TestFrame time="6270" hash="082E0E7650D187A54EF0948CCCA98E5A"/> - <TestFrame time="6300" hash="4F41101378A104E72228EEB4BA395CA8"/> - <TestFrame time="6330" hash="3223ED179C828FADB3ECA9C6373176C1"/> - <TestFrame time="6360" hash="DAFCCE427161A70C3513841AC22AEA00"/> - <TestFrame time="6390" hash="7F465A99FCA50503736E470A0B4E1C7A"/> - <TestFrame time="6420" hash="97542160B249135B1F3957DBBB329C2E"/> - <TestFrame time="6450" hash="F9F74A2E38B52C9266F33E428B6ACD9D"/> - <TestFrame time="6480" hash="65AD7E0189C096792331BD1BB0DAF0DB"/> - <TestFrame time="6510" hash="BA403842BA3128B1CDF6A9CB28C90751"/> - <TestFrame time="6540" hash="1BCDCD0E8166D69F4349E05D5E92FD9D"/> - <TestFrame time="6570" hash="383BA6B9EFCC58FCA512982A207631F6"/> -</TestLog> diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png Binary files differindex 2cda3fa..92f8cdd 100644 --- a/tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png +++ b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png diff --git a/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml new file mode 100644 index 0000000..1454949 --- /dev/null +++ b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml @@ -0,0 +1,86 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestMouse { + time: 1296 + type: 2 + button: 1 + buttons: 1 + globalPos: '87,985' + pos: '83,29' + } + TestMouse { + time: 1360 + type: 3 + button: 1 + buttons: 0 + globalPos: '87,985' + pos: '83,29' + } + TestFrame { + time: 1376 + hash: '7CB5FC371040E587DE9F06CE14A4B29A' + } + TestFrame { + time: 1392 + hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE' + } + TestFrame { + time: 1408 + hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE' + } + TestFrame { + time: 1424 + hash: '69FB651AA84E07E4A6DEAA31CB10641B' + } + TestFrame { + time: 1440 + hash: '3FFC4C4BD282010A359DCEAF2D8496AC' + } + TestFrame { + time: 1456 + hash: '3FFC4C4BD282010A359DCEAF2D8496AC' + } + TestFrame { + time: 1472 + hash: 'ADA58B13247A654BBCECF3F254AB797F' + } + TestFrame { + time: 1488 + hash: 'B314799BC732B6BD8C42A622B720E3D5' + } + TestFrame { + time: 1504 + hash: 'B314799BC732B6BD8C42A622B720E3D5' + } + TestFrame { + time: 1520 + hash: '7377569C13CF5DE368B22209AB8AE395' + } + TestFrame { + time: 1536 + hash: '7C1E4A1F80C68EE57D052A9D7851F937' + } + TestFrame { + time: 1552 + hash: '7C1E4A1F80C68EE57D052A9D7851F937' + } + TestFrame { + time: 1568 + hash: '24D6DB9544205075836A86A54B55A820' + } + TestFrame { + time: 1584 + hash: '24D6DB9544205075836A86A54B55A820' + } + TestFrame { + time: 1600 + hash: '8A84E4C3E8AD4C6A9A7BD3E1620718C1' + } + TestFrame { + time: 1616 + hash: 'B8EA544A4EF3B7E0A9E0A7777B55EDC7' + } +} diff --git a/tests/auto/declarative/visual/bindinganimation/test b/tests/auto/declarative/visual/bindinganimation/test index 964c489..bb59333 100644 --- a/tests/auto/declarative/visual/bindinganimation/test +++ b/tests/auto/declarative/visual/bindinganimation/test @@ -1 +1 @@ -bindinganimation.xml +bindinganimation.qml diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml new file mode 100644 index 0000000..d351b8c --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml @@ -0,0 +1,41 @@ +Rect { + id: mainrect + width: 200; height: 200 + state: "first" + states: [ + State { + name: "first" + SetProperty { + target: mainrect + property: "color" + value: "red" + } + }, + State { + name: "second" + SetProperty { + target: mainrect + property: "color" + value: "blue" + } + } + ] + transitions: [ + Transition { + fromState: "first" + toState: "second" + reversible: true + SequentialAnimation { + ColorAnimation { + duration: 2000 + target: mainrect + property: "color" + } + } + } + ] + MouseRegion { + anchors.fill: parent + onClicked: { mainrect.state = 'second' } + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml deleted file mode 100644 index 39d08be..0000000 --- a/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml +++ /dev/null @@ -1,18 +0,0 @@ -<Rect id="mainrect" currentState="first"> -<states> - <State name="first"> - <SetProperty target="{mainrect}" property="color" value="red"/> - </State> - <State name="second" > - <SetProperty target="{mainrect}" property="color" value="blue"/> - </State> -</states> -<transitions> - <Transition fromState="first" toState="second" reversible="true" > - <SerialAnimation> - <ColorAnimation duration="2000" target="{mainrect}" property="color" /> - </SerialAnimation> - </Transition> -</transitions> -<MouseRegion anchors.fill="{parent}" onClick="mainrect.currentState = 'second'" /> -</Rect> diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..f00a2e2 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml new file mode 100644 index 0000000..0eb8b12 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml @@ -0,0 +1,522 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestMouse { + time: 944 + type: 2 + button: 1 + buttons: 1 + globalPos: '1789,188' + pos: '73,76' + } + TestMouse { + time: 992 + type: 3 + button: 1 + buttons: 0 + globalPos: '1789,188' + pos: '73,76' + } + TestFrame { + time: 1008 + hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0' + } + TestFrame { + time: 1024 + hash: 'D35008F75B8C992F80FB16BA7203649D' + } + TestFrame { + time: 1040 + hash: '14F43E0784DDF42EA8550DB88C501BF1' + } + TestFrame { + time: 1056 + hash: '02276E158B5391480B1BDEAADF1FB903' + } + TestFrame { + time: 1072 + hash: '35D9513EB97A2C482B7CD197DE910934' + } + TestFrame { + time: 1088 + hash: 'FAF0FD681E60BB2489099F5DF772B6CD' + } + TestFrame { + time: 1104 + hash: 'A863D3E346F94785A3A392FDC91526EB' + } + TestFrame { + time: 1120 + hash: 'FDF328D3F6EB8410DA59A91345E41A44' + } + TestFrame { + time: 1136 + hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C' + } + TestFrame { + time: 1152 + hash: 'EAD0EAE76CD00189075964671EFFBAEA' + } + TestFrame { + time: 1168 + hash: '24D2457FCD51490FDA23071BF9929D12' + } + TestFrame { + time: 1184 + hash: '1478683446CF543DACBE31D0B76A98A6' + } + TestFrame { + time: 1200 + hash: '99F7DA1F31FE920F6C02ADD4042AE925' + } + TestFrame { + time: 1216 + hash: '22DEF892006CF66667770B0F17BAF6C0' + } + TestFrame { + time: 1232 + hash: '6A36D5A77099BFD58BAF285478FF04E4' + } + TestFrame { + time: 1248 + hash: '6258150666B59B20AB476724C07FC20C' + } + TestFrame { + time: 1264 + hash: 'F1636315BC950A6DD400D9C7ED263B88' + } + TestFrame { + time: 1280 + hash: '18447EA8DC2E8DA956788E5B3CF3790A' + } + TestFrame { + time: 1296 + hash: '1D2A6E65997A73E9E670356C8E8B63B2' + } + TestFrame { + time: 1312 + hash: 'BED0242C0F9EF229D1392835286D5782' + } + TestFrame { + time: 1328 + hash: '88923C190E9E5BEADEF8A409C06DF9D6' + } + TestFrame { + time: 1344 + hash: '2D133E7EE60C97386F57838B3F0976C7' + } + TestFrame { + time: 1360 + hash: '85B1821CC50F2A9F3ED6944F792B7A2F' + } + TestFrame { + time: 1376 + hash: '395195716D76BC0BE7B2033ED37A7A1C' + } + TestFrame { + time: 1392 + hash: '243DBFFCF416926242BBCB7348974C4C' + } + TestFrame { + time: 1408 + hash: 'A755068679616D8AC65C2AA7431F2A19' + } + TestFrame { + time: 1424 + hash: 'E8249B35A47EB492CBDF2D91CC8426F0' + } + TestFrame { + time: 1440 + hash: '15F3DA1C0E6F0779B96859D51171DD27' + } + TestFrame { + time: 1456 + hash: '258C0C756AAC3DE743B43051F2AACE6B' + } + TestFrame { + time: 1472 + hash: 'A58B9FDF301D72B2CC5C93934CC8927B' + } + TestFrame { + time: 1488 + hash: 'A9181D30870D472521F8904818CE520F' + } + TestFrame { + time: 1504 + hash: '7F9E94069CCF3897C26A71BD7BECD903' + } + TestFrame { + time: 1520 + hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B' + } + TestFrame { + time: 1536 + hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7' + } + TestFrame { + time: 1552 + hash: '734F0DE45A6E34C9EAB7EF606196F96A' + } + TestFrame { + time: 1568 + hash: '02A361C4534FDF7F286DC3E6DC23275C' + } + TestFrame { + time: 1584 + hash: 'E649155AD69999C14B92F6561E4D1185' + } + TestFrame { + time: 1600 + hash: '01AF177084FAB755D622973F64B92018' + } + TestFrame { + time: 1616 + hash: '097CC4A082DFAB995D213A3A73883C97' + } + TestFrame { + time: 1632 + hash: 'D7B4239A3280B1EB8E885E3F422DF8E9' + } + TestFrame { + time: 1648 + hash: '59893977994E34E83F91E7CE3AD65D6D' + } + TestFrame { + time: 1664 + hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B' + } + TestFrame { + time: 1680 + hash: '94AD0580648F36A1E18A9EA7E249B04D' + } + TestFrame { + time: 1696 + hash: '750A4C01D2F5806A89A1C6CC6A9B9A68' + } + TestFrame { + time: 1712 + hash: '4F109F50F388F1BFA4BC6B03B3E6E514' + } + TestFrame { + time: 1728 + hash: 'C6168D5CF27A533E8EE636637667BE47' + } + TestFrame { + time: 1744 + hash: 'F8120547BED987AA34C00DA5A01A4D1E' + } + TestFrame { + time: 1760 + hash: 'CBFF526136FA2C128C8B898FBBEF9E5C' + } + TestFrame { + time: 1776 + hash: 'F29E52398FAB1A239A63DF4C32F2FC69' + } + TestFrame { + time: 1792 + hash: '7178BFE86FD2FD513218B33760460F8D' + } + TestFrame { + time: 1808 + hash: 'CA83285BC8AC633403896FE976896EB0' + } + TestFrame { + time: 1824 + hash: '96BA486C09CC69D5AA38C46C00DF1181' + } + TestFrame { + time: 1840 + hash: 'B88EAB335842787869F4A14824C19DD8' + } + TestFrame { + time: 1856 + hash: '065AA59012729E1E1A246A2083142690' + } + TestFrame { + time: 1872 + hash: 'DD0E98C8398861002C5F178C5F9F612D' + } + TestFrame { + time: 1888 + hash: '04192C2B545948048ECCF4D81BBDE198' + } + TestFrame { + time: 1904 + hash: 'BB7502C7208281EF9FD41714AB88A1A8' + } + TestFrame { + time: 1920 + hash: '5397195471890D08B703DCA101E5BC7C' + } + TestFrame { + time: 1936 + hash: '4C678CDBEBB2FFD2CBF012CA77800CDE' + } + TestFrame { + time: 1952 + hash: '0D7A34ECD0C7F52B2C015037BF1902C6' + } + TestFrame { + time: 1968 + hash: 'FD9D5048BE749AC4369FDA2D018B43AE' + } + TestFrame { + time: 1984 + hash: '93EE03795CD57AE6F7FE3A020B039AD4' + } + TestFrame { + time: 2000 + hash: '5E1118963F219C39761CA7FBF564A9CA' + } + TestFrame { + time: 2016 + hash: '8F40038741903150136170503649D941' + } + TestFrame { + time: 2032 + hash: 'B087B7D0AA6224821F8E18718FF5E77D' + } + TestFrame { + time: 2048 + hash: 'AA46B04A3C67DC772265ED2901955565' + } + TestFrame { + time: 2064 + hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3' + } + TestFrame { + time: 2080 + hash: '13745A174E4D06E2108A5BF125BA50CC' + } + TestFrame { + time: 2096 + hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08' + } + TestFrame { + time: 2112 + hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA' + } + TestFrame { + time: 2128 + hash: '5128584C50305C7D218B81B8367FA3D5' + } + TestFrame { + time: 2144 + hash: 'A71461D3593F3685620668916DE870BD' + } + TestFrame { + time: 2160 + hash: '74EBAC8F32CF044B58D9883DBCD9A722' + } + TestFrame { + time: 2176 + hash: 'FEDC5B638F339B90FE59B478721E65B7' + } + TestFrame { + time: 2192 + hash: 'BCB8C7159F54C353551DD3BFF3203966' + } + TestFrame { + time: 2208 + hash: '4E9B083075BC5E9287A8ABC982778B56' + } + TestFrame { + time: 2224 + hash: '1D6F02AA99AFA47D77FC49AB894B365A' + } + TestFrame { + time: 2240 + hash: 'A204FEEC783B3B05DE4C209C21745826' + } + TestFrame { + time: 2256 + hash: '665A2A8FF00B9663157802767F504754' + } + TestFrame { + time: 2272 + hash: '624FB09EBE60CB87D767FAF8D2420B1E' + } + TestFrame { + time: 2288 + hash: 'E5AF0CDC33F3275A25ABB09E9165F310' + } + TestFrame { + time: 2304 + hash: '02BAFB5A81CA66F7670AC93DE5123860' + } + TestFrame { + time: 2320 + hash: 'E7AA6374C73832E57CEB2427A1E258AA' + } + TestFrame { + time: 2336 + hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0' + } + TestFrame { + time: 2352 + hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7' + } + TestFrame { + time: 2368 + hash: 'CE52E18C1F7732768779863B45314FF5' + } + TestFrame { + time: 2384 + hash: '99D30652559DD6931E0C95543EEAA149' + } + TestFrame { + time: 2400 + hash: 'FFBD9A00E05E085B89296D19D5CAEC57' + } + TestFrame { + time: 2416 + hash: '9C9D658B9C25602816B8066BF19105DB' + } + TestFrame { + time: 2432 + hash: '2B7FD058E6601E22A30BB7106B1C683B' + } + TestFrame { + time: 2448 + hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05' + } + TestFrame { + time: 2464 + hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB' + } + TestFrame { + time: 2480 + hash: '9BFD7AD5091CCBDDE43C593E133A7B10' + } + TestFrame { + time: 2496 + hash: '2703B617937914A90EA42EBF249D79EE' + } + TestFrame { + time: 2512 + hash: 'B77E2983138254016C4CCA53100F46FA' + } + TestFrame { + time: 2528 + hash: '60C4DD24187D1281081479E586F02B37' + } + TestFrame { + time: 2544 + hash: '62F2511ABD99EF1231C9FA4B91D4ABFE' + } + TestFrame { + time: 2560 + hash: 'E309B3353FD174E883D309571CADDC98' + } + TestFrame { + time: 2576 + hash: '1E2D6A134C7B12DDE551B148EF4F088C' + } + TestFrame { + time: 2592 + hash: 'E5DC5450604A491CC24A0DCF5C278B58' + } + TestFrame { + time: 2608 + hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E' + } + TestFrame { + time: 2624 + hash: '4E1B7E06F55FB084080689B474F1FE1D' + } + TestFrame { + time: 2640 + hash: 'B4639C907FA937BF15FAC62421170CD8' + } + TestFrame { + time: 2656 + hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B' + } + TestFrame { + time: 2672 + hash: 'A73351EABECF0D71149EFE31F197413E' + } + TestFrame { + time: 2688 + hash: '479425F1B7AFF79E4DFB7FCA534AF018' + } + TestFrame { + time: 2704 + hash: '046D0F0040A52D1F26BA9F7C5DE06EF4' + } + TestFrame { + time: 2720 + hash: '655778BF13C6080903150B0EB43A7EDC' + } + TestFrame { + time: 2736 + hash: '72DA0BBE81514870655FDD3354ADAC60' + } + TestFrame { + time: 2752 + hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7' + } + TestFrame { + time: 2768 + hash: 'C988628B6C3D3780E9A865C7694926CD' + } + TestFrame { + time: 2784 + hash: '5AB17563655231089EDD986FF13D6012' + } + TestFrame { + time: 2800 + hash: 'C1ADFF1D2E5800ED466D1691D3B17382' + } + TestFrame { + time: 2816 + hash: '70129BA01FBB19592B9DC0D0A3B3E7DF' + } + TestFrame { + time: 2832 + hash: '0000829EF7ED908BF430D42904D59CC2' + } + TestFrame { + time: 2848 + hash: '843D2927F50AB87B4A86B7A6AAEED91F' + } + TestFrame { + time: 2864 + hash: 'DA86D21756025E7DE8050586D5E2A1F8' + } + TestFrame { + time: 2880 + hash: '48DD1BD6580133B0793FEE327EA4F1E6' + } + TestFrame { + time: 2896 + hash: 'F0618193DCD0BA2837249515A1898B1C' + } + TestFrame { + time: 2912 + hash: 'A530184E57251065286C0CBBA7301E9C' + } + TestFrame { + time: 2928 + hash: '64A1D7203973D65DD342793007A61C58' + } + TestFrame { + time: 2944 + hash: '5B830DFC6BA442772DE87D75D5A578DE' + } + TestFrame { + time: 2960 + hash: '5563B056B0409B65F60DD16DD0DD890E' + } + TestFrame { + time: 2976 + hash: 'B8BCF9AD2CA8720C11563A23D8280804' + } + TestFrame { + time: 2992 + hash: '8C0FCDA4F8956394C53FC4BA18CAA850' + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml new file mode 100644 index 0000000..1fe2f15 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml @@ -0,0 +1,522 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestFrame { + time: 16 + hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0' + } + TestFrame { + time: 32 + hash: 'D35008F75B8C992F80FB16BA7203649D' + } + TestFrame { + time: 48 + hash: '14F43E0784DDF42EA8550DB88C501BF1' + } + TestFrame { + time: 64 + hash: '02276E158B5391480B1BDEAADF1FB903' + } + TestFrame { + time: 80 + hash: '35D9513EB97A2C482B7CD197DE910934' + } + TestFrame { + time: 96 + hash: 'FAF0FD681E60BB2489099F5DF772B6CD' + } + TestFrame { + time: 112 + hash: 'A863D3E346F94785A3A392FDC91526EB' + } + TestFrame { + time: 128 + hash: 'FDF328D3F6EB8410DA59A91345E41A44' + } + TestFrame { + time: 144 + hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C' + } + TestFrame { + time: 160 + hash: 'EAD0EAE76CD00189075964671EFFBAEA' + } + TestFrame { + time: 176 + hash: '24D2457FCD51490FDA23071BF9929D12' + } + TestFrame { + time: 192 + hash: '1478683446CF543DACBE31D0B76A98A6' + } + TestFrame { + time: 208 + hash: '99F7DA1F31FE920F6C02ADD4042AE925' + } + TestFrame { + time: 224 + hash: '22DEF892006CF66667770B0F17BAF6C0' + } + TestFrame { + time: 240 + hash: '6A36D5A77099BFD58BAF285478FF04E4' + } + TestFrame { + time: 256 + hash: '6258150666B59B20AB476724C07FC20C' + } + TestFrame { + time: 272 + hash: 'F1636315BC950A6DD400D9C7ED263B88' + } + TestFrame { + time: 288 + hash: '18447EA8DC2E8DA956788E5B3CF3790A' + } + TestFrame { + time: 304 + hash: '1D2A6E65997A73E9E670356C8E8B63B2' + } + TestFrame { + time: 320 + hash: 'BED0242C0F9EF229D1392835286D5782' + } + TestFrame { + time: 336 + hash: '88923C190E9E5BEADEF8A409C06DF9D6' + } + TestFrame { + time: 352 + hash: '2D133E7EE60C97386F57838B3F0976C7' + } + TestFrame { + time: 368 + hash: '85B1821CC50F2A9F3ED6944F792B7A2F' + } + TestFrame { + time: 384 + hash: '395195716D76BC0BE7B2033ED37A7A1C' + } + TestFrame { + time: 400 + hash: '243DBFFCF416926242BBCB7348974C4C' + } + TestFrame { + time: 416 + hash: 'A755068679616D8AC65C2AA7431F2A19' + } + TestFrame { + time: 432 + hash: 'E8249B35A47EB492CBDF2D91CC8426F0' + } + TestFrame { + time: 448 + hash: '15F3DA1C0E6F0779B96859D51171DD27' + } + TestFrame { + time: 464 + hash: '258C0C756AAC3DE743B43051F2AACE6B' + } + TestFrame { + time: 480 + hash: 'A58B9FDF301D72B2CC5C93934CC8927B' + } + TestFrame { + time: 496 + hash: 'A9181D30870D472521F8904818CE520F' + } + TestFrame { + time: 512 + hash: '7F9E94069CCF3897C26A71BD7BECD903' + } + TestFrame { + time: 528 + hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B' + } + TestFrame { + time: 544 + hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7' + } + TestFrame { + time: 560 + hash: '734F0DE45A6E34C9EAB7EF606196F96A' + } + TestFrame { + time: 576 + hash: '02A361C4534FDF7F286DC3E6DC23275C' + } + TestFrame { + time: 592 + hash: 'E649155AD69999C14B92F6561E4D1185' + } + TestFrame { + time: 608 + hash: '01AF177084FAB755D622973F64B92018' + } + TestFrame { + time: 624 + hash: '097CC4A082DFAB995D213A3A73883C97' + } + TestFrame { + time: 640 + hash: 'D7B4239A3280B1EB8E885E3F422DF8E9' + } + TestFrame { + time: 656 + hash: '59893977994E34E83F91E7CE3AD65D6D' + } + TestFrame { + time: 672 + hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B' + } + TestFrame { + time: 688 + hash: '94AD0580648F36A1E18A9EA7E249B04D' + } + TestFrame { + time: 704 + hash: '750A4C01D2F5806A89A1C6CC6A9B9A68' + } + TestFrame { + time: 720 + hash: '4F109F50F388F1BFA4BC6B03B3E6E514' + } + TestFrame { + time: 736 + hash: 'C6168D5CF27A533E8EE636637667BE47' + } + TestFrame { + time: 752 + hash: 'F8120547BED987AA34C00DA5A01A4D1E' + } + TestFrame { + time: 768 + hash: 'CBFF526136FA2C128C8B898FBBEF9E5C' + } + TestFrame { + time: 784 + hash: 'F29E52398FAB1A239A63DF4C32F2FC69' + } + TestFrame { + time: 800 + hash: '7178BFE86FD2FD513218B33760460F8D' + } + TestFrame { + time: 816 + hash: 'CA83285BC8AC633403896FE976896EB0' + } + TestFrame { + time: 832 + hash: '96BA486C09CC69D5AA38C46C00DF1181' + } + TestFrame { + time: 848 + hash: 'B88EAB335842787869F4A14824C19DD8' + } + TestFrame { + time: 864 + hash: '065AA59012729E1E1A246A2083142690' + } + TestFrame { + time: 880 + hash: 'DD0E98C8398861002C5F178C5F9F612D' + } + TestFrame { + time: 896 + hash: '04192C2B545948048ECCF4D81BBDE198' + } + TestMouse { + time: 912 + type: 2 + button: 1 + buttons: 1 + globalPos: '1739,207' + pos: '75,95' + } + TestFrame { + time: 912 + hash: 'BB7502C7208281EF9FD41714AB88A1A8' + } + TestFrame { + time: 928 + hash: '5397195471890D08B703DCA101E5BC7C' + } + TestFrame { + time: 944 + hash: '4C678CDBEBB2FFD2CBF012CA77800CDE' + } + TestFrame { + time: 960 + hash: '0D7A34ECD0C7F52B2C015037BF1902C6' + } + TestMouse { + time: 976 + type: 3 + button: 1 + buttons: 0 + globalPos: '1739,207' + pos: '75,95' + } + TestFrame { + time: 976 + hash: 'FD9D5048BE749AC4369FDA2D018B43AE' + } + TestFrame { + time: 992 + hash: '93EE03795CD57AE6F7FE3A020B039AD4' + } + TestFrame { + time: 1008 + hash: '5E1118963F219C39761CA7FBF564A9CA' + } + TestFrame { + time: 1024 + hash: '8F40038741903150136170503649D941' + } + TestFrame { + time: 1040 + hash: 'B087B7D0AA6224821F8E18718FF5E77D' + } + TestFrame { + time: 1056 + hash: 'AA46B04A3C67DC772265ED2901955565' + } + TestFrame { + time: 1072 + hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3' + } + TestFrame { + time: 1088 + hash: '13745A174E4D06E2108A5BF125BA50CC' + } + TestFrame { + time: 1104 + hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08' + } + TestFrame { + time: 1120 + hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA' + } + TestFrame { + time: 1136 + hash: '5128584C50305C7D218B81B8367FA3D5' + } + TestFrame { + time: 1152 + hash: 'A71461D3593F3685620668916DE870BD' + } + TestFrame { + time: 1168 + hash: '74EBAC8F32CF044B58D9883DBCD9A722' + } + TestFrame { + time: 1184 + hash: 'FEDC5B638F339B90FE59B478721E65B7' + } + TestFrame { + time: 1200 + hash: 'BCB8C7159F54C353551DD3BFF3203966' + } + TestFrame { + time: 1216 + hash: '4E9B083075BC5E9287A8ABC982778B56' + } + TestFrame { + time: 1232 + hash: '1D6F02AA99AFA47D77FC49AB894B365A' + } + TestFrame { + time: 1248 + hash: 'A204FEEC783B3B05DE4C209C21745826' + } + TestFrame { + time: 1264 + hash: '665A2A8FF00B9663157802767F504754' + } + TestFrame { + time: 1280 + hash: '624FB09EBE60CB87D767FAF8D2420B1E' + } + TestFrame { + time: 1296 + hash: 'E5AF0CDC33F3275A25ABB09E9165F310' + } + TestFrame { + time: 1312 + hash: '02BAFB5A81CA66F7670AC93DE5123860' + } + TestFrame { + time: 1328 + hash: 'E7AA6374C73832E57CEB2427A1E258AA' + } + TestFrame { + time: 1344 + hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0' + } + TestFrame { + time: 1360 + hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7' + } + TestFrame { + time: 1376 + hash: 'CE52E18C1F7732768779863B45314FF5' + } + TestFrame { + time: 1392 + hash: '99D30652559DD6931E0C95543EEAA149' + } + TestFrame { + time: 1408 + hash: 'FFBD9A00E05E085B89296D19D5CAEC57' + } + TestFrame { + time: 1424 + hash: '9C9D658B9C25602816B8066BF19105DB' + } + TestFrame { + time: 1440 + hash: '2B7FD058E6601E22A30BB7106B1C683B' + } + TestFrame { + time: 1456 + hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05' + } + TestFrame { + time: 1472 + hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB' + } + TestFrame { + time: 1488 + hash: '9BFD7AD5091CCBDDE43C593E133A7B10' + } + TestFrame { + time: 1504 + hash: '2703B617937914A90EA42EBF249D79EE' + } + TestFrame { + time: 1520 + hash: 'B77E2983138254016C4CCA53100F46FA' + } + TestFrame { + time: 1536 + hash: '60C4DD24187D1281081479E586F02B37' + } + TestFrame { + time: 1552 + hash: '62F2511ABD99EF1231C9FA4B91D4ABFE' + } + TestFrame { + time: 1568 + hash: 'E309B3353FD174E883D309571CADDC98' + } + TestFrame { + time: 1584 + hash: '1E2D6A134C7B12DDE551B148EF4F088C' + } + TestFrame { + time: 1600 + hash: 'E5DC5450604A491CC24A0DCF5C278B58' + } + TestFrame { + time: 1616 + hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E' + } + TestFrame { + time: 1632 + hash: '4E1B7E06F55FB084080689B474F1FE1D' + } + TestFrame { + time: 1648 + hash: 'B4639C907FA937BF15FAC62421170CD8' + } + TestFrame { + time: 1664 + hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B' + } + TestFrame { + time: 1680 + hash: 'A73351EABECF0D71149EFE31F197413E' + } + TestFrame { + time: 1696 + hash: '479425F1B7AFF79E4DFB7FCA534AF018' + } + TestFrame { + time: 1712 + hash: '046D0F0040A52D1F26BA9F7C5DE06EF4' + } + TestFrame { + time: 1728 + hash: '655778BF13C6080903150B0EB43A7EDC' + } + TestFrame { + time: 1744 + hash: '72DA0BBE81514870655FDD3354ADAC60' + } + TestFrame { + time: 1760 + hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7' + } + TestFrame { + time: 1776 + hash: 'C988628B6C3D3780E9A865C7694926CD' + } + TestFrame { + time: 1792 + hash: '5AB17563655231089EDD986FF13D6012' + } + TestFrame { + time: 1808 + hash: 'C1ADFF1D2E5800ED466D1691D3B17382' + } + TestFrame { + time: 1824 + hash: '70129BA01FBB19592B9DC0D0A3B3E7DF' + } + TestFrame { + time: 1840 + hash: '0000829EF7ED908BF430D42904D59CC2' + } + TestFrame { + time: 1856 + hash: '843D2927F50AB87B4A86B7A6AAEED91F' + } + TestFrame { + time: 1872 + hash: 'DA86D21756025E7DE8050586D5E2A1F8' + } + TestFrame { + time: 1888 + hash: '48DD1BD6580133B0793FEE327EA4F1E6' + } + TestFrame { + time: 1904 + hash: 'F0618193DCD0BA2837249515A1898B1C' + } + TestFrame { + time: 1920 + hash: 'A530184E57251065286C0CBBA7301E9C' + } + TestFrame { + time: 1936 + hash: '64A1D7203973D65DD342793007A61C58' + } + TestFrame { + time: 1952 + hash: '5B830DFC6BA442772DE87D75D5A578DE' + } + TestFrame { + time: 1968 + hash: '5563B056B0409B65F60DD16DD0DD890E' + } + TestFrame { + time: 1984 + hash: 'B8BCF9AD2CA8720C11563A23D8280804' + } + TestFrame { + time: 2000 + hash: '8C0FCDA4F8956394C53FC4BA18CAA850' + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/image0.png b/tests/auto/declarative/visual/colorAnimation/image0.png Binary files differdeleted file mode 100644 index 9e1caf7..0000000 --- a/tests/auto/declarative/visual/colorAnimation/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/colorAnimation/manifest.xml b/tests/auto/declarative/visual/colorAnimation/manifest.xml deleted file mode 100644 index 8e3de2e..0000000 --- a/tests/auto/declarative/visual/colorAnimation/manifest.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> - <TestMouse time="480" type="2" button="1" buttons="1" globalPos="93,129" pos="89,102"/> - <TestMouse time="570" type="3" button="1" buttons="0" globalPos="93,129" pos="89,102"/> - <TestFrame time="630" hash="D42762ECD293C6922C5F9593126DE636"/> - <TestFrame time="660" hash="8962505FCCB2E7559A99A8EDD325A82B"/> - <TestFrame time="690" hash="6812EFDA80607D4FA05CD3A5077F8EF7"/> - <TestFrame time="720" hash="A116DF73809679C1C5F9261F49B989F0"/> - <TestFrame time="750" hash="DC1B9D40AEE306171AD6625DDCA4EB45"/> - <TestFrame time="780" hash="B2DAF0E4C32080229664A8B0A155DE3B"/> - <TestFrame time="810" hash="496677B0D8707B91566D1244C46D50DB"/> - <TestFrame time="840" hash="A6558D8B0D1FB1D11BEBE36C078386CE"/> - <TestFrame time="870" hash="601436BB436D391B0BD5FCC289666208"/> - <TestFrame time="900" hash="8CF3CF9EAD875497870CC7C1035802DC"/> - <TestFrame time="930" hash="FF6BA6BAC30DADD3DBBFD96F127EB1FE"/> - <TestFrame time="960" hash="1D97A2A6890078DCF4CE9E508E5F9F08"/> - <TestFrame time="990" hash="58C9116FDDD03DD036820EFCD0DCD392"/> - <TestFrame time="1020" hash="E51287B911C140B41D350FCB2091AB80"/> - <TestFrame time="1050" hash="7B107411B436FABE469A069E6E5B0C3C"/> - <TestFrame time="1080" hash="9D1CB0E58F2BD00DDA0FB463F6BFF526"/> - <TestFrame time="1110" hash="35AB7788489B79E5A5C6F2BE11AFC9E1"/> - <TestFrame time="1140" hash="C82177AC4A7A497469292C5F0F8C4913"/> - <TestFrame time="1170" hash="18763D1B911FDC524DB9E7B2569FE984"/> - <TestFrame time="1200" hash="27F63572AAEF6D835272D5D65FCF608B"/> - <TestFrame time="1230" hash="585727CAEC1F83ADB9E422BAF058A622"/> - <TestFrame time="1260" hash="2C3BBFEFBE6E5FDA1905E9F50985E1B4"/> - <TestFrame time="1290" hash="81675C4ABB2696D960BC5F204F05F16B"/> - <TestFrame time="1320" hash="6D0F3CCC06EF1E3A895ECC9A8DE90039"/> - <TestFrame time="1350" hash="0BF36093CCAEA8BDAE96D4939A8DDE20"/> - <TestFrame time="1380" hash="5A1CBC68AB59977B65492B0F8A664418"/> - <TestFrame time="1410" hash="C35831A8C59D56193CED2C4AADB4DFCE"/> - <TestFrame time="1440" hash="ED15973425A8B8528896B344A61393AA"/> - <TestFrame time="1470" hash="EA8FC02A8606680C089F0C0CE454ABE3"/> - <TestFrame time="1500" hash="CFB5CFBA0A0BC62C0D03908FB9599A8E"/> - <TestFrame time="1530" hash="09FAA04AFB50B48BD6A83F9E25F9DDDB"/> - <TestFrame time="1560" hash="0FDD0B8CDCCEB78C7C67AB0F5EA74D6A"/> - <TestFrame time="1590" hash="058D26146879900B5E5CCE05AE38BA0E"/> - <TestFrame time="1620" hash="80F9074C50F967C99D4C3A3FF9EC3E71"/> - <TestFrame time="1650" hash="AD9BDCEEC1C058D6B658C5BA0D0BC1F0"/> - <TestFrame time="1680" hash="AC14DF5458F91001181154F8C68BCE2B"/> - <TestFrame time="1710" hash="AE9225263E4C8E75E4D0F1D7192B4260"/> - <TestFrame time="1740" hash="D3D50F1B7F476E79E5B99E0E6D4CF827"/> - <TestFrame time="1770" hash="A1367445C5232ACCBF4904A415416EA4"/> - <TestFrame time="1800" hash="A21C0F1DA9B64A5B000558BA1F2E495D"/> - <TestFrame time="1830" hash="61AF477B6FB22E38E698375EA5793D22"/> - <TestFrame time="1860" hash="B3AD3501D527939CEAA4F124AB10B2DF"/> - <TestFrame time="1890" hash="0C2BF65A43AE87AFB0068F9FA4A74707"/> - <TestFrame time="1920" hash="5B7F96C797BEE4FD1B04538DE5549C1B"/> - <TestFrame time="1950" hash="4C861E936A3F1AFE323395E30174F8CC"/> - <TestFrame time="1980" hash="87F1966E5B0E924EB7CEED5520D120BF"/> - <TestFrame time="2010" hash="1980755E0D80469D4DC0B9B0309F2DEB"/> - <TestFrame time="2040" hash="38A7ACC2E5607FC0965B7B376A0D3524"/> - <TestFrame time="2070" hash="4434746833EFF5A3A76491024763990A"/> - <TestFrame time="2100" hash="A8BAD928F92E851B45723068B7FEF739"/> - <TestFrame time="2130" hash="A96F5C522C0ECA5C78E982E4235218CB"/> - <TestFrame time="2160" hash="135F0EFEDE2832B76F49966EBD629879"/> - <TestFrame time="2190" hash="A51C6E443413F184CAAE8A7F98A369C8"/> - <TestFrame time="2220" hash="62A7521EE62E6A2543B3141C1EFCE72A"/> - <TestFrame time="2250" hash="D416A41125659167B3E6AD68F66F6E64"/> - <TestFrame time="2280" hash="0F653B5E965665A43F50437724DC704C"/> - <TestFrame time="2310" hash="13A6E2485179501FF3AA8BA91A5050B4"/> - <TestFrame time="2340" hash="9423475D3832FBABEC56B80FA9161020"/> - <TestFrame time="2370" hash="497B21108A6CB127DB066B32D06D992A"/> - <TestFrame time="2400" hash="22F01CB9B4F8FF01410566A61E281373"/> - <TestFrame time="2430" hash="A099640BC088E14E20585CB87FC5C6F1"/> - <TestFrame time="2460" hash="AC2954553C333EA1D524CE51CD35958A"/> - <TestFrame time="2490" hash="771E882CC788BECAA82E71E6FBAB150D"/> - <TestFrame time="2520" hash="42CEDA45D88A8D2B3DA5B749F4C3C1BF"/> - <TestFrame time="2550" hash="C6E1F91B917E47246E012D1B203E0DC2"/> - <TestFrame time="2580" hash="EFB3E57CF265B6E36AA4DF72771D119C"/> - <TestFrame time="2610" hash="657FC7FD496E5A2FC84F63930E0D1DE3"/> -</TestLog> diff --git a/tests/auto/declarative/visual/easing/easing.qml b/tests/auto/declarative/visual/easing/easing.qml new file mode 100644 index 0000000..4a0ed14 --- /dev/null +++ b/tests/auto/declarative/visual/easing/easing.qml @@ -0,0 +1,186 @@ +Rect { + id: item + width: 600 + height: layout.height + color: "white" + resources: [ + ListModel { + id: easingtypes + ListElement { + type: "easeNone" + } + ListElement { + type: "easeInQuad" + } + ListElement { + type: "easeOutQuad" + } + ListElement { + type: "easeInOutQuad" + } + ListElement { + type: "easeOutInQuad" + } + ListElement { + type: "easeInCubic" + } + ListElement { + type: "easeOutCubic" + } + ListElement { + type: "easeInOutCubic" + } + ListElement { + type: "easeOutInCubic" + } + ListElement { + type: "easeInQuart" + } + ListElement { + type: "easeOutQuart" + } + ListElement { + type: "easeInOutQuart" + } + ListElement { + type: "easeOutInQuart" + } + ListElement { + type: "easeInQuint" + } + ListElement { + type: "easeOutQuint" + } + ListElement { + type: "easeInOutQuint" + } + ListElement { + type: "easeOutInQuint" + } + ListElement { + type: "easeInSine" + } + ListElement { + type: "easeOutSine" + } + ListElement { + type: "easeInOutSine" + } + ListElement { + type: "easeOutInSine" + } + ListElement { + type: "easeInExpo" + } + ListElement { + type: "easeOutExpo" + } + ListElement { + type: "easeInOutExpo" + } + ListElement { + type: "easeOutInExpo" + } + ListElement { + type: "easeInCirc" + } + ListElement { + type: "easeOutCirc" + } + ListElement { + type: "easeInOutCirc" + } + ListElement { + type: "easeOutInCirc" + } + ListElement { + type: "easeInElastic" + } + ListElement { + type: "easeOutElastic" + } + ListElement { + type: "easeInOutElastic" + } + ListElement { + type: "easeOutInElastic" + } + ListElement { + type: "easeInBack" + } + ListElement { + type: "easeOutBack" + } + ListElement { + type: "easeInOutBack" + } + ListElement { + type: "easeOutInBack" + } + ListElement { + type: "easeOutBounce" + } + ListElement { + type: "easeInBounce" + } + ListElement { + type: "easeInOutBounce" + } + ListElement { + type: "easeOutInBounce" + } + } + ] + VerticalLayout { + id: layout + anchors.left: item.left + anchors.right: item.right + Repeater { + dataSource: easingtypes + Component { + Text { + id: text + text: type + height: 18 + font.italic: true + color: "black" + states: [ + State { + name: "from" + when: !mouse.pressed + SetProperty { + target: text + property: "x" + value: 0 + } + }, + State { + name: "to" + when: mouse.pressed + SetProperty { + target: text + property: "x" + value: item.width-100 + } + } + ] + transitions: [ + Transition { + fromState: "*" + toState: "to" + reversible: true + NumericAnimation { + properties: "x" + easing: type + } + } + ] + } + } + } + } + MouseRegion { + id: mouse + anchors.fill: layout + } +} diff --git a/tests/auto/declarative/visual/easing/easing.xml b/tests/auto/declarative/visual/easing/easing.xml deleted file mode 100644 index 01a7d6c..0000000 --- a/tests/auto/declarative/visual/easing/easing.xml +++ /dev/null @@ -1,70 +0,0 @@ -<Rect id="item" width="600" height="{layout.height}" color="white"> - <resources> - <ListModel id="easingtypes"> - <ListItem><type>easeNone</type></ListItem> - <ListItem><type>easeInQuad</type></ListItem> - <ListItem><type>easeOutQuad</type></ListItem> - <ListItem><type>easeInOutQuad</type></ListItem> - <ListItem><type>easeOutInQuad</type></ListItem> - <ListItem><type>easeInCubic</type></ListItem> - <ListItem><type>easeOutCubic</type></ListItem> - <ListItem><type>easeInOutCubic</type></ListItem> - <ListItem><type>easeOutInCubic</type></ListItem> - <ListItem><type>easeInQuart</type></ListItem> - <ListItem><type>easeOutQuart</type></ListItem> - <ListItem><type>easeInOutQuart</type></ListItem> - <ListItem><type>easeOutInQuart</type></ListItem> - <ListItem><type>easeInQuint</type></ListItem> - <ListItem><type>easeOutQuint</type></ListItem> - <ListItem><type>easeInOutQuint</type></ListItem> - <ListItem><type>easeOutInQuint</type></ListItem> - <ListItem><type>easeInSine</type></ListItem> - <ListItem><type>easeOutSine</type></ListItem> - <ListItem><type>easeInOutSine</type></ListItem> - <ListItem><type>easeOutInSine</type></ListItem> - <ListItem><type>easeInExpo</type></ListItem> - <ListItem><type>easeOutExpo</type></ListItem> - <ListItem><type>easeInOutExpo</type></ListItem> - <ListItem><type>easeOutInExpo</type></ListItem> - <ListItem><type>easeInCirc</type></ListItem> - <ListItem><type>easeOutCirc</type></ListItem> - <ListItem><type>easeInOutCirc</type></ListItem> - <ListItem><type>easeOutInCirc</type></ListItem> - <ListItem><type>easeInElastic</type></ListItem> - <ListItem><type>easeOutElastic</type></ListItem> - <ListItem><type>easeInOutElastic</type></ListItem> - <ListItem><type>easeOutInElastic</type></ListItem> - <ListItem><type>easeInBack</type></ListItem> - <ListItem><type>easeOutBack</type></ListItem> - <ListItem><type>easeInOutBack</type></ListItem> - <ListItem><type>easeOutInBack</type></ListItem> - <ListItem><type>easeOutBounce</type></ListItem> - <ListItem><type>easeInBounce</type></ListItem> - <ListItem><type>easeInOutBounce</type></ListItem> - <ListItem><type>easeOutInBounce</type></ListItem> - </ListModel> - </resources> - - <VerticalLayout id="layout" anchors.left="{item.left}" anchors.right="{item.right}"> - <Repeater dataSource="{easingtypes}" > - <Component> - <Text id="text" text="{type}" height="18" font.italic="true" color="black"> - <states> - <State name="from" when="{!mouse.pressed}"> - <SetProperty target="{text}" property="x" value="0"/> - </State> - <State name="to" when="{mouse.pressed}"> - <SetProperty target="{text}" property="x" value="{item.width-100}"/> - </State> - </states> - <transitions> - <Transition fromState="*" toState="to" reversible="true"> - <NumericAnimation properties="x" easing="{type}" /> - </Transition> - </transitions> - </Text> - </Component> - </Repeater> - </VerticalLayout> - <MouseRegion id="mouse" anchors.fill="{layout}"/> -</Rect> diff --git a/tests/auto/declarative/visual/flickable/Day.qml b/tests/auto/declarative/visual/flickable/Day.qml index 0765e2f..63fbc78 100644 --- a/tests/auto/declarative/visual/flickable/Day.qml +++ b/tests/auto/declarative/visual/flickable/Day.qml @@ -1,8 +1,26 @@ -<Rect width="400" height="500" radius="7" pen.color="black" id="Page"> - <properties> - <Property name="day" type="string" /> - </properties> +Rect { + property string day - <Image x="10" y="10" file="cork.jpg" opaque="true"/> - <Text x="20" y="20" height="40" font.size="14" font.bold="true" width="370" text="{day}" style="Outline" styleColor="#dedede"/> -</Rect> + width: 400 + height: 500 + radius: 7 + pen.color: "black" + id: Page + Image { + x: 10 + y: 10 + source: "cork.jpg" + opaque: true + } + Text { + x: 20 + y: 20 + height: 40 + font.size: 14 + font.bold: true + width: 370 + text: day + style: "Outline" + styleColor: "#dedede" + } +} diff --git a/tests/auto/declarative/visual/flickable/flickable.qml b/tests/auto/declarative/visual/flickable/flickable.qml new file mode 100644 index 0000000..5946c40 --- /dev/null +++ b/tests/auto/declarative/visual/flickable/flickable.qml @@ -0,0 +1,53 @@ +Rect { + color: "lightSteelBlue" + width: 800 + height: 500 + ListModel { + id: List + ListElement { + name: "Sunday" + dayColor: "#808080" + } + ListElement { + name: "Monday" + dayColor: "blue" + } + ListElement { + name: "Tuesday" + dayColor: "yellow" + } + ListElement { + name: "Wednesday" + dayColor: "purple" + } + ListElement { + name: "Thursday" + dayColor: "blue" + } + ListElement { + name: "Friday" + dayColor: "green" + } + ListElement { + name: "Saturday" + dayColor: "orange" + } + } + Flickable { + id: Flick + anchors.fill: parent + viewportWidth: Lay.width + HorizontalLayout { + id: Lay + Repeater { + dataSource: List + Component { + Day { + day: name + color: dayColor + } + } + } + } + } +} diff --git a/tests/auto/declarative/visual/flickable/flickable.xml b/tests/auto/declarative/visual/flickable/flickable.xml deleted file mode 100644 index 78bf42f..0000000 --- a/tests/auto/declarative/visual/flickable/flickable.xml +++ /dev/null @@ -1,43 +0,0 @@ -<Rect color="lightSteelBlue" width="800" height="500"> - <ListModel id="List"> - <Day> - <name>Sunday</name> - <dayColor>#808080</dayColor> - </Day> - <Day> - <name>Monday</name> - <dayColor>blue</dayColor> - </Day> - <Day> - <name>Tuesday</name> - <dayColor>yellow</dayColor> - </Day> - <Day> - <name>Wednesday</name> - <dayColor>purple</dayColor> - </Day> - <Day> - <name>Thursday</name> - <dayColor>blue</dayColor> - </Day> - <Day> - <name>Friday</name> - <dayColor>green</dayColor> - </Day> - <Day> - <name>Saturday</name> - <dayColor>orange</dayColor> - </Day> - </ListModel> - - <Flickable id="Flick" anchors.fill="{parent}" viewportWidth="{Lay.width}"> - <HorizontalLayout id="Lay"> - <Repeater dataSource="{List}"> - <Component> - <Day day="{name}" color="{dayColor}" /> - </Component> - </Repeater> - </HorizontalLayout> - </Flickable> - -</Rect> diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml new file mode 100644 index 0000000..5c00f58 --- /dev/null +++ b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml @@ -0,0 +1,28 @@ +Rect { + id: rect + width: 120 + height: 200 + color: "white" + Image { + id: img + source: "pics/qtlogo.png" + x: 60-width/2 + y: 200-height + y: SequentialAnimation { + running: true + repeat: true + NumericAnimation { + to: 0; duration: 500 + easing: "easeInOutQuad" + } + NumericAnimation { + to: 200-img.height + easing: "easeOutBounce" + duration: 2000 + } + PauseAnimation { + duration: 1000 + } + } + } +} diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml deleted file mode 100644 index bb411e2..0000000 --- a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml +++ /dev/null @@ -1,13 +0,0 @@ -<Rect id="rect" width="120" height="200" color="white"> - <Image id="img" file="pics/qtlogo.png" - x="{60-img.width/2}" y="{200-img.height}"> - <y> - <SerialAnimation running="true" repeat="true"> - <NumericAnimation to="{200-img.height}" - easing="easeOutBounce(amplitude:100)" - duration="2000" /> - <PauseAnimation duration="1000" /> - </SerialAnimation> - </y> - </Image> -</Rect> diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png b/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png Binary files differdeleted file mode 100644 index 7d45407..0000000 --- a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml b/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..05dc9ab --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/qfxtext/elide/elide.qml b/tests/auto/declarative/visual/qfxtext/elide/elide.qml new file mode 100644 index 0000000..23e6885 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/elide.qml @@ -0,0 +1,33 @@ +Rect { + width: contents.width + height: contents.height + VerticalLayout { + width: 80 + height: Text.height*4 + Text { + elide: "ElideLeft" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + id: Text + } + Text { + elide: "ElideMiddle" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + Text { + elide: "ElideRight" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + Text { + elide: "ElideNone" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + } +} diff --git a/tests/auto/declarative/visual/qfxtext/elide/elide.xml b/tests/auto/declarative/visual/qfxtext/elide/elide.xml deleted file mode 100644 index 398da82..0000000 --- a/tests/auto/declarative/visual/qfxtext/elide/elide.xml +++ /dev/null @@ -1,6 +0,0 @@ -<VerticalLayout width="80" height="{Text.height*4}"> - <Text elide="ElideLeft" text="aaa bbb ccc ddd eee fff" width="80" color="white" id="Text"/> - <Text elide="ElideMiddle" text="aaa bbb ccc ddd eee fff" width="80" color="white"/> - <Text elide="ElideRight" text="aaa bbb ccc ddd eee fff" width="80" color="white"/> - <Text elide="ElideNone" text="aaa bbb ccc ddd eee fff" width="80" color="white"/> -</VerticalLayout> diff --git a/tests/auto/declarative/visual/qfxtext/elide/test b/tests/auto/declarative/visual/qfxtext/elide/test index d35cbc9..bde7c7c 100644 --- a/tests/auto/declarative/visual/qfxtext/elide/test +++ b/tests/auto/declarative/visual/qfxtext/elide/test @@ -1 +1 @@ -elide.xml +elide.qml diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.qml b/tests/auto/declarative/visual/repeater/basic1/basic1.qml new file mode 100644 index 0000000..ba8f44d --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic1/basic1.qml @@ -0,0 +1,26 @@ +Rect { + color: "blue" + width: 300 + height: 200 + id: Page + HorizontalLayout { + Repeater { + component: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + dataSource: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.xml b/tests/auto/declarative/visual/repeater/basic1/basic1.xml deleted file mode 100644 index def809f..0000000 --- a/tests/auto/declarative/visual/repeater/basic1/basic1.xml +++ /dev/null @@ -1,21 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <HorizontalLayout> - <Repeater > - <component> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </component> - <dataSource> - <ListModel> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - </dataSource> - </Repeater> - </HorizontalLayout> -</Rect> diff --git a/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png Binary files differdeleted file mode 100644 index f0be97f..0000000 --- a/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..868eaa3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic1/test b/tests/auto/declarative/visual/repeater/basic1/test index 62f0665..49fcf5a 100644 --- a/tests/auto/declarative/visual/repeater/basic1/test +++ b/tests/auto/declarative/visual/repeater/basic1/test @@ -1 +1 @@ -basic1.xml +basic1.qml diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.qml b/tests/auto/declarative/visual/repeater/basic2/basic2.qml new file mode 100644 index 0000000..d975ea4 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic2/basic2.qml @@ -0,0 +1,30 @@ +Rect { + color: "blue" + width: 300 + height: 200 + id: Page + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + HorizontalLayout { + Repeater { + component: Delegate + dataSource: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.xml b/tests/auto/declarative/visual/repeater/basic2/basic2.xml deleted file mode 100644 index b16fbfe..0000000 --- a/tests/auto/declarative/visual/repeater/basic2/basic2.xml +++ /dev/null @@ -1,22 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <Component id="Delegate"> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </Component> - - <HorizontalLayout> - <Repeater component="{Delegate}"> - <dataSource> - <ListModel> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - </dataSource> - </Repeater> - </HorizontalLayout> -</Rect> diff --git a/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png Binary files differdeleted file mode 100644 index f0be97f..0000000 --- a/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..868eaa3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic2/test b/tests/auto/declarative/visual/repeater/basic2/test index ae974fe..eb79495 100644 --- a/tests/auto/declarative/visual/repeater/basic2/test +++ b/tests/auto/declarative/visual/repeater/basic2/test @@ -1 +1 @@ -basic2.xml +basic2.qml diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.qml b/tests/auto/declarative/visual/repeater/basic3/basic3.qml new file mode 100644 index 0000000..cecba33 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic3/basic3.qml @@ -0,0 +1,28 @@ +Rect { + color: "blue" + width: 300 + height: 200 + id: Page + ListModel { + id: DataSource + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + HorizontalLayout { + Repeater { + dataSource: DataSource + component: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.xml b/tests/auto/declarative/visual/repeater/basic3/basic3.xml deleted file mode 100644 index 1135f16..0000000 --- a/tests/auto/declarative/visual/repeater/basic3/basic3.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <ListModel id="DataSource"> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - <HorizontalLayout> - <Repeater dataSource="{DataSource}"> - <component> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </component> - </Repeater> - </HorizontalLayout> -</Rect> diff --git a/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png Binary files differdeleted file mode 100644 index f0be97f..0000000 --- a/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..868eaa3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml new file mode 100644 index 0000000..47d36c3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml @@ -0,0 +1,13 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestKey { + time: 1296 + type: 6 + modifiers: 0 + key: 16777251 + text: '' + } +} diff --git a/tests/auto/declarative/visual/repeater/basic3/test b/tests/auto/declarative/visual/repeater/basic3/test index ea3154e..9ec306b 100644 --- a/tests/auto/declarative/visual/repeater/basic3/test +++ b/tests/auto/declarative/visual/repeater/basic3/test @@ -1 +1 @@ -basic3.xml +basic3.qml diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.qml b/tests/auto/declarative/visual/repeater/basic4/basic4.qml new file mode 100644 index 0000000..050a2c5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic4/basic4.qml @@ -0,0 +1,32 @@ +Rect { + color: "blue" + width: 300 + height: 200 + id: Page + ListModel { + id: DataSource + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + HorizontalLayout { + Repeater { + dataSource: DataSource + component: Delegate + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.xml b/tests/auto/declarative/visual/repeater/basic4/basic4.xml deleted file mode 100644 index 53b8ff9..0000000 --- a/tests/auto/declarative/visual/repeater/basic4/basic4.xml +++ /dev/null @@ -1,18 +0,0 @@ -<Rect color="blue" width="800" height="600" id="Page"> - <ListModel id="DataSource"> - <Month> - <name>January</name> - </Month> - <Month> - <name>February</name> - </Month> - </ListModel> - <Component id="Delegate"> - <Rect color="red" width="100" height="100"> - <Text text="{name}" /> - </Rect> - </Component> - <HorizontalLayout> - <Repeater dataSource="{DataSource}" component="{Delegate}" /> - </HorizontalLayout> -</Rect> diff --git a/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png Binary files differdeleted file mode 100644 index f0be97f..0000000 --- a/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png +++ /dev/null diff --git a/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLog> - <TestFullFrame time="30" frameId="0"/> -</TestLog> diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png Binary files differnew file mode 100644 index 0000000..868eaa3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic4/test b/tests/auto/declarative/visual/repeater/basic4/test index 891e0be..2a7f227 100644 --- a/tests/auto/declarative/visual/repeater/basic4/test +++ b/tests/auto/declarative/visual/repeater/basic4/test @@ -1 +1 @@ -basic4.xml +basic4.qml diff --git a/tests/auto/declarative/visual/runtests.sh b/tests/auto/declarative/visual/runtests.sh index f690381..4380884 100755 --- a/tests/auto/declarative/visual/runtests.sh +++ b/tests/auto/declarative/visual/runtests.sh @@ -1,2 +1,3 @@ #!/bin/sh +export QFX_USE_SIMPLECANVAS=1 for a in `cat tests`; do ./tst_visual -testdir $a; done diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index f077994..f540e62 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -25,7 +25,9 @@ void tst_visual::visual() { QVERIFY(!testdir.isEmpty()); - QFile configFile(QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test"); + QString filename = QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test"; + qWarning() << "Using config:" << filename; + QFile configFile(filename); QVERIFY(configFile.open(QIODevice::ReadOnly)); QString testfile = configFile.readLine().trimmed(); diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qml.cpp index 6eec72e..78a9afd 100644 --- a/tools/linguist/lupdate/qml.cpp +++ b/tools/linguist/lupdate/qml.cpp @@ -88,7 +88,8 @@ protected: virtual void endVisit(AST::CallExpression *node) { if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(node->base)) { - if (idExpr->name->asString() == QLatin1String("qsTr")) { + if (idExpr->name->asString() == QLatin1String("qsTr") || + idExpr->name->asString() == QLatin1String("QT_TR_NOOP")) { if (node->arguments && AST::cast<AST::StringLiteral *>(node->arguments->expression)) { AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression); const QString source = literal->value->asString(); @@ -102,8 +103,8 @@ protected: AST::ArgumentList *nNode = commentNode->next; if (nNode) { - AST::NumericLiteral *literal3 = AST::cast<AST::NumericLiteral *>(nNode->expression); - if (literal3) { + AST::NumericLiteral *numLiteral = AST::cast<AST::NumericLiteral *>(nNode->expression); + if (numLiteral) { plural = true; } } @@ -115,8 +116,42 @@ protected: TranslatorMessage::Unfinished, plural); m_translator->extend(msg); } + } else if (idExpr->name->asString() == QLatin1String("qsTranslate") || + idExpr->name->asString() == QLatin1String("QT_TRANSLATE_NOOP")) { + if (node->arguments && AST::cast<AST::StringLiteral *>(node->arguments->expression)) { + AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression); + const QString context = literal->value->asString(); + + QString source; + QString comment; + bool plural = false; + AST::ArgumentList *sourceNode = node->arguments->next; + if (sourceNode) { + literal = AST::cast<AST::StringLiteral *>(sourceNode->expression); + source = literal->value->asString(); + AST::ArgumentList *commentNode = sourceNode->next; + if (commentNode) { + literal = AST::cast<AST::StringLiteral *>(commentNode->expression); + comment = literal->value->asString(); + + AST::ArgumentList *nNode = commentNode->next; + if (nNode) { + AST::NumericLiteral *numLiteral = AST::cast<AST::NumericLiteral *>(nNode->expression); + if (numLiteral) { + plural = true; + } + } + } + } + + TranslatorMessage msg(context, source, + comment, QString(), m_fileName, + node->firstSourceLocation().startLine, QStringList(), + TranslatorMessage::Unfinished, plural); + m_translator->extend(msg); + } + } - //### support qsTranslate, QT_TR_NOOP, and QT_TRANSLATE_NOOP } } diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index f59918f..38a00bb 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -41,6 +41,7 @@ void usage() qWarning(" -recordtest <directory> .................. record an autotest"); qWarning(" -runtest <directory> ..................... run a previously recorded test"); qWarning(" -translation <translationfile> ........... set the language to run in"); + qWarning(" -L <directory> ........................... prepend to the library search path"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); @@ -81,6 +82,7 @@ int main(int argc, char ** argv) QString dither = "none"; QString recordfile; QStringList recordargs; + QStringList libraries; QString skin; bool devkeys = false; bool cache = false; @@ -132,6 +134,8 @@ int main(int argc, char ** argv) usage(); translationFile = newargv[i + 1]; ++i; + } else if (arg == "-L") { + libraries << QString(argv[++i]); } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -146,6 +150,8 @@ int main(int argc, char ** argv) } QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + foreach (QString lib, libraries) + viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); viewer.setRecordFile(recordfile); if (period>0) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 97db22e..2ef5616 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -124,7 +124,7 @@ void PreviewDeviceSkin::slotPopupMenu() QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags), frame_stream(0), scaleSkin(true) + : QWidget(parent, flags), frame_stream(0), scaleSkin(true), mb(0) { testEngine = 0; devicemode = false; @@ -133,12 +133,12 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q record_autotime = 0; record_period = 20; - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); if (!(flags & Qt::FramelessWindowHint)) createMenu(menuBar(),0); canvas = new QFxView(this); + canvas->setAttribute(Qt::WA_OpaquePaintEvent); + canvas->setAttribute(Qt::WA_NoSystemBackground); canvas->setContentResizable(!skin || !scaleSkin); if(testMode != QFxTestEngine::NoTest) @@ -146,17 +146,31 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); - setCentralWidget(canvas); + QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + setLayout(layout); + if (mb) + layout->addWidget(mb); + layout->addWidget(canvas); +} + +QMenuBar *QmlViewer::menuBar() const +{ + if (!mb) + mb = new QMenuBar((QWidget*)this); + + return mb; } QSize QmlViewer::sizeHint() const { if (skin) - return QMainWindow::sizeHint(); + return QWidget::sizeHint(); else { // Kludge to force QMainWindow to be EXACTLY the right size for the canvas. QSize sh = canvas->sizeHint(); - sh.setHeight(sh.height()+menuBar()->sizeHint().height()+1); + sh.setHeight(sh.height()+menuBar()->sizeHint().height()); return sh; } } @@ -252,6 +266,10 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu->addSeparator(); fileMenu->addAction(quitAction); + if (menu) { + menu->setFixedHeight(menu->sizeHint().height()); + menu->setMinimumWidth(10); + } } void QmlViewer::setScaleSkin() @@ -314,6 +332,10 @@ void QmlViewer::toggleRecording() setRecording(recording); } +void QmlViewer::addLibraryPath(const QString& lib) +{ + canvas->engine()->addNameSpacePath("",lib); +} void QmlViewer::reload() { @@ -415,7 +437,9 @@ void QmlViewer::setSkin(const QString& skinDirectory) DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { layout()->setEnabled(false); - setMenuBar(0); + //setMenuBar(0); + if (mb) + mb->hide(); if (!err.isEmpty()) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); @@ -432,6 +456,7 @@ void QmlViewer::setSkin(const QString& skinDirectory) menuBar()->clear(); canvas->setParent(this, Qt::SubWindow); createMenu(menuBar(),0); + mb->show(); setMinimumSize(QSize(0,0)); setMaximumSize(QSize(16777215,16777215)); canvas->setMinimumSize(QSize(0,0)); @@ -439,7 +464,7 @@ void QmlViewer::setSkin(const QString& skinDirectory) QRect g = geometry(); g.setSize(sizeHint()); setParent(0,windowFlags()); // recreate - canvas->move(0,menuBar()->sizeHint().height()+1); + canvas->move(0,menuBar()->sizeHint().height()); setGeometry(g); layout()->setEnabled(true); show(); diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 09b2b5b..04d94cc 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -14,7 +14,7 @@ #ifndef QMLVIEWER_H #define QMLVIEWER_H -#include <QMainWindow> +#include <QMenuBar> #include <QBasicTimer> #include <QTime> #include <qfxtestengine.h> @@ -26,7 +26,7 @@ class PreviewDeviceSkin; class QFxTestEngine; class QProcess; -class QmlViewer : public QMainWindow +class QmlViewer : public QWidget { Q_OBJECT public: @@ -42,8 +42,10 @@ public: void setAutoRecord(int from, int to); void setDeviceKeys(bool); void setCacheEnabled(bool); + void addLibraryPath(const QString& lib); QSize sizeHint() const; + QMenuBar *menuBar() const; public slots: void sceneResized(QSize size); @@ -86,6 +88,7 @@ private: QAction *recordAction; QString currentSkin; bool scaleSkin; + mutable QMenuBar *mb; QFxTestEngine *testEngine; }; |