From a08546507fe0ce356e4183e557d9408295c80610 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 21 Feb 2012 13:31:19 +1000 Subject: [PATCH 01/82] Reduce QQuickTextEdit memory usage. Remove unnecessary members from QQuickTextEditPrivate and QQuickTextControlPrivate and re-order and pack to reduce padding for alignment. Change-Id: I14f5e3fc01646d02745f095c2a4b168cd675745d Reviewed-by: Yann Bodson --- src/quick/items/qquicktextcontrol.cpp | 94 ++----------------- src/quick/items/qquicktextcontrol_p.h | 12 --- src/quick/items/qquicktextcontrol_p_p.h | 55 +++++------ src/quick/items/qquicktextedit.cpp | 43 +++------ src/quick/items/qquicktextedit_p_p.h | 79 ++++++++-------- .../qquicktextedit/tst_qquicktextedit.cpp | 3 - 6 files changed, 84 insertions(+), 202 deletions(-) diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index a763626410..9a61312910 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -97,13 +97,17 @@ static QTextLine currentTextLine(const QTextCursor &cursor) } QQuickTextControlPrivate::QQuickTextControlPrivate() - : doc(0), cursorOn(false), cursorIsFocusIndicator(false), + : doc(0), + preeditCursor(0), interactionFlags(Qt::TextEditorInteraction), + cursorOn(false), + cursorIsFocusIndicator(false), mousePressed(false), - lastSelectionState(false), ignoreAutomaticScrollbarAdjustement(false), + lastSelectionState(false), + ignoreAutomaticScrollbarAdjustement(false), overwriteMode(false), acceptRichText(true), - preeditCursor(0), hideCursor(false), + hideCursor(false), hasFocus(false), isEnabled(true), hadSelectionOnMousePress(false), @@ -298,7 +302,6 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString & doc = document; clearDocument = false; } else { - palette = QGuiApplication::palette(); doc = new QTextDocument(q); } _q_documentLayoutChanged(); @@ -631,18 +634,6 @@ QQuickTextControl::~QQuickTextControl() { } -void QQuickTextControl::setView(QObject *view) -{ - Q_D(QQuickTextControl); - d->contextObject = view; -} - -QObject *QQuickTextControl::view() const -{ - Q_D(const QQuickTextControl); - return d->contextObject; -} - QTextDocument *QQuickTextControl::document() const { Q_D(const QQuickTextControl); @@ -1418,7 +1409,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons Q_UNUSED(e); - if (contextObject && isPreediting()) { + if (isPreediting()) { QTextLayout *layout = cursor.block().layout(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); @@ -1908,81 +1899,12 @@ QString QQuickTextControl::toHtml() const } #endif -QPalette QQuickTextControl::palette() const -{ - Q_D(const QQuickTextControl); - return d->palette; -} - -void QQuickTextControl::setPalette(const QPalette &pal) -{ - Q_D(QQuickTextControl); - d->palette = pal; -} - bool QQuickTextControl::cursorOn() const { Q_D(const QQuickTextControl); return d->cursorOn; } -QAbstractTextDocumentLayout::PaintContext QQuickTextControl::getPaintContext() const -{ - Q_D(const QQuickTextControl); - - QAbstractTextDocumentLayout::PaintContext ctx; - - ctx.palette = d->palette; - if (d->cursorOn && d->isEnabled) { - if (d->hideCursor) - ctx.cursorPosition = -1; - else if (d->preeditCursor != 0) - ctx.cursorPosition = - (d->preeditCursor + 2); - else - ctx.cursorPosition = d->cursor.position(); - } - - if (d->cursor.hasSelection()) { - QAbstractTextDocumentLayout::Selection selection; - selection.cursor = d->cursor; - if (0 && d->cursorIsFocusIndicator) { -#if 0 - // ### - QStyleOption opt; - opt.palette = ctx.palette; - QStyleHintReturnVariant ret; - QStyle *style = QGuiApplication::style(); - if (widget) - style = widget->style(); - style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret); - selection.format = qvariant_cast(ret.variant).toCharFormat(); -#endif - } else { - QPalette::ColorGroup cg = d->hasFocus ? QPalette::Active : QPalette::Inactive; - selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight)); - selection.format.setForeground(ctx.palette.brush(cg, QPalette::HighlightedText)); - if (fullWidthSelection) - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - } - ctx.selections.append(selection); - } - - return ctx; -} - -void QQuickTextControl::drawContents(QPainter *p, const QRectF &rect) -{ - Q_D(QQuickTextControl); - p->save(); - QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(); - if (rect.isValid()) - p->setClipRect(rect, Qt::IntersectClip); - ctx.clip = rect; - - d->doc->documentLayout()->draw(p, ctx); - p->restore(); -} - int QQuickTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const { Q_D(const QQuickTextControl); diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h index e7beefdaa3..97ecdc4c6e 100644 --- a/src/quick/items/qquicktextcontrol_p.h +++ b/src/quick/items/qquicktextcontrol_p.h @@ -90,9 +90,6 @@ class Q_AUTOTEST_EXPORT QQuickTextControl : public QObject explicit QQuickTextControl(QTextDocument *doc, QObject *parent = 0); virtual ~QQuickTextControl(); - void setView(QObject *view); - QObject *view() const; - QTextDocument *document() const; void setTextCursor(const QTextCursor &cursor); @@ -127,9 +124,6 @@ class Q_AUTOTEST_EXPORT QQuickTextControl : public QObject qreal textWidth() const; QSizeF size() const; - void setIgnoreUnusedNavigationEvents(bool ignore); - bool ignoreUnusedNavigationEvents() const; - void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); bool canPaste() const; @@ -178,16 +172,10 @@ public Q_SLOTS: void linkHovered(const QString &); public: - // control properties - QPalette palette() const; - void setPalette(const QPalette &pal); - virtual void processEvent(QEvent *e, const QMatrix &matrix); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF()); // control methods - void drawContents(QPainter *painter, const QRectF &rect = QRectF()); - void setFocus(bool focus, Qt::FocusReason = Qt::OtherFocusReason); virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h index daf2f8ca82..44bc00221b 100644 --- a/src/quick/items/qquicktextcontrol_p_p.h +++ b/src/quick/items/qquicktextcontrol_p_p.h @@ -132,49 +132,40 @@ class QQuickTextControlPrivate : public QObjectPrivate bool isPreediting() const; void commitPreedit(); - QTextDocument *doc; - bool cursorOn; - QTextCursor cursor; - bool cursorIsFocusIndicator; - QTextCharFormat lastCharFormat; - - Qt::TextInteractionFlags interactionFlags; - - QBasicTimer cursorBlinkTimer; - QBasicTimer trippleClickTimer; QPointF trippleClickPoint; + QPointF mousePressPos; - bool mousePressed; - - QPoint mousePressPos; - - QPointer contextObject; - - bool lastSelectionState; - - bool ignoreAutomaticScrollbarAdjustement; + QTextCharFormat lastCharFormat; + QTextDocument *doc; + QTextCursor cursor; QTextCursor selectedWordOnDoubleClick; QTextCursor selectedBlockOnTrippleClick; + QString tentativeCommit; + QString highlightedAnchor; // Anchor below cursor + QString anchorOnMousePress; + QString linkToCopy; - bool overwriteMode; - bool acceptRichText; + QBasicTimer cursorBlinkTimer; + QBasicTimer trippleClickTimer; int preeditCursor; - bool hideCursor; // used to hide the cursor in the preedit area - QString tentativeCommit; - - QPalette palette; - bool hasFocus; - bool isEnabled; - QString highlightedAnchor; // Anchor below cursor - QString anchorOnMousePress; - bool hadSelectionOnMousePress; + Qt::TextInteractionFlags interactionFlags; - bool wordSelectionEnabled; + bool cursorOn : 1; + bool cursorIsFocusIndicator : 1; + bool mousePressed : 1; + bool lastSelectionState : 1; + bool ignoreAutomaticScrollbarAdjustement : 1; + bool overwriteMode : 1; + bool acceptRichText : 1; + bool hideCursor : 1; // used to hide the cursor in the preedit area + bool hasFocus : 1; + bool isEnabled : 1; + bool hadSelectionOnMousePress : 1; + bool wordSelectionEnabled : 1; - QString linkToCopy; void _q_copyLink(); void _q_updateBlock(const QTextBlock &); void _q_documentLayoutChanged(); diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 6f3c32db7d..06264715a1 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -399,9 +399,6 @@ void QQuickTextEdit::setColor(const QColor &color) return; d->color = color; - QPalette pal = d->control->palette(); - pal.setColor(QPalette::Text, color); - d->control->setPalette(pal); updateDocument(); emit colorChanged(d->color); } @@ -424,9 +421,6 @@ void QQuickTextEdit::setSelectionColor(const QColor &color) return; d->selectionColor = color; - QPalette pal = d->control->palette(); - pal.setColor(QPalette::Highlight, color); - d->control->setPalette(pal); updateDocument(); emit selectionColorChanged(d->selectionColor); } @@ -449,9 +443,6 @@ void QQuickTextEdit::setSelectedTextColor(const QColor &color) return; d->selectedTextColor = color; - QPalette pal = d->control->palette(); - pal.setColor(QPalette::HighlightedText, color); - d->control->setPalette(pal); updateDocument(); emit selectedTextColorChanged(d->selectedTextColor); } @@ -1634,10 +1625,8 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * QRectF bounds = boundingRect(); - QColor selectionColor = d->control->palette().color(QPalette::Highlight); - QColor selectedTextColor = d->control->palette().color(QPalette::HighlightedText); node->addTextDocument(bounds.topLeft(), d->document, d->color, QQuickText::Normal, QColor(), - selectionColor, selectedTextColor, selectionStart(), + d->selectionColor, d->selectedTextColor, selectionStart(), selectionEnd() - 1); // selectionEnd() returns first char after // selection @@ -1756,31 +1745,21 @@ void QQuickTextEditPrivate::init() document = new QQuickTextDocumentWithImageResources(q); control = new QQuickTextControl(document, q); - control->setView(q); control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable); control->setAcceptRichText(false); control->setCursorIsFocusIndicator(true); - // QQuickTextControl follows the default text color - // defined by the platform, declarative text - // should be black by default - QPalette pal = control->palette(); - if (pal.color(QPalette::Text) != color) { - pal.setColor(QPalette::Text, color); - control->setPalette(pal); - } - - QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateDocument())); - QObject::connect(control, SIGNAL(updateCursorRequest()), q, SLOT(updateCursor())); - QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged())); - QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); - QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers())); - QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); - QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); - QObject::connect(control, SIGNAL(cursorRectangleChanged()), q, SLOT(moveCursorDelegate())); - QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); + FAST_CONNECT(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateDocument())); + FAST_CONNECT(control, SIGNAL(updateCursorRequest()), q, SLOT(updateCursor())); + FAST_CONNECT(control, SIGNAL(textChanged()), q, SLOT(q_textChanged())); + FAST_CONNECT(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); + FAST_CONNECT(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers())); + FAST_CONNECT(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); + FAST_CONNECT(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); + FAST_CONNECT(control, SIGNAL(cursorRectangleChanged()), q, SLOT(moveCursorDelegate())); + FAST_CONNECT(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); #ifndef QT_NO_CLIPBOARD - QObject::connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), q, SLOT(q_canPasteChanged())); + FAST_CONNECT(QGuiApplication::clipboard(), SIGNAL(dataChanged()), q, SLOT(q_canPasteChanged())); #endif FAST_CONNECT(document, SIGNAL(undoAvailable(bool)), q, SIGNAL(canUndoChanged())); FAST_CONNECT(document, SIGNAL(redoAvailable(bool)), q, SIGNAL(canRedoChanged())); diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index d69e24f6bc..1497c207ee 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -68,15 +68,17 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate public: QQuickTextEditPrivate() - : color("black"), hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop), - documentDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), - persistentSelection(false), requireImplicitWidth(false), selectByMouse(false), canPaste(false), - canPasteValid(false), hAlignImplicit(true), rightToLeftText(false), - textCached(false), - textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), - format(QQuickTextEdit::PlainText), document(0), wrapMode(QQuickTextEdit::NoWrap), - mouseSelectionMode(QQuickTextEdit::SelectCharacters), - lineCount(0), yoff(0), inputMethodHints(Qt::ImhNone), updateType(UpdatePaintNode) + : color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF)) + , textMargin(0.0), font(sourceFont), cursorComponent(0), cursor(0), document(0), control(0) + , lastSelectionStart(0), lastSelectionEnd(0), lineCount(0), yoff(0) + , hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop) + , format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap) + , mouseSelectionMode(QQuickTextEdit::SelectCharacters), inputMethodHints(Qt::ImhNone) + , updateType(UpdatePaintNode) + , documentDirty(true), dirty(false), richText(false), cursorVisible(false) + , focusOnPress(true), persistentSelection(false), requireImplicitWidth(false) + , selectByMouse(false), canPaste(false), canPasteValid(false), hAlignImplicit(true) + , rightToLeftText(false), textCached(false) { } @@ -92,17 +94,42 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate void mirrorChange(); qreal getImplicitWidth() const; + QColor color; + QColor selectionColor; + QColor selectedTextColor; + + QSize contentSize; + + qreal textMargin; + QString text; QUrl baseUrl; - QFont font; QFont sourceFont; - QColor color; - QColor selectionColor; - QColor selectedTextColor; - QString style; - QColor styleColor; + QFont font; + + QDeclarativeComponent* cursorComponent; + QQuickItem* cursor; + QQuickTextDocumentWithImageResources *document; + QQuickTextControl *control; + + int lastSelectionStart; + int lastSelectionEnd; + int lineCount; + int yoff; + + enum UpdateType { + UpdateNone, + UpdateOnlyPreprocess, + UpdatePaintNode + }; + QQuickTextEdit::HAlignment hAlign; QQuickTextEdit::VAlignment vAlign; + QQuickTextEdit::TextFormat format; + QQuickTextEdit::WrapMode wrapMode; + QQuickTextEdit::SelectionMode mouseSelectionMode; + Qt::InputMethodHints inputMethodHints; + UpdateType updateType; bool documentDirty : 1; bool dirty : 1; @@ -117,28 +144,6 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate bool hAlignImplicit:1; bool rightToLeftText:1; bool textCached:1; - - qreal textMargin; - int lastSelectionStart; - int lastSelectionEnd; - QDeclarativeComponent* cursorComponent; - QQuickItem* cursor; - QQuickTextEdit::TextFormat format; - QQuickTextDocumentWithImageResources *document; - QQuickTextControl *control; - QQuickTextEdit::WrapMode wrapMode; - QQuickTextEdit::SelectionMode mouseSelectionMode; - int lineCount; - int yoff; - QSize contentSize; - Qt::InputMethodHints inputMethodHints; - - enum UpdateType { - UpdateNone, - UpdateOnlyPreprocess, - UpdatePaintNode - }; - UpdateType updateType; }; QT_END_NAMESPACE diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp index 41c8546688..62b85b8d24 100644 --- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp @@ -903,10 +903,7 @@ void tst_qquicktextedit::color() QVERIFY(textEditObject); QVERIFY(textEditPrivate); QVERIFY(textEditPrivate->control); - - QPalette pal = textEditPrivate->control->palette(); QCOMPARE(textEditPrivate->color, QColor("black")); - QCOMPARE(textEditPrivate->color, pal.color(QPalette::Text)); } //test normal for (int i = 0; i < colorStrings.size(); i++) From 12f0663dbda6ae56d3307493ca34212f601dd3aa Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 21 Feb 2012 14:11:04 +1000 Subject: [PATCH 02/82] Fix font size calculation in headings in StyledText. Calculate the font size correctly even when the size is specified in pixels and update this size when the font changes. Also make sure that the text layout's font is set before parsing. Task-number: QTBUG-24458 Change-Id: Ida7723f6e4f4b9fd3a6878076f4beaf5bda8f7f7 Reviewed-by: Andrew den Exter --- src/quick/items/qquicktext.cpp | 15 +- src/quick/items/qquicktext_p_p.h | 1 + src/quick/util/qdeclarativestyledtext.cpp | 43 ++++-- src/quick/util/qdeclarativestyledtext_p.h | 6 +- .../tst_qdeclarativestyledtext.cpp | 130 +++++++++--------- .../qquicktext/data/pixelFontSizes.qml | 21 +++ .../qquicktext/data/pointFontSizes.qml | 21 +++ .../qtquick2/qquicktext/tst_qquicktext.cpp | 72 ++++++++++ 8 files changed, 228 insertions(+), 81 deletions(-) create mode 100644 tests/auto/qtquick2/qquicktext/data/pixelFontSizes.qml create mode 100644 tests/auto/qtquick2/qquicktext/data/pointFontSizes.qml diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 6f8aa383cd..44735c1895 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -85,7 +85,7 @@ QQuickTextPrivate::QQuickTextPrivate() , maximumLineCountValid(false), updateOnComponentComplete(true), richText(false) , styledText(false), singleline(false), internalWidthUpdate(false), requireImplicitWidth(false) , truncated(false), hAlignImplicit(true), rightToLeftText(false) - , layoutTextElided(false), textHasChanged(true), needToUpdateLayout(false) + , layoutTextElided(false), textHasChanged(true), needToUpdateLayout(false), formatModifiesFontSize(false) { } @@ -298,7 +298,11 @@ void QQuickTextPrivate::updateLayout() if (!richText) { if (textHasChanged) { if (styledText && !text.isEmpty()) { - QDeclarativeStyledText::parse(text, layout, imgTags, q->baseUrl(), qmlContext(q), !maximumLineCountValid); + layout.setFont(font); + // needs temporary bool because formatModifiesFontSize is in a bit-field + bool fontSizeModified = false; + QDeclarativeStyledText::parse(text, layout, imgTags, q->baseUrl(), qmlContext(q), !maximumLineCountValid, &fontSizeModified); + formatModifiesFontSize = fontSizeModified; } else { layout.clearAdditionalFormats(); multilengthEos = text.indexOf(QLatin1Char('\x9c')); @@ -1252,8 +1256,13 @@ void QQuickText::setFont(const QFont &font) d->font.setPointSizeF(size/2.0); } - if (oldFont != d->font) + if (oldFont != d->font) { + // if the format changes the size of the text + // with headings or tag, we need to re-parse + if (d->formatModifiesFontSize) + d->textHasChanged = true; d->updateLayout(); + } emit fontChanged(d->sourceFont); } diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index 555f41ff94..e060cc1cd2 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -148,6 +148,7 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate bool layoutTextElided:1; bool textHasChanged:1; bool needToUpdateLayout:1; + bool formatModifiesFontSize:1; static const QChar elideChar; diff --git a/src/quick/util/qdeclarativestyledtext.cpp b/src/quick/util/qdeclarativestyledtext.cpp index 164e33cec1..ddb8cadd2a 100644 --- a/src/quick/util/qdeclarativestyledtext.cpp +++ b/src/quick/util/qdeclarativestyledtext.cpp @@ -69,6 +69,8 @@ QT_BEGIN_NAMESPACE +Q_GUI_EXPORT int qt_defaultDpi(); + class QDeclarativeStyledTextPrivate { public: @@ -85,9 +87,10 @@ class QDeclarativeStyledTextPrivate QList &imgTags, const QUrl &baseUrl, QDeclarativeContext *context, - bool preloadImages) + bool preloadImages, + bool *fontSizeModified) : text(t), layout(l), imgTags(&imgTags), baseFont(layout.font()), baseUrl(baseUrl), hasNewLine(false), nbImages(0), updateImagePositions(false) - , preFormat(false), prependSpace(false), hasSpace(true), preloadImages(preloadImages), context(context) + , preFormat(false), prependSpace(false), hasSpace(true), preloadImages(preloadImages), fontSizeModified(fontSizeModified), context(context) { } @@ -103,7 +106,7 @@ class QDeclarativeStyledTextPrivate void parseImageAttributes(const QChar *&ch, const QString &textIn, QString &textOut); QPair parseAttribute(const QChar *&ch, const QString &textIn); QStringRef parseValue(const QChar *&ch, const QString &textIn); - + void setFontSize(int size, QTextCharFormat &format); inline void skipSpace(const QChar *&ch) { while (ch->isSpace() && !ch->isNull()) @@ -126,6 +129,7 @@ class QDeclarativeStyledTextPrivate bool prependSpace; bool hasSpace; bool preloadImages; + bool *fontSizeModified; QDeclarativeContext *context; static const QChar lessThan; @@ -160,8 +164,9 @@ QDeclarativeStyledText::QDeclarativeStyledText(const QString &string, QTextLayou QList &imgTags, const QUrl &baseUrl, QDeclarativeContext *context, - bool preloadImages) - : d(new QDeclarativeStyledTextPrivate(string, layout, imgTags, baseUrl, context, preloadImages)) + bool preloadImages, + bool *fontSizeModified) + : d(new QDeclarativeStyledTextPrivate(string, layout, imgTags, baseUrl, context, preloadImages, fontSizeModified)) { } @@ -174,11 +179,12 @@ void QDeclarativeStyledText::parse(const QString &string, QTextLayout &layout, QList &imgTags, const QUrl &baseUrl, QDeclarativeContext *context, - bool preloadImages) + bool preloadImages, + bool *fontSizeModified) { if (string.isEmpty()) return; - QDeclarativeStyledText styledText(string, layout, imgTags, baseUrl, context, preloadImages); + QDeclarativeStyledText styledText(string, layout, imgTags, baseUrl, context, preloadImages, fontSizeModified); styledText.d->parse(); } @@ -298,6 +304,20 @@ void QDeclarativeStyledTextPrivate::appendText(const QString &textIn, int start, hasNewLine = false; } +// +// Calculates and sets the correct font size in points +// depending on the size multiplier and base font. +// +void QDeclarativeStyledTextPrivate::setFontSize(int size, QTextCharFormat &format) +{ + static const qreal scaling[] = { 0.7, 0.8, 1.0, 1.2, 1.5, 2.0, 2.4 }; + if (baseFont.pointSizeF() != -1) + format.setFontPointSize(baseFont.pointSize() * scaling[size - 1]); + else + format.setFontPointSize(baseFont.pixelSize() * qreal(72.) / qreal(qt_defaultDpi()) * scaling[size - 1]); + *fontSizeModified = true; +} + bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format) { skipSpace(ch); @@ -353,12 +373,11 @@ bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &te } else if (char0 == QLatin1Char('h') && tagLength == 2) { int level = tag.at(1).digitValue(); if (level >= 1 && level <= 6) { - static const qreal scaling[] = { 2.0, 1.5, 1.2, 1.0, 0.8, 0.7 }; if (!hasNewLine) textOut.append(QChar::LineSeparator); hasSpace = true; prependSpace = false; - format.setFontPointSize(baseFont.pointSize() * scaling[level - 1]); + setFontSize(7 - level, format); format.setFontWeight(QFont::Bold); return true; } @@ -550,10 +569,8 @@ bool QDeclarativeStyledTextPrivate::parseFontAttributes(const QChar *&ch, const int size = attr.second.toString().toInt(); if (attr.second.at(0) == QLatin1Char('-') || attr.second.at(0) == QLatin1Char('+')) size += 3; - if (size >= 1 && size <= 7) { - static const qreal scaling[] = { 0.7, 0.8, 1.0, 1.2, 1.5, 2.0, 2.4 }; - format.setFontPointSize(baseFont.pointSize() * scaling[size-1]); - } + if (size >= 1 && size <= 7) + setFontSize(size, format); } } while (!ch->isNull() && !attr.first.isEmpty()); diff --git a/src/quick/util/qdeclarativestyledtext_p.h b/src/quick/util/qdeclarativestyledtext_p.h index aa6ae3f869..4487a9e98a 100644 --- a/src/quick/util/qdeclarativestyledtext_p.h +++ b/src/quick/util/qdeclarativestyledtext_p.h @@ -85,14 +85,16 @@ class Q_AUTOTEST_EXPORT QDeclarativeStyledText QList &imgTags, const QUrl &baseUrl, QDeclarativeContext *context, - bool preloadImages); + bool preloadImages, + bool *fontSizeModified); private: QDeclarativeStyledText(const QString &string, QTextLayout &layout, QList &imgTags, const QUrl &baseUrl, QDeclarativeContext *context, - bool preloadImages); + bool preloadImages, + bool *fontSizeModified); ~QDeclarativeStyledText(); QDeclarativeStyledTextPrivate *d; diff --git a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp index fd0d1abd29..ca3855c32a 100644 --- a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp +++ b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp @@ -88,68 +88,69 @@ void tst_qdeclarativestyledtext::textOutput_data() QTest::addColumn("input"); QTest::addColumn("output"); QTest::addColumn("formats"); - - QTest::newRow("bold") << "bold" << "bold" << (FormatList() << Format(Format::Bold, 0, 4)); - QTest::newRow("italic") << "italic" << "italic" << (FormatList() << Format(Format::Italic, 0, 6)); - QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)); - QTest::newRow("strong") << "strong" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)); - QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)); - QTest::newRow("missing >") << "text") << "text") << "text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)); - QTest::newRow("missing ") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)); - QTest::newRow("nested") << "text italic bold" << "text italic bold" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6) << Format(Format::Bold, 11, 5)); - QTest::newRow("bad nest") << "text italic" << "text italic" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6)); - QTest::newRow("font color") << "red text" << "red text" << (FormatList() << Format(0, 0, 8)); - QTest::newRow("font color: single quote") << "red text" << "red text" << (FormatList() << Format(0, 0, 8)); - QTest::newRow("font size") << "text" << "text" << (FormatList() << Format(0, 0, 4)); - QTest::newRow("font empty") << "text" << "text" << FormatList(); - QTest::newRow("font bad 1") << "text" << "text" << FormatList(); - QTest::newRow("font bad 2") << "text" << "" << FormatList(); - QTest::newRow("extra close") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)); - QTest::newRow("extra space") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)); - QTest::newRow("entities") << "<b>this & that</b>" << "this & that" << FormatList(); - QTest::newRow("newline") << "text
more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("paragraph") << "text

more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("paragraph closed") << "text

more text

more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("paragraph closed bold") << "text

more text

more text
" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << (FormatList() << Format(Format::Bold, 0, 24)); - QTest::newRow("self-closing newline") << "text
more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("empty") << "" << "" << FormatList(); - QTest::newRow("unknown tag") << "underline not" << "underline not" << (FormatList() << Format(Format::Underline, 0, 9)); - QTest::newRow("ordered list") << "
  1. one
  2. two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList(); - QTest::newRow("ordered list closed") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("ordered list alpha") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("a.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("b.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("ordered list upper alpha") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("A.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("B.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("ordered list roman") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("i.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("ii.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("ordered list upper roman") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("I.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("II.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("ordered list bad") << "
    1. one
    2. two
    " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("unordered list") << "
    • one
    • two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList(); - QTest::newRow("unordered list closed") << "
      • one
      • two
      " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("unordered list disc") << "
      • one
      • two
      " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("unordered list square") << "
      • one
      • two
      " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("unordered list bad") << "
      • one
      • two
      " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList(); - QTest::newRow("header close") << "

      head

      more" << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) + QLatin1String("more") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h0") << "head" << "head" << FormatList(); - QTest::newRow("h1") << "

      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h2") << "

      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h3") << "

      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h4") << "

      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h5") << "

      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h6") << "
      head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("h7") << "head" << "head" << FormatList(); - QTest::newRow("pre") << "normal
      pre text
      normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 9)); - QTest::newRow("pre lb") << "normal
      pre\n text
      normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::LineSeparator) + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 10)); - QTest::newRow("line feed") << "line\nfeed" << "line feed" << FormatList(); - QTest::newRow("leading whitespace") << " leading whitespace" << "leading whitespace" << FormatList(); - QTest::newRow("trailing whitespace") << "trailing whitespace " << "trailing whitespace" << FormatList(); - QTest::newRow("consecutive whitespace") << " consecutive \t \n whitespace" << "consecutive whitespace" << FormatList(); - QTest::newRow("space after newline") << "text
      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("space after paragraph") << "text

      more text

      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList(); - QTest::newRow("space in header") << "

      head

      " << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) << (FormatList() << Format(Format::Bold, 0, 5)); - QTest::newRow("space before bold") << "this is bold" << "this is bold" << (FormatList() << Format(Format::Bold, 8, 4)); - QTest::newRow("space leading bold") << "this is bold" << "this is bold" << (FormatList() << Format(Format::Bold, 7, 5)); - QTest::newRow("space trailing bold") << "this is bold " << "this is bold " << (FormatList() << Format(Format::Bold, 8, 5)); - QTest::newRow("img") << "ab" << "a b" << FormatList(); + QTest::addColumn("modifiesFontSize"); + + QTest::newRow("bold") << "bold" << "bold" << (FormatList() << Format(Format::Bold, 0, 4)) << false; + QTest::newRow("italic") << "italic" << "italic" << (FormatList() << Format(Format::Italic, 0, 6)) << false; + QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; + QTest::newRow("strong") << "strong" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)) << false; + QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; + QTest::newRow("missing >") << "text") << "text") << "text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; + QTest::newRow("missing ") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; + QTest::newRow("nested") << "text italic bold" << "text italic bold" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6) << Format(Format::Bold, 11, 5)) << false; + QTest::newRow("bad nest") << "text italic" << "text italic" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6)) << false; + QTest::newRow("font color") << "red text" << "red text" << (FormatList() << Format(0, 0, 8)) << false; + QTest::newRow("font color: single quote") << "red text" << "red text" << (FormatList() << Format(0, 0, 8)) << false; + QTest::newRow("font size") << "text" << "text" << (FormatList() << Format(0, 0, 4)) << true; + QTest::newRow("font empty") << "text" << "text" << FormatList() << false; + QTest::newRow("font bad 1") << "text" << "text" << FormatList() << false; + QTest::newRow("font bad 2") << "text" << "" << FormatList() << false; + QTest::newRow("extra close") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; + QTest::newRow("extra space") << "text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; + QTest::newRow("entities") << "<b>this & that</b>" << "this & that" << FormatList() << false; + QTest::newRow("newline") << "text
      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("paragraph") << "text

      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("paragraph closed") << "text

      more text

      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("paragraph closed bold") << "text

      more text

      more text
      " << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << (FormatList() << Format(Format::Bold, 0, 24)) << false; + QTest::newRow("self-closing newline") << "text
      more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("empty") << "" << "" << FormatList() << false; + QTest::newRow("unknown tag") << "underline not" << "underline not" << (FormatList() << Format(Format::Underline, 0, 9)) << false; + QTest::newRow("ordered list") << "
      1. one
      2. two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList() << false; + QTest::newRow("ordered list closed") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("ordered list alpha") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("a.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("b.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("ordered list upper alpha") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("A.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("B.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("ordered list roman") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("i.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("ii.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("ordered list upper roman") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("I.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("II.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("ordered list bad") << "
        1. one
        2. two
        " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("unordered list") << "
        • one
        • two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList() << false; + QTest::newRow("unordered list closed") << "
          • one
          • two
          " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("unordered list disc") << "
          • one
          • two
          " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("unordered list square") << "
          • one
          • two
          " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("unordered list bad") << "
          • one
          • two
          " << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false; + QTest::newRow("header close") << "

          head

          more" << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) + QLatin1String("more") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h0") << "head" << "head" << FormatList() << false; + QTest::newRow("h1") << "

          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h2") << "

          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h3") << "

          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h4") << "

          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h5") << "

          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h6") << "
          head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("h7") << "head" << "head" << FormatList() << false; + QTest::newRow("pre") << "normal
          pre text
          normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 9)) << false; + QTest::newRow("pre lb") << "normal
          pre\n text
          normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::LineSeparator) + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 10)) << false; + QTest::newRow("line feed") << "line\nfeed" << "line feed" << FormatList() << false; + QTest::newRow("leading whitespace") << " leading whitespace" << "leading whitespace" << FormatList() << false; + QTest::newRow("trailing whitespace") << "trailing whitespace " << "trailing whitespace" << FormatList() << false; + QTest::newRow("consecutive whitespace") << " consecutive \t \n whitespace" << "consecutive whitespace" << FormatList() << false; + QTest::newRow("space after newline") << "text
          more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("space after paragraph") << "text

          more text

          more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false; + QTest::newRow("space in header") << "

          head

          " << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) << (FormatList() << Format(Format::Bold, 0, 5)) << true; + QTest::newRow("space before bold") << "this is bold" << "this is bold" << (FormatList() << Format(Format::Bold, 8, 4)) << false; + QTest::newRow("space leading bold") << "this is bold" << "this is bold" << (FormatList() << Format(Format::Bold, 7, 5)) << false; + QTest::newRow("space trailing bold") << "this is bold " << "this is bold " << (FormatList() << Format(Format::Bold, 8, 5)) << false; + QTest::newRow("img") << "ab" << "a b" << FormatList() << false; } void tst_qdeclarativestyledtext::textOutput() @@ -157,10 +158,12 @@ void tst_qdeclarativestyledtext::textOutput() QFETCH(QString, input); QFETCH(QString, output); QFETCH(FormatList, formats); + QFETCH(bool, modifiesFontSize); QTextLayout layout; QList imgTags; - QDeclarativeStyledText::parse(input, layout, imgTags, QUrl(), 0, false); + bool fontSizeModified = false; + QDeclarativeStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); QCOMPARE(layout.text(), output); @@ -177,6 +180,7 @@ void tst_qdeclarativestyledtext::textOutput() QVERIFY(layoutFormats.at(i).format.fontItalic() == bool(formats.at(i).type & Format::Italic)); QVERIFY(layoutFormats.at(i).format.fontUnderline() == bool(formats.at(i).type & Format::Underline)); } + QCOMPARE(fontSizeModified, modifiesFontSize); } diff --git a/tests/auto/qtquick2/qquicktext/data/pixelFontSizes.qml b/tests/auto/qtquick2/qquicktext/data/pixelFontSizes.qml new file mode 100644 index 0000000000..e3d81b682e --- /dev/null +++ b/tests/auto/qtquick2/qquicktext/data/pixelFontSizes.qml @@ -0,0 +1,21 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 200 + + property variant pixelSize: 6 + + Text { + objectName: "text" + font.pixelSize: parent.pixelSize + text: "This is
          a font
          size test." + } + + Text { + x: 200 + objectName: "textWithTag" + font.pixelSize: parent.pixelSize + text: "This is

          a font

          size test." + } +} diff --git a/tests/auto/qtquick2/qquicktext/data/pointFontSizes.qml b/tests/auto/qtquick2/qquicktext/data/pointFontSizes.qml new file mode 100644 index 0000000000..6feb8fecf8 --- /dev/null +++ b/tests/auto/qtquick2/qquicktext/data/pointFontSizes.qml @@ -0,0 +1,21 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 200 + + property variant pointSize: 6 + + Text { + objectName: "text" + font.pointSize: parent.pointSize + text: "This is
          a font
          size test." + } + + Text { + x: 200 + objectName: "textWithTag" + font.pointSize: parent.pointSize + text: "This is

          a font

          size test." + } +} diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index d1c0f765d0..86d502f07e 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -122,6 +122,8 @@ private slots: void fontSizeModeMultiline(); void multilengthStrings_data(); void multilengthStrings(); + void fontFormatSizes_data(); + void fontFormatSizes(); private: QStringList standard; @@ -2427,6 +2429,76 @@ void tst_qquicktext::multilengthStrings() QCOMPARE(myText->truncated(), true); } +void tst_qquicktext::fontFormatSizes_data() +{ + QTest::addColumn("text"); + QTest::addColumn("textWithTag"); + QTest::addColumn("fontIsBigger"); + + QTest::newRow("fs1") << "Hello world!" << "Hello world!" << false; + QTest::newRow("fs2") << "Hello world!" << "Hello world!" << false; + QTest::newRow("fs3") << "Hello world!" << "Hello world!" << false; + QTest::newRow("fs4") << "Hello world!" << "Hello world!" << true; + QTest::newRow("fs5") << "Hello world!" << "Hello world!" << true; + QTest::newRow("fs6") << "Hello world!" << "Hello world!" << true; + QTest::newRow("fs7") << "Hello world!" << "Hello world!" << true; + QTest::newRow("h1") << "This is
          a font
          size test." << "This is

          a font

          size test." << true; + QTest::newRow("h2") << "This is
          a font
          size test." << "This is

          a font

          size test." << true; + QTest::newRow("h3") << "This is
          a font
          size test." << "This is

          a font

          size test." << true; + QTest::newRow("h4") << "This is
          a font
          size test." << "This is

          a font

          size test." << true; + QTest::newRow("h5") << "This is
          a font
          size test." << "This is
          a font
          size test." << false; + QTest::newRow("h6") << "This is
          a font
          size test." << "This is
          a font
          size test." << false; +} + +void tst_qquicktext::fontFormatSizes() +{ + QFETCH(QString, text); + QFETCH(QString, textWithTag); + QFETCH(bool, fontIsBigger); + + QQuickView *view = new QQuickView; + { + view->setSource(testFileUrl("pointFontSizes.qml")); + view->show(); + + QQuickText *qtext = view->rootObject()->findChild("text"); + QQuickText *qtextWithTag = view->rootObject()->findChild("textWithTag"); + QVERIFY(qtext != 0); + QVERIFY(qtextWithTag != 0); + + qtext->setText(text); + qtextWithTag->setText(textWithTag); + + for (int size = 6; size < 100; size += 4) { + view->rootObject()->setProperty("pointSize", size); + if (fontIsBigger) + QVERIFY(qtext->height() <= qtextWithTag->height()); + else + QVERIFY(qtext->height() >= qtextWithTag->height()); + } + } + + { + view->setSource(testFileUrl("pixelFontSizes.qml")); + QQuickText *qtext = view->rootObject()->findChild("text"); + QQuickText *qtextWithTag = view->rootObject()->findChild("textWithTag"); + QVERIFY(qtext != 0); + QVERIFY(qtextWithTag != 0); + + qtext->setText(text); + qtextWithTag->setText(textWithTag); + + for (int size = 6; size < 100; size += 4) { + view->rootObject()->setProperty("pixelSize", size); + if (fontIsBigger) + QVERIFY(qtext->height() <= qtextWithTag->height()); + else + QVERIFY(qtext->height() >= qtextWithTag->height()); + } + } + delete view; +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" From 66ce5181816ae4e2361d062e8d41f599233b7905 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Feb 2012 11:08:58 +1000 Subject: [PATCH 03/82] Small doc fixes. Change-Id: I54ed2d0387b85ac853d94cfe716a1f6016986e2a Reviewed-by: Glenn Watson --- src/quick/scenegraph/coreapi/qsgnode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 88afac7ecc..618538642e 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -777,9 +777,9 @@ QSGClipNode::~QSGClipNode() Sets whether this clip node has a rectangular clip to \a rectHint. This is an optimization hint which means that the renderer can - use scissoring instead of stencil, which is significnatly faster. + use scissoring instead of stencil, which is significantly faster. - When this hint is and it is applicable, the clip region will be + When this hint is set and it is applicable, the clip region will be generated from clipRect() rather than geometry(). */ @@ -791,7 +791,7 @@ void QSGClipNode::setIsRectangular(bool rectHint) /*! - \fn void QSGClipNode::clipRect() const + \fn QRectF QSGClipNode::clipRect() const Returns the clip rect of this node. */ From c5f65d859720c9345f995136301f6809bbb82867 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 23 Feb 2012 11:58:23 +1000 Subject: [PATCH 04/82] QML locale.firstDayOfWeek returns 7 for Sunday To match JS Date object, Sunday should be 0. Change-Id: I662c0b1fcbf921fa1c4bb58f900366dd088b343b Reviewed-by: Glenn Watson --- src/declarative/qml/qdeclarativelocale.cpp | 5 ++- .../tst_qdeclarativelocale.cpp | 38 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativelocale.cpp b/src/declarative/qml/qdeclarativelocale.cpp index 39d0f6c378..103378a9c0 100644 --- a/src/declarative/qml/qdeclarativelocale.cpp +++ b/src/declarative/qml/qdeclarativelocale.cpp @@ -524,7 +524,10 @@ v8::Handle QDeclarativeNumberExtension::fromLocaleString(const v8::Ar static v8::Handle locale_get_firstDayOfWeek(v8::Local, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); - return v8::Integer::New(r->locale.firstDayOfWeek()); + int fdow = int(r->locale.firstDayOfWeek()); + if (fdow == 7) + fdow = 0; // Qt::Sunday = 7, but Sunday is 0 in JS Date + return v8::Integer::New(fdow); } static v8::Handle locale_get_measurementSystem(v8::Local, const v8::AccessorInfo &info) diff --git a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp index bf5c8c7af4..7d86ad9148 100644 --- a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp +++ b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp @@ -68,6 +68,8 @@ private slots: void dayName(); void standaloneDayName_data(); void standaloneDayName(); + void firstDayOfWeek_data(); + void firstDayOfWeek(); void weekDays_data(); void weekDays(); void uiLanguages_data(); @@ -154,7 +156,6 @@ void tst_qdeclarativelocale::addPropertyData(const QString &l) LOCALE_PROP(QString,negativeSign), LOCALE_PROP(QString,positiveSign), LOCALE_PROP(QString,exponential), - LOCALE_PROP(int,firstDayOfWeek), LOCALE_PROP(int,measurementSystem), LOCALE_PROP(int,textDirection), { 0, QVariant() } @@ -426,6 +427,41 @@ void tst_qdeclarativelocale::standaloneDayName() delete obj; } +void tst_qdeclarativelocale::firstDayOfWeek_data() +{ + QTest::addColumn("locale"); + + QTest::newRow("en_US") << "en_US"; + QTest::newRow("de_DE") << "de_DE"; + QTest::newRow("ar_SA") << "ar_SA"; + QTest::newRow("hi_IN") << "hi_IN"; + QTest::newRow("zh_CN") << "zh_CN"; + QTest::newRow("th_TH") << "th_TH"; +} + +void tst_qdeclarativelocale::firstDayOfWeek() +{ + QFETCH(QString, locale); + + QDeclarativeComponent c(&engine, testFileUrl("properties.qml")); + + QObject *obj = c.create(); + QVERIFY(obj); + + QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection, + Q_ARG(QVariant, QVariant(locale))); + + QVariant val = obj->property("firstDayOfWeek"); + QVERIFY(val.type() == QVariant::Int); + + int day = int(QLocale(locale).firstDayOfWeek()); + if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday) + day = 0; + QCOMPARE(day, val.toInt()); + + delete obj; +} + void tst_qdeclarativelocale::weekDays_data() { QTest::addColumn("locale"); From 924a9620d528da85dc19df7573d33ba4132e5a3a Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 17 Feb 2012 12:26:21 +1000 Subject: [PATCH 05/82] Fix Text eliding with implicit height and maximumLineCount. Ignore the height of the text if the element height is invalid. Task-number: QTBUG-24293 Change-Id: I1646c3f64583da40e6166aeea24c2c4af42cb279 Reviewed-by: Yann Bodson --- src/quick/items/qquicktext.cpp | 6 ++++-- tests/auto/qtquick2/qquicktext/data/multilineelide.qml | 2 +- tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 44735c1895..28491d8f75 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -666,6 +666,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } const int lineWidth = q->widthValid() ? q->width() : INT_MAX; + const qreal maxHeight = q->heightValid() ? q->height() : FLT_MAX; const bool customLayout = isLineLaidOutConnected(); const bool wasTruncated = truncated; @@ -715,6 +716,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } layout.beginLayout(); + bool wrapped = false; bool truncateHeight = false; truncated = false; @@ -735,7 +737,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) // Elide the previous line if the accumulated height of the text exceeds the height // of the element. - if (multilineElide && height > q->height() && visibleCount > 1) { + if (multilineElide && height > maxHeight && visibleCount > 1) { elide = true; if (eos != -1) // There's an abbreviated string available, skip the rest as it's break; // all going to be discarded. @@ -873,7 +875,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } if (verticalFit) { - if (truncateHeight || (q->heightValid() && unelidedRect.height() > q->height())) { + if (truncateHeight || unelidedRect.height() > maxHeight) { largeFont = scaledFontSize - 1; scaledFontSize = (smallFont + largeFont + 1) / 2; if (smallFont > largeFont) diff --git a/tests/auto/qtquick2/qquicktext/data/multilineelide.qml b/tests/auto/qtquick2/qquicktext/data/multilineelide.qml index f3bb65775b..ffca0d638a 100644 --- a/tests/auto/qtquick2/qquicktext/data/multilineelide.qml +++ b/tests/auto/qtquick2/qquicktext/data/multilineelide.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 Text { - width: 200; height: 200 + width: 200 wrapMode: Text.WordWrap elide: Text.ElideRight maximumLineCount: 3 diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index 86d502f07e..c28de8b53c 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -471,6 +471,12 @@ void tst_qquicktext::multilineElide() qreal lineHeight = myText->contentHeight() / 3.; + // Set a valid height greater than the truncated content height and ensure the line count is + // unchanged. + myText->setHeight(200); + QCOMPARE(myText->lineCount(), 3); + QCOMPARE(myText->truncated(), true); + // reduce size and ensure fewer lines are drawn myText->setHeight(lineHeight * 2); QCOMPARE(myText->lineCount(), 2); From 09ea9cace4286c639044aef79f2deb107c2a5376 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Thu, 23 Feb 2012 11:57:18 +1000 Subject: [PATCH 06/82] Fix for bad operator precedence causing right mouse button issues Binary or (|) has higher operator precedence than a ternary in C, causing the original expression here to function quite incorrectly for anything other than the common left-mouse-button-only case. I just added brackets -- feel free to change this to "if"s if you think that would more clearly avoid this issue in future. Change-Id: Ie20bd7e805b89a393794d3240fb0ae680b29ff64 Reviewed-by: Andrew den Exter --- src/quick/items/qquickitem_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index c2cc7d000b..fd02334ab3 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -830,8 +830,8 @@ class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const { - return extra.flag()?Qt::LeftButton:Qt::MouseButton(0) | - (extra.isAllocated()?extra->acceptedMouseButtons:Qt::MouseButtons(0)); + return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) | + (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(0))); } QSGContext *QQuickItemPrivate::sceneGraphContext() const From bbbc44c45d9a6b7381b775413fcfcc1a72c14317 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 23 Feb 2012 11:51:31 +1000 Subject: [PATCH 07/82] Clean up some of the view transition docs Fix some of the wording in the docs. Change-Id: I07892bec06c78b73bdd93926719d609405e263b3 Reviewed-by: Bea Lam --- src/quick/items/qquickgridview.cpp | 69 ++++++++++++++++-------------- src/quick/items/qquicklistview.cpp | 69 ++++++++++++++++-------------- 2 files changed, 72 insertions(+), 66 deletions(-) diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index d7f4b808f2..a7e0af487f 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1586,10 +1586,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::populate - This property holds the transition to apply to items that are initially created for a - view. - This transition is applied to all the items that are created when: + This property holds the transition to apply to the items that are initially created + for a view. + + It is applied to all items that are created when: \list \o The view is first created @@ -1619,10 +1620,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::add - This property holds the transition to apply to items that are added within the view. - The transition is applied to items that have been added to the visible area of the view. For - example, here is a view that specifies such a transition: + This property holds the transition to apply to items that are added to the view. + + For example, here is a view that specifies such a transition: \code GridView { @@ -1651,11 +1652,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::addDisplaced - This property holds the transition to apply to items in the view that are displaced by other - items that have been added to the view. - The transition is applied to items that are currently visible and have been displaced by newly - added items. For example, here is a view that specifies such a transition: + This property holds the transition to apply to items within the view that are displaced by + the addition of other items to the view. + + For example, here is a view that specifies such a transition: \code GridView { @@ -1684,11 +1685,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) */ /*! \qmlproperty Transition QtQuick2::GridView::move - This property holds the transition to apply to items in the view that are moved by a move - operation. - The transition is applied to items that are moving within the view or are moving - into the view as a result of a move operation in the view's model. For example: + This property holds the transition to apply to items in the view that are being moved due + to a move operation in the view's \l model. + + For example, here is a view that specifies such a transition: \code GridView { @@ -1699,10 +1700,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) } \endcode - Whenever an item is moved within the above view, the item will be animated to its new position in - the view over one second. The transition only applies to the items that are the subject of the - move operation in the model; it does not apply to the items below them that are displaced by - the move operation. To animate the displaced items, set the \l moveDisplaced property. + Whenever the \l model performs a move operation to move a particular set of indexes, the + respective items in the view will be animated to their new positions in the view over one + second. The transition only applies to the items that are the subject of the move operation + in the model; it does not apply to items below them that are displaced by the move operation. + To animate the displaced items, set the \l moveDisplaced property. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1712,11 +1714,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::moveDisplaced - This property holds the transition to apply to items in the view that are displaced by a - move operation in the view. - The transition is applied to items that are currently visible and have been displaced following - a move operation in the view's model. For example, here is a view that specifies such a transition: + This property holds the transition to apply to items that are displaced by a move operation in + the view's \l model. + + For example, here is a view that specifies such a transition: \code GridView { @@ -1727,12 +1729,13 @@ void QQuickGridView::setSnapMode(SnapMode mode) } \endcode - Whenever an item moves within (or moves into) the above view, all items beneath it are - displaced, causing them to move upwards (or sideways, if horizontally orientated) within the - view. As this displacement occurs, the items' movement to their new x,y positions within the - view will be animated by a NumberAnimation over one second, as specified. This transition is - not applied to the item that are actually the subject of the move operation; to animate the - moved items, set the \l move property. + Whenever the \l model performs a move operation to move a particular set of indexes, the items + between the source and destination indexes of the move operation are displaced, causing them + to move upwards or downwards (or sideways, if horizontally orientated) within the view. As this + displacement occurs, the items' movement to their new x,y positions within the view will be + animated by a NumberAnimation over one second, as specified. This transition is not applied to + the items that are the actual subjects of the move operation; to animate the moved items, set + the \l move property. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1742,10 +1745,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::remove + This property holds the transition to apply to items that are removed from the view. - The transition is applied to items that have been removed from the visible area of the view. For - example: + For example, here is a view that specifies such a transition: \code GridView { @@ -1762,7 +1765,7 @@ void QQuickGridView::setSnapMode(SnapMode mode) Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below - them that are displaced by the removal of the items. To animate the displaced items, set the \l + them that are displaced by the removal of the items. To animate the displaced items, set the \l removeDisplaced property. Note that by the time the transition is applied, the item has already been removed from the @@ -1779,11 +1782,11 @@ void QQuickGridView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::GridView::removeDisplaced + This property holds the transition to apply to items in the view that are displaced by the removal of other items in the view. - The transition is applied to items that are currently visible and have been displaced by - the removal of items. For example, here is a view that specifies such a transition: + For example, here is a view that specifies such a transition: \code GridView { diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 906b9b3781..6324c7d2ff 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2245,10 +2245,11 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::populate - This property holds the transition to apply to items that are initially created for a - view. - This transition is applied to all the items that are created when: + This property holds the transition to apply to the items that are initially created + for a view. + + It is applied to all items that are created when: \list \o The view is first created @@ -2278,10 +2279,10 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::add - This property holds the transition to apply to items that are added within the view. - The transition is applied to items that have been added to the visible area of the view. For - example, here is a view that specifies such a transition: + This property holds the transition to apply to items that are added to the view. + + For example, here is a view that specifies such a transition: \code ListView { @@ -2310,11 +2311,11 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::addDisplaced - This property holds the transition to apply to items in the view that are displaced by other - items that have been added to the view. - The transition is applied to items that are currently visible and have been displaced by newly - added items. For example, here is a view that specifies such a transition: + This property holds the transition to apply to items within the view that are displaced by + the addition of other items to the view. + + For example, here is a view that specifies such a transition: \code ListView { @@ -2344,11 +2345,11 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::move - This property holds the transition to apply to items in the view that are moved by a move - operation. - The transition is applied to items that are moving within the view or are moving - into the view as a result of a move operation in the view's model. For example: + This property holds the transition to apply to items in the view that are being moved due + to a move operation in the view's \l model. + + For example, here is a view that specifies such a transition: \code ListView { @@ -2359,10 +2360,11 @@ void QQuickListView::setSnapMode(SnapMode mode) } \endcode - Whenever an item is moved within the above view, the item will be animated to its new position in - the view over one second. The transition only applies to the items that are the subject of the - move operation in the model; it does not apply to the items below them that are displaced by - the move operation. To animate the displaced items, set the \l moveDisplaced property. + Whenever the \l model performs a move operation to move a particular set of indexes, the + respective items in the view will be animated to their new positions in the view over one + second. The transition only applies to the items that are the subject of the move operation + in the model; it does not apply to items below them that are displaced by the move operation. + To animate the displaced items, set the \l moveDisplaced property. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2372,11 +2374,11 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::moveDisplaced - This property holds the transition to apply to items in the view that are displaced by a - move operation in the view. - The transition is applied to items that are currently visible and have been displaced following - a move operation in the view's model. For example, here is a view that specifies such a transition: + This property holds the transition to apply to items that are displaced by a move operation in + the view's \l model. + + For example, here is a view that specifies such a transition: \code ListView { @@ -2387,12 +2389,13 @@ void QQuickListView::setSnapMode(SnapMode mode) } \endcode - Whenever an item moves within (or moves into) the above view, all items beneath it are - displaced, causing them to move upwards (or sideways, if horizontally orientated) within the - view. As this displacement occurs, the items' movement to their new x,y positions within the - view will be animated by a NumberAnimation over one second, as specified. This transition is - not applied to the item that are actually the subject of the move operation; to animate the - moved items, set the \l move property. + Whenever the \l model performs a move operation to move a particular set of indexes, the items + between the source and destination indexes of the move operation are displaced, causing them + to move upwards or downwards (or sideways, if horizontally orientated) within the view. As this + displacement occurs, the items' movement to their new x,y positions within the view will be + animated by a NumberAnimation over one second, as specified. This transition is not applied to + the items that are the actual subjects of the move operation; to animate the moved items, set + the \l move property. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2402,10 +2405,10 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::remove + This property holds the transition to apply to items that are removed from the view. - The transition is applied to items that have been removed from the visible area of the view. For - example: + For example, here is a view that specifies such a transition: \code ListView { @@ -2422,7 +2425,7 @@ void QQuickListView::setSnapMode(SnapMode mode) Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below - them that are displaced by the removal of the items. To animate the displaced items, set the \l + them that are displaced by the removal of the items. To animate the displaced items, set the \l removeDisplaced property. Note that by the time the transition is applied, the item has already been removed from the @@ -2439,11 +2442,11 @@ void QQuickListView::setSnapMode(SnapMode mode) /*! \qmlproperty Transition QtQuick2::ListView::removeDisplaced + This property holds the transition to apply to items in the view that are displaced by the removal of other items in the view. - The transition is applied to items that are currently visible and have been displaced by - the removal of items. For example, here is a view that specifies such a transition: + For example, here is a view that specifies such a transition: \code ListView { From dc3165178851b9bda71dd238c8a5faca4dfa7a45 Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Thu, 23 Feb 2012 14:55:16 +1000 Subject: [PATCH 08/82] Remove warning produced by 'parent' reference. When Qt.createQmlObject is invoked from QML, any contained references to parent produce a warning from V8. To prevent this, move the assignment of the parent object to before the initial execution of the bindings. Task-number: QTBUG-24464 Change-Id: Ib330822f1ca46ec5a6af648a56197da09669c3f2 Reviewed-by: Martin Jones --- .../qml/v8/qdeclarativebuiltinfunctions.cpp | 19 +++++------ .../data/createParentReference.qml | 12 +++++++ .../tst_qdeclarativecomponent.cpp | 32 +++++++++++++++++++ 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativecomponent/data/createParentReference.qml diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp index 12f06e6b76..d338508d09 100644 --- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp +++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp @@ -1096,8 +1096,17 @@ v8::Handle createQmlObject(const v8::Arguments &args) V8THROW_ERROR("Qt.createQmlObject(): Component is not ready"); QObject *obj = component.beginCreate(effectiveContext); - if (obj) + if (obj) { QDeclarativeData::get(obj, true)->setImplicitDestructible(); + + obj->setParent(parentArg); + + QList functions = QDeclarativeMetaType::parentFunctions(); + for (int ii = 0; ii < functions.count(); ++ii) { + if (QDeclarativePrivate::Parented == functions.at(ii)(obj, parentArg)) + break; + } + } component.completeCreate(); if (component.isError()) { @@ -1107,14 +1116,6 @@ v8::Handle createQmlObject(const v8::Arguments &args) Q_ASSERT(obj); - obj->setParent(parentArg); - - QList functions = QDeclarativeMetaType::parentFunctions(); - for (int ii = 0; ii < functions.count(); ++ii) { - if (QDeclarativePrivate::Parented == functions.at(ii)(obj, parentArg)) - break; - } - return v8engine->newQObject(obj); } diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createParentReference.qml b/tests/auto/declarative/qdeclarativecomponent/data/createParentReference.qml new file mode 100644 index 0000000000..daa5d3c167 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecomponent/data/createParentReference.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 + +Item { + id: root + width: 100 + height: 100 + + function createChild() { + Qt.createQmlObject("import QtQuick 2.0;" + + "Item { width: parent.width; }", root); + } +} diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index c529649fc0..993c706092 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -71,6 +71,7 @@ private slots: void qmlCreateObject(); void qmlCreateObjectWithProperties(); void qmlIncubateObject(); + void qmlCreateParentReference(); private: QDeclarativeEngine engine; @@ -181,6 +182,37 @@ void tst_qdeclarativecomponent::qmlCreateObjectWithProperties() delete testBindingThisObj; } +static QStringList warnings; +static void msgHandler(QtMsgType, const char *warning) +{ + warnings << QString::fromUtf8(warning); +} + +void tst_qdeclarativecomponent::qmlCreateParentReference() +{ + QDeclarativeEngine engine; + + QCOMPARE(engine.outputWarningsToStandardError(), true); + + warnings.clear(); + QtMsgHandler old = qInstallMsgHandler(msgHandler); + + QDeclarativeComponent component(&engine, testFileUrl("createParentReference.qml")); + QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(QMetaObject::invokeMethod(object, "createChild")); + delete object; + + qInstallMsgHandler(old); + + engine.setOutputWarningsToStandardError(false); + QCOMPARE(engine.outputWarningsToStandardError(), false); + + QCOMPARE(warnings.count(), 0); +} + QTEST_MAIN(tst_qdeclarativecomponent) #include "tst_qdeclarativecomponent.moc" From fb3889a423365b1736cae8850cdb2b3ac77b14a8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Feb 2012 10:55:34 +0100 Subject: [PATCH 09/82] Use new plugin system in QtDeclarative. - Use prefix "org.qt-project" for interfaces. - Use new macros, add json files. Change-Id: I53df83f95153c5c9c462098584606284470a5ae0 Reviewed-by: Martin Jones --- .../cppextensions/imageprovider/imageprovider.cpp | 6 ++++-- .../cppextensions/imageprovider/imageprovider.json | 1 + .../cppextensions/imageprovider/imageprovider.pro | 2 ++ examples/declarative/cppextensions/plugins/plugin.cpp | 6 ++---- examples/declarative/cppextensions/plugins/plugin.json | 1 + examples/declarative/cppextensions/plugins/plugins.pro | 2 ++ examples/declarative/cppextensions/qwidgets/qwidgets.json | 1 + .../painteditem/textballoons/TextBalloonPlugin/plugin.h | 3 +-- .../textballoons/TextBalloonPlugin/textballoon.json | 1 + .../declarative/painteditem/textballoons/textballoons.pro | 2 ++ .../tutorials/extending/chapter6-plugins/chartsplugin.cpp | 1 - .../tutorials/extending/chapter6-plugins/chartsplugin.h | 2 ++ .../extending/chapter6-plugins/chartsplugin.json | 1 + .../gettingStartedQml/filedialog/dialogPlugin.cpp | 3 --- .../tutorials/gettingStartedQml/filedialog/dialogPlugin.h | 1 + .../gettingStartedQml/filedialog/dialogplugin.json | 1 + .../debugger/qdeclarativedebugserverconnection_p.h | 4 +++- .../debugger/qdeclarativeinspectorinterface_p.h | 4 +++- src/declarative/qml/qdeclarativeextensioninterface.h | 7 ++++++- .../qml/qdeclarativepropertyvalueinterceptor_p.h | 5 ++++- src/declarative/qml/qdeclarativepropertyvaluesource.h | 5 ++++- src/imports/folderlistmodel/folderlistmodel.json | 1 + src/imports/folderlistmodel/plugin.cpp | 7 ++----- src/imports/gestures/gestures.json | 1 + src/imports/localstorage/localstorage.json | 1 + src/imports/localstorage/localstorage.pro | 4 +++- src/imports/localstorage/plugin.cpp | 4 ++-- src/imports/shaders/shaders.json | 1 + src/imports/testlib/main.cpp | 4 ++-- src/imports/testlib/testlib.json | 1 + src/imports/testlib/testlib.pro | 3 ++- src/imports/xmllistmodel/plugin.cpp | 4 ++-- src/imports/xmllistmodel/xmllistmodel.json | 1 + src/plugins/accessible/quick/accessible.json | 3 +++ src/plugins/accessible/quick/main.cpp | 8 +++++--- src/plugins/accessible/quick/quick.pro | 2 ++ .../qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro | 2 ++ src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp | 2 -- src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h | 1 + .../qmltooling/qmldbg_qtquick2/qtquick2plugin.json | 2 ++ src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro | 2 ++ .../qmltooling/qmldbg_tcp/qtcpserverconnection.cpp | 2 -- src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h | 2 +- .../qmltooling/qmldbg_tcp/qtcpserverconnection.json | 1 + src/quick/items/qquickvisualadaptormodel_p.h | 4 +++- src/quick/scenegraph/qsgcontextplugin_p.h | 2 +- tests/auto/declarative/qdeclarativelanguage/testtypes.h | 3 ++- .../auto/declarative/qdeclarativemoduleplugin/empty.json | 1 + .../qdeclarativemoduleplugin/plugin.2.1/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/plugin.2/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/plugin/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/pluginMixed/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/pluginVersion/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp | 4 ++-- .../qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp | 4 ++-- 55 files changed, 101 insertions(+), 55 deletions(-) create mode 100644 examples/declarative/cppextensions/imageprovider/imageprovider.json create mode 100644 examples/declarative/cppextensions/plugins/plugin.json create mode 100644 examples/declarative/cppextensions/qwidgets/qwidgets.json create mode 100644 examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json create mode 100644 examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json create mode 100644 examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json create mode 100644 src/imports/folderlistmodel/folderlistmodel.json create mode 100644 src/imports/gestures/gestures.json create mode 100644 src/imports/localstorage/localstorage.json create mode 100644 src/imports/shaders/shaders.json create mode 100644 src/imports/testlib/testlib.json create mode 100644 src/imports/xmllistmodel/xmllistmodel.json create mode 100644 src/plugins/accessible/quick/accessible.json create mode 100644 src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.json create mode 100644 src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.json create mode 100644 tests/auto/declarative/qdeclarativemoduleplugin/empty.json diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp index 94f85753ed..7fe4b72c08 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp @@ -87,6 +87,7 @@ class ColorImageProvider : public QDeclarativeImageProvider class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "imageprovider.json") public: void registerTypes(const char *uri) { @@ -101,7 +102,8 @@ class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin }; -#include "imageprovider.moc" -Q_EXPORT_PLUGIN(ImageProviderExtensionPlugin); +#define QDeclarativeExtensionInterface_iid "org.qt-project.Qt.QDeclarativeExtensionInterface" + +#include "imageprovider.moc" diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.json b/examples/declarative/cppextensions/imageprovider/imageprovider.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index cfa7923128..dd128d56a8 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -7,6 +7,8 @@ TARGET = qmlimageproviderplugin SOURCES += imageprovider.cpp +OTHER_FILES += imageprovider.json + sources.files = $$SOURCES imageprovider.qml imageprovider.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative/imageprovider diff --git a/examples/declarative/cppextensions/plugins/plugin.cpp b/examples/declarative/cppextensions/plugins/plugin.cpp index 6fbf962f4e..4ba0a928eb 100644 --- a/examples/declarative/cppextensions/plugins/plugin.cpp +++ b/examples/declarative/cppextensions/plugins/plugin.cpp @@ -141,6 +141,8 @@ MinuteTimer *TimeModel::timer=0; class QExampleQmlPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "plugin.json") + public: void registerTypes(const char *uri) { @@ -151,7 +153,3 @@ class QExampleQmlPlugin : public QDeclarativeExtensionPlugin //![plugin] #include "plugin.moc" - -//![export] -Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin); -//![export] diff --git a/examples/declarative/cppextensions/plugins/plugin.json b/examples/declarative/cppextensions/plugins/plugin.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/declarative/cppextensions/plugins/plugin.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/declarative/cppextensions/plugins/plugins.pro index bdcb62ca8a..a28582a07a 100644 --- a/examples/declarative/cppextensions/plugins/plugins.pro +++ b/examples/declarative/cppextensions/plugins/plugins.pro @@ -7,6 +7,8 @@ TARGET = qmlqtimeexampleplugin SOURCES += plugin.cpp +OTHER_FILES += "plugin.json" + qdeclarativesources.files += \ com/nokia/TimeExample/qmldir \ com/nokia/TimeExample/center.png \ diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.json b/examples/declarative/cppextensions/qwidgets/qwidgets.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h b/examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h index 6be8611dfd..f444d31f4e 100644 --- a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h +++ b/examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h @@ -46,11 +46,10 @@ class TextBalloonPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "textballoon.json") public: void registerTypes(const char *uri) { qmlRegisterType(uri, 1, 0, "TextBalloon"); } }; - -Q_EXPORT_PLUGIN2(qmltextballoonplugin, TextBalloonPlugin); diff --git a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json b/examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/painteditem/textballoons/textballoons.pro b/examples/declarative/painteditem/textballoons/textballoons.pro index 453a00336d..e0b9404f65 100644 --- a/examples/declarative/painteditem/textballoons/textballoons.pro +++ b/examples/declarative/painteditem/textballoons/textballoons.pro @@ -9,6 +9,8 @@ HEADERS += TextBalloonPlugin/plugin.h \ SOURCES += textballoon.cpp +OTHER_FILES += textballoon.json + DESTDIR = TextBalloonPlugin qdeclarativesources.files += \ diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp index 9c4027de8a..d75f810964 100644 --- a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp +++ b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp @@ -49,6 +49,5 @@ void ChartsPlugin::registerTypes(const char *uri) qmlRegisterType(uri, 1, 0, "PieSlice"); } -Q_EXPORT_PLUGIN2(chartsplugin, ChartsPlugin); //![0] diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h index bffcf000fd..863564b09c 100644 --- a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h +++ b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h @@ -46,6 +46,8 @@ class ChartsPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "chartsplugin.json") + public: void registerTypes(const char *uri); }; diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json @@ -0,0 +1 @@ +{} diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp index 6bc3d4d006..626ef93adc 100644 --- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp +++ b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp @@ -49,6 +49,3 @@ void DialogPlugin::registerTypes(const char *uri) qmlRegisterType(uri, 1, 0, "Directory"); qmlRegisterType(uri,1,0,"File"); } - -//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs -Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); \ No newline at end of file diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h index 03bdc1a6e4..7ad707f6d9 100644 --- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h +++ b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h @@ -46,6 +46,7 @@ class DialogPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "dialogplugin.json") public: //registerTypes is inherited from QDeclarativeExtensionPlugin diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json b/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json @@ -0,0 +1 @@ +{} diff --git a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h index aa1c8aa0f1..e78657a73d 100644 --- a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h +++ b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h @@ -75,7 +75,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugServerConnection virtual bool waitForMessage() = 0; }; -Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, "com.trolltech.Qt.QDeclarativeDebugServerConnection/1.0") +#define QDeclarativeDebugServerConnection_iid "org.qt-project.Qt.QDeclarativeDebugServerConnection" + +Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, QDeclarativeDebugServerConnection_iid) QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h index e109fc015e..adfd94333d 100644 --- a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h +++ b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h @@ -74,7 +74,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeInspectorInterface virtual void clientMessage(const QByteArray &message) = 0; }; -Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, "com.trolltech.Qt.QDeclarativeInspectorInterface/1.0") +#define QDeclarativeInspectorInterface_iid "org.qt-project.Qt." + +Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, QDeclarativeInspectorInterface_iid) QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h index fcfaa7c402..ce2560cec0 100644 --- a/src/declarative/qml/qdeclarativeextensioninterface.h +++ b/src/declarative/qml/qdeclarativeextensioninterface.h @@ -65,8 +65,13 @@ class Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface : public QDeclarativeT virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri) = 0; }; +#define QDeclarativeTypesExtensionInterface_iid "org.qt-project.Qt.QDeclarativeTypesExtensionInterface" + Q_DECLARE_INTERFACE(QDeclarativeTypesExtensionInterface, "org.qt-project.Qt.QDeclarativeTypesExtensionInterface/1.0") -Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, "org.qt-project.Qt.QDeclarativeExtensionInterface/1.0") + +#define QDeclarativeExtensionInterface_iid "org.qt-project.Qt.QDeclarativeExtensionInterface" + +Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, QDeclarativeExtensionInterface_iid) QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h b/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h index ed5e54f646..939c45b6d4 100644 --- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h +++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor_p.h @@ -66,7 +66,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueInterceptor virtual void setTarget(const QDeclarativeProperty &property) = 0; virtual void write(const QVariant &value) = 0; }; -Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, "com.trolltech.qml.QDeclarativePropertyValueInterceptor") + +#define QDeclarativePropertyValueInterceptor_iid "org.qt-project.Qt.QDeclarativePropertyValueInterceptor" + +Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, QDeclarativePropertyValueInterceptor_iid) QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.h b/src/declarative/qml/qdeclarativepropertyvaluesource.h index 4189cae345..d345319143 100644 --- a/src/declarative/qml/qdeclarativepropertyvaluesource.h +++ b/src/declarative/qml/qdeclarativepropertyvaluesource.h @@ -57,7 +57,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueSource virtual ~QDeclarativePropertyValueSource(); virtual void setTarget(const QDeclarativeProperty &) = 0; }; -Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, "com.trolltech.qml.QDeclarativePropertyValueSource") + +#define QDeclarativePropertyValueSource_iid "org.qt-project.Qt.QDeclarativePropertyValueSource" + +Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, QDeclarativePropertyValueSource_iid) QT_END_NAMESPACE diff --git a/src/imports/folderlistmodel/folderlistmodel.json b/src/imports/folderlistmodel/folderlistmodel.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/folderlistmodel/folderlistmodel.json @@ -0,0 +1 @@ +{} diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index 48d7b5b7cb..767f8f6c68 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "folderlistmodel.json") + public: virtual void registerTypes(const char *uri) { @@ -64,8 +66,3 @@ class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin QT_END_NAMESPACE #include "plugin.moc" - -//![plugin export decl] -Q_EXPORT_PLUGIN2(qmlfolderlistmodelplugin, QT_PREPEND_NAMESPACE(QmlFolderListModelPlugin)); -//![plugin export decl] - diff --git a/src/imports/gestures/gestures.json b/src/imports/gestures/gestures.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/gestures/gestures.json @@ -0,0 +1 @@ +{} diff --git a/src/imports/localstorage/localstorage.json b/src/imports/localstorage/localstorage.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/localstorage/localstorage.json @@ -0,0 +1 @@ +{} diff --git a/src/imports/localstorage/localstorage.pro b/src/imports/localstorage/localstorage.pro index 51a69aac4f..5164e8870d 100644 --- a/src/imports/localstorage/localstorage.pro +++ b/src/imports/localstorage/localstorage.pro @@ -6,10 +6,12 @@ QT += sql declarative declarative-private v8-private core-private SOURCES += plugin.cpp +OTHER_FILES += localstorage.json + DESTDIR = $$QT.declarative.imports/$$TARGETPATH target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH -INSTALLS += target qmldir \ No newline at end of file +INSTALLS += target qmldir diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index dd747d0d09..0ab47c1428 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -651,6 +651,8 @@ static QObject *module_api_factory(QDeclarativeEngine *engine, QJSEngine *script class QDeclarativeLocalStoragePlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "localstorage.json") + public: QDeclarativeLocalStoragePlugin() { @@ -664,5 +666,3 @@ class QDeclarativeLocalStoragePlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, QDeclarativeLocalStoragePlugin); diff --git a/src/imports/shaders/shaders.json b/src/imports/shaders/shaders.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/shaders/shaders.json @@ -0,0 +1 @@ +{} diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 672de10639..ec32d7c9ab 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -135,6 +135,8 @@ QT_BEGIN_NAMESPACE class QTestQmlModule : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "testlib.json") + public: virtual void registerTypes(const char *uri) { @@ -152,5 +154,3 @@ class QTestQmlModule : public QDeclarativeExtensionPlugin QT_END_NAMESPACE #include "main.moc" - -Q_EXPORT_PLUGIN2(qmltestplugin, QT_PREPEND_NAMESPACE(QTestQmlModule)) diff --git a/src/imports/testlib/testlib.json b/src/imports/testlib/testlib.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/testlib/testlib.json @@ -0,0 +1 @@ +{} diff --git a/src/imports/testlib/testlib.pro b/src/imports/testlib/testlib.pro index 3b8a5bf75e..7e8f601468 100644 --- a/src/imports/testlib/testlib.pro +++ b/src/imports/testlib/testlib.pro @@ -7,7 +7,8 @@ CONFIG += qt plugin QT += declarative quick qmltest qmltest-private v8-private declarative-private core-private testlib SOURCES += main.cpp -HEADERS += + +OTHER_FILES += testlib.json DESTDIR = $$QT.declarative.imports/$$TARGETPATH diff --git a/src/imports/xmllistmodel/plugin.cpp b/src/imports/xmllistmodel/plugin.cpp index 9085a60885..07f59b846a 100644 --- a/src/imports/xmllistmodel/plugin.cpp +++ b/src/imports/xmllistmodel/plugin.cpp @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE class QmlXmlListModelPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "xmllistmodel.json") + public: virtual void registerTypes(const char *uri) { @@ -61,5 +63,3 @@ class QmlXmlListModelPlugin : public QDeclarativeExtensionPlugin QT_END_NAMESPACE #include "plugin.moc" - -Q_EXPORT_PLUGIN2(qmlxmllistmodelplugin, QT_PREPEND_NAMESPACE(QmlXmlListModelPlugin)); diff --git a/src/imports/xmllistmodel/xmllistmodel.json b/src/imports/xmllistmodel/xmllistmodel.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/imports/xmllistmodel/xmllistmodel.json @@ -0,0 +1 @@ +{} diff --git a/src/plugins/accessible/quick/accessible.json b/src/plugins/accessible/quick/accessible.json new file mode 100644 index 0000000000..845a45aa78 --- /dev/null +++ b/src/plugins/accessible/quick/accessible.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QQuickView", "QQuickItem" ] +} diff --git a/src/plugins/accessible/quick/main.cpp b/src/plugins/accessible/quick/main.cpp index 08a5fe546b..af9555c690 100644 --- a/src/plugins/accessible/quick/main.cpp +++ b/src/plugins/accessible/quick/main.cpp @@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE class AccessibleQuickFactory : public QAccessiblePlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QAccessibleFactoryInterface" FILE "accessible.json") + public: AccessibleQuickFactory(); @@ -105,9 +108,8 @@ QAccessibleInterface *AccessibleQuickFactory::create(const QString &classname, Q return 0; } -Q_EXPORT_STATIC_PLUGIN(AccessibleQuickFactory) -Q_EXPORT_PLUGIN2(qtaccessiblequick, AccessibleQuickFactory) - QT_END_NAMESPACE +#include "main.moc" + #endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/quick/quick.pro b/src/plugins/accessible/quick/quick.pro index 97a1d50098..add275a815 100644 --- a/src/plugins/accessible/quick/quick.pro +++ b/src/plugins/accessible/quick/quick.pro @@ -19,5 +19,7 @@ SOURCES += \ HEADERS += \ qaccessiblequickview.h \ qaccessiblequickitem.h + +OTHERFILES += accessible.json } diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro index b9c6584afc..24efee8725 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro @@ -27,5 +27,7 @@ HEADERS += \ ../shared/qdeclarativeinspectorprotocol.h \ ../shared/qmlinspectorconstants.h +OTHER_FILES += qtquick2plugin.json + target.path += $$[QT_INSTALL_PLUGINS]/qmltooling INSTALLS += target diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp index 206d0b2eb9..1245a7e690 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp @@ -84,5 +84,3 @@ void QtQuick2Plugin::clientMessage(const QByteArray &message) } // namespace QtQuick2 } // namespace QmlJSDebugger - -Q_EXPORT_PLUGIN2(qmldbg_qtquick2, QmlJSDebugger::QtQuick2::QtQuick2Plugin) diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h index d0f814c03c..f6f668d6b4 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h @@ -55,6 +55,7 @@ class QtQuick2Plugin : public QObject, public QDeclarativeInspectorInterface { Q_OBJECT Q_DISABLE_COPY(QtQuick2Plugin) + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeInspectorInterface" FILE "qtquick2plugin.json") Q_INTERFACES(QDeclarativeInspectorInterface) public: diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.json b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.json new file mode 100644 index 0000000000..311847daa5 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.json @@ -0,0 +1,2 @@ +{} + diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro index 8ab507c055..075cc49ae5 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro +++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro @@ -14,5 +14,7 @@ SOURCES += \ HEADERS += \ qtcpserverconnection.h +OTHER_FILES += qtcpserverconnection.json + target.path += $$[QT_INSTALL_PLUGINS]/qmltooling INSTALLS += target diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp index 529d2094bf..216c2c30b1 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -193,7 +193,5 @@ void QTcpServerConnection::invalidPacket() qWarning("QDeclarativeDebugServer: Received a corrupted packet! Giving up ..."); } -Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) - QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h index f090c9709f..1154a0aa25 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h @@ -54,9 +54,9 @@ class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConne Q_OBJECT Q_DECLARE_PRIVATE(QTcpServerConnection) Q_DISABLE_COPY(QTcpServerConnection) + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeDebugServerConnection" FILE "qtcpserverconnection.json") Q_INTERFACES(QDeclarativeDebugServerConnection) - public: QTcpServerConnection(); ~QTcpServerConnection(); diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.json b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.json @@ -0,0 +1 @@ +{} diff --git a/src/quick/items/qquickvisualadaptormodel_p.h b/src/quick/items/qquickvisualadaptormodel_p.h index 9ae8325450..e431f3aa26 100644 --- a/src/quick/items/qquickvisualadaptormodel_p.h +++ b/src/quick/items/qquickvisualadaptormodel_p.h @@ -121,7 +121,9 @@ class QQuickVisualAdaptorModelProxyInterface virtual QObject *proxiedObject() = 0; }; -Q_DECLARE_INTERFACE(QQuickVisualAdaptorModelProxyInterface, "com.trolltech.qml.QQuickVisualAdaptorModelProxyInterface") +#define QQuickVisualAdaptorModelProxyInterface_iid "org.qt-project.Qt.QQuickVisualAdaptorModelProxyInterface" + +Q_DECLARE_INTERFACE(QQuickVisualAdaptorModelProxyInterface, QQuickVisualAdaptorModelProxyInterface_iid) QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h index 081e64ecdd..6080c8b394 100644 --- a/src/quick/scenegraph/qsgcontextplugin_p.h +++ b/src/quick/scenegraph/qsgcontextplugin_p.h @@ -62,7 +62,7 @@ struct Q_QUICK_EXPORT QSGContextFactoryInterface : public QFactoryInterface }; #define QSGContextFactoryInterface_iid \ - "com.trolltech.Qt.QSGContextFactoryInterface" + "org.qt-project.Qt.QSGContextFactoryInterface" Q_DECLARE_INTERFACE(QSGContextFactoryInterface, QSGContextFactoryInterface_iid) class Q_QUICK_EXPORT QSGContextPlugin : public QObject, public QSGContextFactoryInterface diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 4a37139056..ec0c185123 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -67,7 +67,8 @@ class MyInterface }; QT_BEGIN_NAMESPACE -Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface"); +#define MyInterface_iid "org.qt-project.Qt.Test.MyInterface" +Q_DECLARE_INTERFACE(MyInterface, MyInterface_iid); QT_END_NAMESPACE QML_DECLARE_INTERFACE(MyInterface); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/empty.json b/tests/auto/declarative/qdeclarativemoduleplugin/empty.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/empty.json @@ -0,0 +1 @@ +{} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp index 27e0beb4be..a8a0f69a3a 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp @@ -66,6 +66,8 @@ class MyPluginType : public QObject class MyPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyPlugin() { @@ -80,5 +82,3 @@ class MyPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp index 904664ee0e..c67b5b1b63 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp @@ -66,6 +66,8 @@ class MyPluginType : public QObject class MyPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyPlugin() { @@ -80,5 +82,3 @@ class MyPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp index 267535dd74..869630bd63 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp @@ -65,6 +65,8 @@ class MyPluginType : public QObject class MyPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyPlugin() { @@ -79,5 +81,3 @@ class MyPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp index 0052c6ee53..51e48781f6 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp @@ -56,6 +56,8 @@ class BarPluginType : public QObject class MyMixedPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyMixedPlugin() { @@ -69,5 +71,3 @@ class MyMixedPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp index 6fc6eee1c7..ab8b3d479e 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp @@ -56,6 +56,8 @@ class FloorPluginType : public QObject class MyMixedPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyMixedPlugin() { @@ -69,5 +71,3 @@ class MyMixedPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp index 7cb0365abe..88b807e14d 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp @@ -46,6 +46,8 @@ class MyPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: void registerTypes(const char *uri) { @@ -54,5 +56,3 @@ class MyPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp index 2446c93bf9..fe110a28d4 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp @@ -65,6 +65,8 @@ class MyPluginType : public QObject class MyPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "../empty.json") + public: MyPlugin() { @@ -79,5 +81,3 @@ class MyPlugin : public QDeclarativeExtensionPlugin }; #include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); From 7e76d66f526de98804f01771ca0fea1ade7b6677 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 23 Feb 2012 08:51:36 +0000 Subject: [PATCH 10/82] Fix crash in instruction dump Change-Id: I2cfa9da120a602b52f401dd304b44cd17c47b220 Reviewed-by: Alan Alpert Reviewed-by: Roberto Raggi --- src/declarative/qml/qdeclarativeinstruction.cpp | 4 ++-- .../qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 799357cf04..8c9198007e 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -190,7 +190,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; break; case QDeclarativeInstruction::StoreSignal: - qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); + qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value; break; case QDeclarativeInstruction::StoreImportedScript: qWarning().nospace() << idx << "\t\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value; @@ -199,7 +199,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope << "\t" << instr->storeScriptString.bindingId; break; case QDeclarativeInstruction::AssignSignalObject: - qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << primitives.at(instr->assignSignalObject.signal); + qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal; break; case QDeclarativeInstruction::AssignCustomType: qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.primitive << "\t" << instr->assignCustomType.type; diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index 072718a95c..769d385efc 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -499,9 +499,9 @@ void tst_qdeclarativeinstruction::dump() << "24\t\tSTORE_OBJECT\t\t21" << "25\t\tSTORE_VARIANT_OBJECT\t22" << "26\t\tSTORE_INTERFACE\t\t23" - << "27\t\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\"" + << "27\t\tSTORE_SIGNAL\t\t2\t3" << "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1\t4" - << "29\t\tASSIGN_SIGNAL_OBJECT\t4\t\t\t\"mySignal\"" + << "29\t\tASSIGN_SIGNAL_OBJECT\t4" << "30\t\tASSIGN_CUSTOMTYPE\t25\t6\t9" << "31\t\tSTORE_BINDING\t26\t3\t2" << "32\t\tSTORE_COMPILED_BINDING\t27\t2\t4" From 212204b4fff05aed43a931e71855948ec9910b59 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 20 Feb 2012 14:46:26 +0100 Subject: [PATCH 11/82] Fix rewrite of multiline string literals. This commits ensures that we don't rewrite `\'-terminated multiline string literals. Also, it fixes the processing of \r characters inside the string literals. Change-Id: If3d7c1b83c7306b9ccb1be31412b6f8e76434c41 Reviewed-by: Oswald Buddenhagen Reviewed-by: Aaron Kennedy --- .gitattributes | 1 + src/declarative/qml/qdeclarativerewrite.cpp | 123 ++++++++---------- src/declarative/qml/qdeclarativerewrite_p.h | 5 +- .../data/rewriteMultiLineStrings_crlf.1.qml | 13 ++ .../tst_qdeclarativeecmascript.cpp | 23 ++-- 5 files changed, 85 insertions(+), 80 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/rewriteMultiLineStrings_crlf.1.qml diff --git a/.gitattributes b/.gitattributes index a3c6108370..157176bdb8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ .tag ident +*_crlf.* eol=crlf diff --git a/src/declarative/qml/qdeclarativerewrite.cpp b/src/declarative/qml/qdeclarativerewrite.cpp index 77da943704..688e75a325 100644 --- a/src/declarative/qml/qdeclarativerewrite.cpp +++ b/src/declarative/qml/qdeclarativerewrite.cpp @@ -51,6 +51,45 @@ DEFINE_BOOL_CONFIG_OPTION(rewriteDump, QML_REWRITE_DUMP); namespace QDeclarativeRewrite { +static void rewriteStringLiteral(AST::StringLiteral *ast, const QString *code, int startPosition, TextWriter *writer) +{ + const unsigned position = ast->firstSourceLocation().begin() - startPosition + 1; + const unsigned length = ast->literalToken.length - 2; + const QStringRef spell = code->midRef(position, length); + const int end = spell.size(); + int index = 0; + + while (index < end) { + const QChar ch = spell.at(index++); + + if (index < end && ch == QLatin1Char('\\')) { + int pos = index; + + // skip a possibly empty sequence of \r characters + while (pos < end && spell.at(pos) == QLatin1Char('\r')) + ++pos; + + if (pos < end && spell.at(pos) == QLatin1Char('\n')) { + // This is a `\' followed by a newline terminator. + // In this case there's nothing to replace. We keep the code + // as it is and we resume the searching. + index = pos + 1; // refresh the index + } + } else if (ch == QLatin1Char('\r') || ch == QLatin1Char('\n')) { + const QString sep = ch == QLatin1Char('\r') ? QLatin1String("\\r") : QLatin1String("\\n"); + const int pos = index - 1; + QString s = sep; + + while (index < end && spell.at(index) == ch) { + s += sep; + ++index; + } + + writer->replace(position + pos, index - pos, s); + } + } +} + bool SharedBindingTester::isSharable(const QString &code) { Engine engine; @@ -204,40 +243,7 @@ bool RewriteBinding::visit(AST::ExpressionStatement *ast) bool RewriteBinding::visit(AST::StringLiteral *ast) { - /* When rewriting the code for bindings, we have to remove ILLEGAL JS tokens like newlines. - They're still in multi-line strings, because the QML parser allows them, but we have to - rewrite them to be JS compliant. - - For performance reasons, we don't go for total correctness. \r is only replaced if a - \n was found (since most line endings are \n or \r\n) and QChar::LineSeparator is not - even considered. QTBUG-24064. - - Note that rewriteSignalHandler has a function just like this one, for the same reason. - */ - - unsigned startOfString = ast->firstSourceLocation().begin() + 1 - _position; - unsigned stringLength = ast->firstSourceLocation().length - 2; - - int lastIndex = -1; - bool foundNewLine = false; - QStringRef subStr(_code, startOfString, stringLength); - while (true) { - lastIndex = subStr.indexOf(QLatin1Char('\n'), lastIndex + 1); - if (lastIndex == -1) - break; - foundNewLine = true; - _writer->replace(startOfString+lastIndex, 1, QLatin1String("\\n")); - } - - if (foundNewLine) { - while (true) { - lastIndex = subStr.indexOf(QLatin1Char('\r'), lastIndex + 1); - if (lastIndex == -1) - break; - _writer->replace(startOfString+lastIndex, 1, QLatin1String("\\r")); - } - } - + rewriteStringLiteral(ast, _code, _position, _writer); return false; } @@ -361,6 +367,13 @@ void RewriteBinding::rewriteCaseStatements(AST::StatementList *statements, bool } } +RewriteSignalHandler::RewriteSignalHandler() + : _writer(0) + , _code(0) + , _position(0) +{ +} + void RewriteSignalHandler::accept(AST::Node *node) { AST::Node::acceptChild(node, this); @@ -368,42 +381,10 @@ void RewriteSignalHandler::accept(AST::Node *node) bool RewriteSignalHandler::visit(AST::StringLiteral *ast) { - unsigned startOfExpressionStatement = ast->firstSourceLocation().begin() - _position; - _strStarts << startOfExpressionStatement + 1; - _strLens << ast->firstSourceLocation().length - 2; - + rewriteStringLiteral(ast, _code, _position, _writer); return false; } -void RewriteSignalHandler::rewriteMultilineStrings(QString &code) -{ - QList replaceR, replaceN; - for (int i=0; i < _strStarts.count(); i++) { - QStringRef curSubstr = QStringRef(&code, _strStarts[i], _strLens[i]); - int lastIndex = -1; - while (true) { - lastIndex = curSubstr.indexOf(QLatin1Char('\n'), lastIndex + 1); - if (lastIndex == -1) - break; - replaceN << _strStarts[i]+lastIndex; - } - - if (replaceN.count()) { - while (true) { - lastIndex = curSubstr.indexOf(QLatin1Char('\r'), lastIndex + 1); - if (lastIndex == -1) - break; - replaceR << _strStarts[i]+lastIndex; - } - } - } - for (int ii = replaceN.count() - 1; ii >= 0; ii--) - code.replace(replaceN[ii], 1, QLatin1String("\\n")); - if (replaceR.count()) - for (int ii = replaceR.count() - 1; ii >= 0; ii--) - code.replace(replaceR[ii], 1, QLatin1String("\\r")); -} - QString RewriteSignalHandler::operator()(QDeclarativeJS::AST::Node *node, const QString &code, const QString &name) { if (rewriteDump()) { @@ -417,13 +398,15 @@ QString RewriteSignalHandler::operator()(QDeclarativeJS::AST::Node *node, const if (!expression && !statement) return code; - _strStarts.clear(); - _strLens.clear(); + TextWriter w; + _writer = &w; + _code = &code; + _position = expression ? expression->firstSourceLocation().begin() : statement->firstSourceLocation().begin(); accept(node); QString rewritten = code; - rewriteMultilineStrings(rewritten); + w.write(&rewritten); rewritten = QStringLiteral("(function ") + name + QStringLiteral("() { ") + rewritten + QStringLiteral(" })"); diff --git a/src/declarative/qml/qdeclarativerewrite_p.h b/src/declarative/qml/qdeclarativerewrite_p.h index 74c408cd21..7d73e6a132 100644 --- a/src/declarative/qml/qdeclarativerewrite_p.h +++ b/src/declarative/qml/qdeclarativerewrite_p.h @@ -126,11 +126,12 @@ class RewriteBinding: protected AST::Visitor class RewriteSignalHandler: protected AST::Visitor { - QList _strStarts; - QList _strLens; + TextWriter *_writer; + const QString *_code; int _position; public: + RewriteSignalHandler(); QString operator()(QDeclarativeJS::AST::Node *node, const QString &code, const QString &name); protected: diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/rewriteMultiLineStrings_crlf.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/rewriteMultiLineStrings_crlf.1.qml new file mode 100644 index 0000000000..f84ba8c722 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/rewriteMultiLineStrings_crlf.1.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Rectangle { + id: root + + Component.onCompleted: { + var o = Qt.createQmlObject("import QtQuick 2.0; \ + \ + Item { \ + property bool b: true; \ + }", root, "Instance") + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index d30766f982..cc94e6fb4a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1570,8 +1570,6 @@ void tst_qdeclarativeecmascript::compileInvalidBinding() { // QTBUG-23387: ensure that invalid bindings don't cause a crash. QDeclarativeComponent component(&engine, testFileUrl("v8bindingException.qml")); - QString warning = component.url().toString() + ":16: SyntaxError: Unexpected token ILLEGAL"; - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); QVERIFY(object != 0); delete object; @@ -5287,12 +5285,21 @@ void tst_qdeclarativeecmascript::qtbug_21864() void tst_qdeclarativeecmascript::rewriteMultiLineStrings() { - // QTBUG-23387 - QDeclarativeComponent component(&engine, testFileUrl("rewriteMultiLineStrings.qml")); - QObject *o = component.create(); - QVERIFY(o != 0); - QTRY_COMPARE(o->property("test").toBool(), true); - delete o; + { + // QTBUG-23387 + QDeclarativeComponent component(&engine, testFileUrl("rewriteMultiLineStrings.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QTRY_COMPARE(o->property("test").toBool(), true); + delete o; + } + + { + QDeclarativeComponent component(&engine, testFileUrl("rewriteMultiLineStrings_crlf.1.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + delete o; + } } void tst_qdeclarativeecmascript::qobjectConnectionListExceptionHandling() From 8efc0ba05023654b6640a6050a4952becca4d68f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 00:34:32 +0100 Subject: [PATCH 12/82] Remove use of QT_ASCII_CAST_WARN_CONSTRUCTOR. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes build after I0b4df4c99600cacbaafbf0bc4270cd4978600956 Change-Id: I9cf326b52e0e7e267b8fbc422175713cee9352f5 Reviewed-by: Jędrzej Nowacki --- src/declarative/qml/v8/qjsvalue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h index bfe0ec0951..07fe3dcfac 100644 --- a/src/declarative/qml/v8/qjsvalue.h +++ b/src/declarative/qml/v8/qjsvalue.h @@ -68,7 +68,7 @@ class Q_DECLARATIVE_EXPORT QJSValue QJSValue(const QString &value); QJSValue(const QLatin1String &value); #ifndef QT_NO_CAST_FROM_ASCII - QT_ASCII_CAST_WARN_CONSTRUCTOR QJSValue(const char *str); + QT_ASCII_CAST_WARN QJSValue(const char *str); #endif QJSValue &operator=(const QJSValue &other); From 5fee1e79cc1c18acf58f9171a73a7525154a65cd Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 23 Feb 2012 14:11:48 +1000 Subject: [PATCH 13/82] Use floating point types for position offsets and cursorRectangle. Rounding to align painting to pixel boundaries is no longer necessary are largely removed. Correct the few instances remaining in TextEdit and TextInput. Change-Id: Ic6ec57092d74ec43b23d85cd8868e0190acc3e09 Reviewed-by: Yann Bodson --- src/quick/items/qquicktextedit.cpp | 22 +++--- src/quick/items/qquicktextedit_p.h | 6 +- src/quick/items/qquicktextedit_p_p.h | 8 +- src/quick/items/qquicktextinput.cpp | 42 +++++----- src/quick/items/qquicktextinput_p.h | 4 +- src/quick/items/qquicktextinput_p_p.h | 13 ++-- .../qquicktextedit/tst_qquicktextedit.cpp | 38 ++++----- .../qquicktextinput/tst_qquicktextinput.cpp | 77 +++++++++---------- 8 files changed, 102 insertions(+), 108 deletions(-) diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 06264715a1..66285fcd2b 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -732,10 +732,10 @@ QRectF QQuickTextEdit::positionToRectangle(int pos) const Position 0 is before the first character, position 1 is after the first character but before the second, and so on until position \l {text}.length, which is after all characters. */ -int QQuickTextEdit::positionAt(int x, int y) const +int QQuickTextEdit::positionAt(qreal x, qreal y) const { Q_D(const QQuickTextEdit); - int r = d->document->documentLayout()->hitTest(QPoint(x,y-d->yoff), Qt::FuzzyHit); + int r = d->document->documentLayout()->hitTest(QPointF(x,y-d->yoff), Qt::FuzzyHit); QTextCursor cursor = d->control->textCursor(); if (r > cursor.position()) { // The cursor position includes positions within the preedit text, but only positions in the @@ -1290,10 +1290,10 @@ Qt::TextInteractionFlags QQuickTextEdit::textInteractionFlags() const automatically when it changes. The width of the delegate is unaffected by changes in the cursor rectangle. */ -QRect QQuickTextEdit::cursorRectangle() const +QRectF QQuickTextEdit::cursorRectangle() const { Q_D(const QQuickTextEdit); - return d->control->cursorRect().toRect().translated(0,d->yoff); + return d->control->cursorRect().translated(0, d->yoff); } bool QQuickTextEdit::event(QEvent *event) @@ -1863,11 +1863,11 @@ void QQuickTextEdit::updateSize() } else { d->document->setTextWidth(-1); } - QFontMetrics fm = QFontMetrics(d->font); - int dy = height(); - dy -= (int)d->document->size().height(); + QFontMetricsF fm(d->font); + qreal dy = height(); + dy -= d->document->size().height(); - int nyoff; + qreal nyoff; if (heightValid()) { if (d->vAlign == AlignBottom) nyoff = dy; @@ -1883,7 +1883,7 @@ void QQuickTextEdit::updateSize() setBaselineOffset(fm.ascent() + d->yoff + d->textMargin); //### need to comfirm cost of always setting these - int newWidth = qCeil(d->document->idealWidth()); + qreal newWidth = d->document->idealWidth(); if (!widthValid() && d->document->textWidth() != newWidth) d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug) // ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed. @@ -1892,13 +1892,13 @@ void QQuickTextEdit::updateSize() iWidth = newWidth; else if (d->requireImplicitWidth) iWidth = naturalWidth; - qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height(); + qreal newHeight = d->document->isEmpty() ? fm.height() : d->document->size().height(); if (iWidth > -1) setImplicitSize(iWidth, newHeight); else setImplicitHeight(newHeight); - QSize size(newWidth, newHeight); + QSizeF size(newWidth, newHeight); if (d->contentSize != size) { d->contentSize = size; emit contentSizeChanged(); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 5f6317ab09..b3fd32af69 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -79,7 +79,7 @@ class Q_AUTOTEST_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) + Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) Q_PROPERTY(QDeclarativeComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged) Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged) @@ -212,7 +212,7 @@ class Q_AUTOTEST_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem void setTextInteractionFlags(Qt::TextInteractionFlags flags); Qt::TextInteractionFlags textInteractionFlags() const; - QRect cursorRectangle() const; + QRectF cursorRectangle() const; QVariant inputMethodQuery(Qt::InputMethodQuery property) const; @@ -224,7 +224,7 @@ class Q_AUTOTEST_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem void resetBaseUrl(); Q_INVOKABLE QRectF positionToRectangle(int) const; - Q_INVOKABLE int positionAt(int x, int y) const; + Q_INVOKABLE int positionAt(qreal x, qreal y) const; Q_INVOKABLE void moveCursorSelection(int pos); Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode); diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index 1497c207ee..8ec589da29 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -69,8 +69,8 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate public: QQuickTextEditPrivate() : color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF)) - , textMargin(0.0), font(sourceFont), cursorComponent(0), cursor(0), document(0), control(0) - , lastSelectionStart(0), lastSelectionEnd(0), lineCount(0), yoff(0) + , textMargin(0.0), yoff(0), font(sourceFont), cursorComponent(0), cursor(0), document(0), control(0) + , lastSelectionStart(0), lastSelectionEnd(0), lineCount(0) , hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop) , format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap) , mouseSelectionMode(QQuickTextEdit::SelectCharacters), inputMethodHints(Qt::ImhNone) @@ -98,9 +98,10 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate QColor selectionColor; QColor selectedTextColor; - QSize contentSize; + QSizeF contentSize; qreal textMargin; + qreal yoff; QString text; QUrl baseUrl; @@ -115,7 +116,6 @@ class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate int lastSelectionStart; int lastSelectionEnd; int lineCount; - int yoff; enum UpdateType { UpdateNone, diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 9b11e2e43a..6f079dc045 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -677,7 +677,7 @@ void QQuickTextInput::setCursorPosition(int cp) cursor rectangle. */ -QRect QQuickTextInput::cursorRectangle() const +QRectF QQuickTextInput::cursorRectangle() const { Q_D(const QQuickTextInput); @@ -688,12 +688,8 @@ QRect QQuickTextInput::cursorRectangle() const c = 0; QTextLine l = d->m_textLayout.lineForTextPosition(c); if (!l.isValid()) - return QRect(); - return QRect( - qRound(l.cursorToX(c) - d->hscroll), - qRound(l.y() - d->vscroll), - 1, - qCeil(l.height())); + return QRectF(); + return QRectF(l.cursorToX(c) - d->hscroll, l.y() - d->vscroll, 1, l.height()); } /*! @@ -1368,7 +1364,7 @@ void QQuickTextInput::positionAt(QDeclarativeV8Function *args) const args->returnValue(v8::Int32::New(pos)); } -int QQuickTextInputPrivate::positionAt(int x, int y, QTextLine::CursorPosition position) const +int QQuickTextInputPrivate::positionAt(qreal x, qreal y, QTextLine::CursorPosition position) const { x += hscroll; y += vscroll; @@ -1432,7 +1428,7 @@ void QQuickTextInput::mouseDoubleClickEvent(QMouseEvent *event) d->selectWordAtPos(cursor); event->setAccepted(true); if (!d->hasPendingTripleClick()) { - d->tripleClickStartPoint = event->localPos().toPoint(); + d->tripleClickStartPoint = event->localPos(); d->tripleClickTimer.start(); } } else { @@ -1617,15 +1613,15 @@ void QQuickTextInputPrivate::updateHorizontalScroll() Q_Q(QQuickTextInput); QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor + m_preeditCursor); const int preeditLength = m_textLayout.preeditAreaText().length(); - const int width = qMax(0, qFloor(q->width())); - int widthUsed = currentLine.isValid() ? qRound(currentLine.naturalTextWidth()) : 0; + const qreal width = qMax(0, q->width()); + qreal widthUsed = currentLine.isValid() ? currentLine.naturalTextWidth() : 0; int previousScroll = hscroll; if (!autoScroll || widthUsed <= width || m_echoMode == QQuickTextInput::NoEcho) { hscroll = 0; } else { Q_ASSERT(currentLine.isValid()); - int cix = qRound(currentLine.cursorToX(m_cursor + preeditLength)); + qreal cix = currentLine.cursorToX(m_cursor + preeditLength); if (cix - hscroll >= width) { // text doesn't fit, cursor is to the right of br (scroll right) hscroll = cix - width; @@ -1640,7 +1636,7 @@ void QQuickTextInputPrivate::updateHorizontalScroll() if (preeditLength > 0) { // check to ensure long pre-edit text doesn't push the cursor // off to the left - cix = qRound(currentLine.cursorToX(m_cursor + qMax(0, m_preeditCursor - 1))); + cix = currentLine.cursorToX(m_cursor + qMax(0, m_preeditCursor - 1)); if (cix < hscroll) hscroll = cix; } @@ -1653,9 +1649,9 @@ void QQuickTextInputPrivate::updateVerticalScroll() { Q_Q(QQuickTextInput); const int preeditLength = m_textLayout.preeditAreaText().length(); - const int height = qMax(0, qFloor(q->height())); - int heightUsed = boundingRect.height(); - int previousScroll = vscroll; + const qreal height = qMax(0, q->height()); + qreal heightUsed = boundingRect.height(); + qreal previousScroll = vscroll; if (!autoScroll || heightUsed <= height) { // text fits in br; use vscroll for alignment @@ -1674,8 +1670,8 @@ void QQuickTextInputPrivate::updateVerticalScroll() } else { QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor + preeditLength); QRectF r = currentLine.isValid() ? currentLine.rect() : QRectF(); - int top = qFloor(r.top()); - int bottom = qCeil(r.bottom()); + qreal top = r.top(); + int bottom = r.bottom(); if (bottom - vscroll >= height) { // text doesn't fit, cursor is to the below the br (scroll down) @@ -1692,7 +1688,7 @@ void QQuickTextInputPrivate::updateVerticalScroll() // check to ensure long pre-edit text doesn't push the cursor // off the top currentLine = m_textLayout.lineForTextPosition(m_cursor + qMax(0, m_preeditCursor - 1)); - top = currentLine.isValid() ? qRound(currentLine.rect().top()) : 0; + top = currentLine.isValid() ? currentLine.rect().top() : 0; if (top < vscroll) vscroll = top; } @@ -1742,11 +1738,11 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData node->deleteContent(); node->setMatrix(QMatrix4x4()); - QPoint offset = QPoint(0,0); + QPointF offset(0, 0); if (d->autoScroll && d->m_textLayout.lineCount() > 0) { - QFontMetrics fm = QFontMetrics(d->font); + QFontMetricsF fm(d->font); // the y offset is there to keep the baseline constant in case we have script changes in the text. - offset = -QPoint(d->hscroll, d->vscroll + qRound(d->m_textLayout.lineAt(0).ascent()) - fm.ascent()); + offset = -QPoint(d->hscroll, d->vscroll + d->m_textLayout.lineAt(0).ascent() - fm.ascent()); } else { offset = -QPoint(d->hscroll, d->vscroll); } @@ -2732,7 +2728,7 @@ void QQuickTextInputPrivate::updateLayout() updateType = UpdatePaintNode; q->update(); - q->setImplicitSize(qCeil(boundingRect.width()), qCeil(boundingRect.height())); + q->setImplicitSize(boundingRect.width(), boundingRect.height()); if (previousRect != boundingRect) emit q->contentSizeChanged(); diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 0e60cf6ce4..ebd3d58957 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -76,7 +76,7 @@ class Q_AUTOTEST_EXPORT QQuickTextInput : public QQuickImplicitSizeItem Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) + Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged) Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged) @@ -195,7 +195,7 @@ class Q_AUTOTEST_EXPORT QQuickTextInput : public QQuickImplicitSizeItem int cursorPosition() const; void setCursorPosition(int cp); - QRect cursorRectangle() const; + QRectF cursorRectangle() const; int selectionStart() const; int selectionEnd() const; diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index e48b000e5c..1921451f88 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -77,14 +77,14 @@ class Q_AUTOTEST_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPr Q_DECLARE_PUBLIC(QQuickTextInput) public: QQuickTextInputPrivate() - : cursorItem(0) + : hscroll(0) + , vscroll(0) + , cursorItem(0) , textNode(0) , m_maskData(0) , color(QRgb(0xFF000000)) , selectionColor(QRgb(0xFF000080)) , selectedTextColor(QRgb(0xFFFFFFFF)) - , hscroll(0) - , vscroll(0) , m_cursor(0) , m_preeditCursor(0) , m_blinkPeriod(0) @@ -179,6 +179,9 @@ class Q_AUTOTEST_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPr QDeclarativeGuard m_validator; #endif + qreal hscroll; + qreal vscroll; + QTextLayout m_textLayout; QString m_text; QString m_inputMask; @@ -203,8 +206,6 @@ class Q_AUTOTEST_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPr #endif int lastSelectionStart; int lastSelectionEnd; - int hscroll; - int vscroll; int m_cursor; int m_preeditCursor; int m_blinkPeriod; // 0 for non-blinking cursor @@ -295,7 +296,7 @@ class Q_AUTOTEST_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPr int selectionStart() const { return hasSelectedText() ? m_selstart : -1; } int selectionEnd() const { return hasSelectedText() ? m_selend : -1; } - int positionAt(int x, int y, QTextLine::CursorPosition position) const; + int positionAt(qreal x, qreal y, QTextLine::CursorPosition position) const; int positionAt(const QPointF &point, QTextLine::CursorPosition position = QTextLine::CursorBetweenCharacters) const { return positionAt(point.x(), point.y(), position); } diff --git a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp index 62b85b8d24..e2673c1f17 100644 --- a/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/qtquick2/qquicktextedit/tst_qquicktextedit.cpp @@ -461,10 +461,10 @@ void tst_qquicktextedit::width() layout.endLayout(); - qreal metricWidth = ceil(layout.boundingRect().width()); + qreal metricWidth = layout.boundingRect().width(); QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(metricWidth)); + QCOMPARE(textEditObject->width(), metricWidth); } for (int i = 0; i < richText.size(); i++) @@ -475,7 +475,7 @@ void tst_qquicktextedit::width() if (requiresUnhintedMetrics) document.setUseDesignMetrics(true); - int documentWidth = ceil(document.idealWidth()); + qreal documentWidth = document.idealWidth(); QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.RichText; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); @@ -483,7 +483,7 @@ void tst_qquicktextedit::width() QQuickTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(documentWidth)); + QCOMPARE(textEditObject->width(), documentWidth); } } @@ -1843,8 +1843,8 @@ void tst_qquicktextedit::cursorDelegate() //Test Delegate gets moved for (int i=0; i<= textEditObject->text().length(); i++) { textEditObject->setCursorPosition(i); - QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); } // Clear preedit text; QInputMethodEvent event; @@ -1858,8 +1858,8 @@ void tst_qquicktextedit::cursorDelegate() QTest::mouseClick(&view, Qt::LeftButton, 0, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); - QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); // Test delegate gets moved on mouse drag textEditObject->setCursorPosition(0); @@ -1869,27 +1869,27 @@ void tst_qquicktextedit::cursorDelegate() QGuiApplication::sendEvent(&view, &mv); QTest::mouseRelease(&view, Qt::LeftButton, 0, point2); QTest::qWait(50); - QTRY_COMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QTRY_COMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); - QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setCursorPosition(0); QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); - QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setCursorPosition(0); - QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); //Test Delegate gets deleted textEditObject->setCursorDelegate(0); QVERIFY(!textEditObject->findChild("cursorInstance")); @@ -2582,14 +2582,14 @@ void tst_qquicktextedit::cursorRectangleSize() qApp->sendEvent(qApp->focusObject(), &event); QRectF cursorRectFromQuery = event.value(Qt::ImCursorRectangle).toRectF(); - QRect cursorRectFromItem = textEdit->cursorRectangle(); + QRectF cursorRectFromItem = textEdit->cursorRectangle(); QRectF cursorRectFromPositionToRectangle = textEdit->positionToRectangle(textEdit->cursorPosition()); // item and input query cursor rectangles match - QCOMPARE(cursorRectFromItem, cursorRectFromQuery.toRect()); + QCOMPARE(cursorRectFromItem, cursorRectFromQuery); // item cursor rectangle and positionToRectangle calculations match - QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle.toRect()); + QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle); // item-canvas transform and input item transform match QCOMPARE(QQuickItemPrivate::get(textEdit)->itemToCanvasTransform(), qApp->inputMethod()->inputItemTransform()); diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp index c1768bd98a..236b12002e 100644 --- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp @@ -2341,12 +2341,12 @@ void tst_qquicktextinput::cursorDelegate() //Test Delegate gets moved for (int i=0; i<= textInputObject->text().length(); i++) { textInputObject->setCursorPosition(i); - QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); } textInputObject->setCursorPosition(0); - QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x())); - QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y())); + QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); + QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); //Test Delegate gets deleted textInputObject->setCursorDelegate(0); QVERIFY(!textInputObject->findChild("cursorInstance")); @@ -2404,9 +2404,6 @@ void tst_qquicktextinput::cursorVisible() QCOMPARE(spy.count(), 7); } -static QRect round(const QRectF &r) { - return QRect(qRound(r.left()), qRound(r.top()), qCeil(r.width()), qCeil(r.height())); } - void tst_qquicktextinput::cursorRectangle() { @@ -2430,7 +2427,7 @@ void tst_qquicktextinput::cursorRectangle() input.setWidth(line.cursorToX(5, QTextLine::Leading)); input.setHeight(qCeil(line.height() * 3 / 2)); - QRect r; + QRectF r; // some tolerance for different fonts. #ifdef Q_OS_LINUX @@ -2445,28 +2442,28 @@ void tst_qquicktextinput::cursorRectangle() QVERIFY(r.left() < qCeil(line.cursorToX(i, QTextLine::Trailing))); QVERIFY(r.right() >= qFloor(line.cursorToX(i , QTextLine::Leading))); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } // Check the cursor rectangle remains within the input bounding rect when auto scrolling. - QVERIFY(r.left() < input.width()); + QVERIFY(r.left() < input.width() + error); QVERIFY(r.right() >= input.width() - error); for (int i = 6; i < text.length(); ++i) { input.setCursorPosition(i); QCOMPARE(r, input.cursorRectangle()); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } for (int i = text.length() - 2; i >= 0; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); - QCOMPARE(r.top(), 0); + QCOMPARE(r.top(), 0.); QVERIFY(r.right() >= 0); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } // Check position with word wrap. @@ -2478,24 +2475,24 @@ void tst_qquicktextinput::cursorRectangle() QVERIFY(r.left() < qCeil(line.cursorToX(i, QTextLine::Trailing))); QVERIFY(r.right() >= qFloor(line.cursorToX(i , QTextLine::Leading))); - QCOMPARE(r.top(), 0); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(r.top(), 0.); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } input.setCursorPosition(6); r = input.cursorRectangle(); - QCOMPARE(r.left(), 0); + QCOMPARE(r.left(), 0.); QVERIFY(r.top() > line.height() - error); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(6)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(6), r); for (int i = 7; i < text.length(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.top() > line.height() - error); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } // Check vertical scrolling with word wrap. @@ -2506,40 +2503,40 @@ void tst_qquicktextinput::cursorRectangle() QVERIFY(r.left() < qCeil(line.cursorToX(i, QTextLine::Trailing))); QVERIFY(r.right() >= qFloor(line.cursorToX(i , QTextLine::Leading))); - QCOMPARE(r.top(), 0); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(round(input.positionToRectangle(i))), r); + QCOMPARE(r.top(), 0.); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } input.setCursorPosition(6); r = input.cursorRectangle(); - QCOMPARE(r.left(), 0); + QCOMPARE(r.left(), 0.); QVERIFY(r.bottom() >= input.height() - error); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(6)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(6), r); for (int i = 7; i < text.length(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height() - error); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } for (int i = text.length() - 2; i >= 6; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height() - error); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } for (int i = 5; i >= 0; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); - QCOMPARE(r.top(), 0); - QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRect(), r); - QCOMPARE(round(input.positionToRectangle(i)), r); + QCOMPARE(r.top(), 0.); + QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r); + QCOMPARE(input.positionToRectangle(i), r); } input.setText("Hi!"); @@ -3228,14 +3225,14 @@ void tst_qquicktextinput::cursorRectangleSize() qApp->sendEvent(qApp->focusObject(), &event); QRectF cursorRectFromQuery = event.value(Qt::ImCursorRectangle).toRectF(); - QRect cursorRectFromItem = textInput->cursorRectangle(); + QRectF cursorRectFromItem = textInput->cursorRectangle(); QRectF cursorRectFromPositionToRectangle = textInput->positionToRectangle(textInput->cursorPosition()); // item and input query cursor rectangles match - QCOMPARE(cursorRectFromItem, cursorRectFromQuery.toRect()); + QCOMPARE(cursorRectFromItem, cursorRectFromQuery); // item cursor rectangle and positionToRectangle calculations match - QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle.toRect()); + QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle); // item-canvas transform and input item transform match QCOMPARE(QQuickItemPrivate::get(textInput)->itemToCanvasTransform(), qApp->inputMethod()->inputItemTransform()); From c4e177c049c2cd1513d81421dab31f8d4b5123e4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 23 Feb 2012 09:50:15 +0000 Subject: [PATCH 14/82] Allow V8 bindings to assign to value type sub properties This was an overly defensive change because it wasn't clear if the isAlias check would catch aliased value type sub properties. Change-Id: Iee2805d22f281c1fd188b14e265687fd8e7042db Reviewed-by: Roberto Raggi --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index c4efc85461..b7b882cd97 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -3609,7 +3609,7 @@ bool QDeclarativeCompiler::completeComponentBuild() bool isSharable = false; binding.rewrittenExpression = rewriteBinding(binding.expression.asAST(), expression, &isSharable); - if (isSharable && !binding.property->isValueTypeSubProperty && !binding.property->isAlias /* See above re alias */ && + if (isSharable && !binding.property->isAlias /* See above re alias */ && binding.property->type != qMetaTypeId()) { binding.dataType = BindingReference::V8; sharedBindings.append(b); From 91d543f00904a6caa2fab850ff3eca12de2d65ac Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 24 Feb 2012 10:22:35 +1000 Subject: [PATCH 15/82] Add additional autotests for signal handlers. Change-Id: Ie94ce8b536347981310abeb077a88acedf44c7e6 Reviewed-by: Chris Adams --- .../data/signalAssignment.3.qml | 5 +++++ .../data/signalAssignment.4.qml | 6 ++++++ .../qdeclarativeecmascript/testtypes.h | 2 ++ .../tst_qdeclarativeecmascript.cpp | 21 +++++++++++++++++++ .../data/signal.5.errors.txt | 1 + .../qdeclarativelanguage/data/signal.5.qml | 6 ++++++ .../tst_qdeclarativelanguage.cpp | 1 + tests/auto/declarative/qmlmin/tst_qmlmin.cpp | 3 ++- 8 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.3.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.4.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/signal.5.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/signal.5.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.3.qml new file mode 100644 index 0000000000..690b7cf216 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.3.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + onUnnamedArgumentSignal: setString('pass ' + a + ' ' + c) +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.4.qml new file mode 100644 index 0000000000..0e1e728a86 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.4.qml @@ -0,0 +1,6 @@ +import Qt.test 1.0 + + +MyQmlObject { + onSignalWithGlobalName: setString('pass ' + parseInt("5")) +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index a463d3f64a..ce8e80e81b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -180,6 +180,7 @@ class MyQmlObject : public QObject signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c, MyEnum2 d, Qt::MouseButtons e); + void unnamedArgumentSignal(int a, qreal, QString c); void stringChanged(); void urlChanged(); void objectChanged(); @@ -188,6 +189,7 @@ class MyQmlObject : public QObject void signalWithUnknownType(const MyQmlObject::MyType &arg); void signalWithVariant(const QVariant &arg); void signalWithQJSValue(const QJSValue &arg); + void signalWithGlobalName(int parseInt); void intChanged(); public slots: diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index cc94e6fb4a..7fc137e38d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -376,6 +376,27 @@ void tst_qdeclarativeecmascript::signalAssignment() QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2")); delete object; } + + { + QDeclarativeComponent component(&engine, testFileUrl("signalAssignment.3.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->string(), QString()); + emit object->unnamedArgumentSignal(19, 10.25, "Hello world!"); + QEXPECT_FAIL("", "QTBUG-24481", Continue); + QCOMPARE(object->string(), QString("pass 19 Hello world!")); + delete object; + } + + { + QDeclarativeComponent component(&engine, testFileUrl("signalAssignment.4.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->string(), QString()); + emit object->signalWithGlobalName(19); + QCOMPARE(object->string(), QString("pass 5")); + delete object; + } } void tst_qdeclarativeecmascript::methods() diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.5.errors.txt new file mode 100644 index 0000000000..cf772e881e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.5.errors.txt @@ -0,0 +1 @@ +4:27:Expected token `identifier' diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.5.qml new file mode 100644 index 0000000000..63921cb2ca --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.5.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + signal mySignal(string) +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 480a898ff0..1f211ae963 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -354,6 +354,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false; QTest::newRow("signal.4") << "signal.4.qml" << "signal.4.errors.txt" << false; + QTest::newRow("signal.5") << "signal.5.qml" << "signal.5.errors.txt" << false; QTest::newRow("method.1") << "method.1.qml" << "method.1.errors.txt" << false; diff --git a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp index c6b019071e..df4e2a01dc 100644 --- a/tests/auto/declarative/qmlmin/tst_qmlmin.cpp +++ b/tests/auto/declarative/qmlmin/tst_qmlmin.cpp @@ -96,10 +96,11 @@ void tst_qmlmin::initTestCase() // Add invalid files (i.e. files with syntax errors) invalidFiles << "tests/auto/qtquick2/qquickloader/data/InvalidSourceComponent.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml"; + invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml"; + invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/signal.5.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/property.4.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/empty.qml"; - invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/insertedSemicolon.1.qml"; invalidFiles << "tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml"; From 9d2b618fa022daeabd45e57aa1596197db883037 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 20 Feb 2012 10:34:44 +1000 Subject: [PATCH 16/82] Start of examples refactor This is the general reorg of the examples directory structure, plus additional guidelines. calculator, animations and accessibility have been updated to the new standards and tested, as an example. Task-number: QTBUG-24133 Change-Id: I76c3b86751d3195ba2a5474ff23afb875765e9a4 Reviewed-by: Alan Alpert --- .gitignore | 16 +- doc/config/qtquick.qdocconf | 3 +- doc/src/examples/examples-groups.qdoc | 19 -- doc/src/examples/examples-toys.qdoc | 7 - examples/HACKING | 23 ++ examples/{declarative => }/README | 1 - examples/declarative/declarative.pro | 38 --- .../shadereffects/shadereffects.qml | 300 ----------------- examples/declarative/tutorials/tutorials.pro | 5 - .../calculator/CalculatorCore}/Button.qml | 2 +- .../calculator/CalculatorCore}/Display.qml | 0 .../calculator/CalculatorCore}/calculator.js | 4 + .../CalculatorCore}/images/button-.png | Bin .../CalculatorCore}/images/button-blue.png | Bin .../CalculatorCore}/images/button-green.png | Bin .../CalculatorCore}/images/button-purple.png | Bin .../CalculatorCore}/images/button-red.png | Bin .../CalculatorCore}/images/display.png | Bin .../calculator/CalculatorCore}/qmldir | 0 .../demos/calculator/calculator-desktop.qml | 136 ++++++++ .../calculator/calculator-mobile.qml} | 7 +- examples/demos/calculator/calculator.pro | 9 + examples/demos/calculator/calculator.qdoc | 37 ++ examples/demos/calculator/main.cpp | 66 ++++ .../toys => demos}/clocks/clocks.qml | 0 .../toys => demos}/clocks/content/Clock.qml | 0 .../clocks}/content/QuitButton.qml | 0 .../toys => demos}/clocks/content/arrow.png | Bin .../clocks/content/background.png | Bin .../clocks/content}/center.png | Bin .../clocks/content/clock-night.png | Bin .../clocks/content}/clock.png | Bin .../clocks/content}/hour.png | Bin .../clocks/content}/minute.png | Bin .../easing => demos/clocks}/content/quit.png | Bin .../toys => demos}/clocks/content/second.png | Bin .../toys => demos}/corkboards/content/Day.qml | 0 .../corkboards/content/cork.jpg | Bin .../corkboards/content/note-yellow.png | Bin .../corkboards/content/tack.png | Bin .../toys => demos}/corkboards/corkboards.qml | 0 examples/demos/demos.pro | 2 + .../dynamicscene/content/Button.qml | 0 .../dynamicscene/content/GenericSceneItem.qml | 0 .../dynamicscene/content/PaletteItem.qml | 0 .../dynamicscene/content/PerspectiveItem.qml | 0 .../dynamicscene/content/Sun.qml | 0 .../dynamicscene/content/images/NOTE | 0 .../content}/images/face-smile.png | Bin .../dynamicscene/content/images/moon.png | Bin .../content/images/rabbit_brown.png | Bin .../dynamicscene/content/images/rabbit_bw.png | Bin .../dynamicscene/content}/images/star.png | Bin .../dynamicscene/content}/images/sun.png | Bin .../dynamicscene/content/images/tree_s.png | Bin .../dynamicscene/content/itemCreation.js | 0 .../dynamicscene/dynamicscene.qml | 2 +- .../flickr/content/Button.qml | 0 .../flickr/content/GridDelegate.qml | 0 .../flickr/content/ImageDetails.qml | 0 .../flickr/content/ListDelegate.qml | 0 .../flickr/content/Progress.qml | 0 .../flickr/content/RssModel.qml | 0 .../flickr/content/ScrollBar.qml | 0 .../flickr/content/Slider.qml | 0 .../flickr/content/TitleBar.qml | 0 .../flickr/content/ToolBar.qml | 0 .../flickr/content/UnifiedDelegate.qml | 0 .../flickr/content}/images/gloss.png | Bin .../flickr/content}/images/lineedit.png | Bin .../flickr/content}/images/lineedit.sci | 0 .../flickr/content/images/noise.png | Bin .../flickr/content/images/particle.png | Bin .../flickr/content}/images/quit.png | Bin .../flickr/content/images/squareParticle.png | Bin .../flickr/content}/images/stripes.png | Bin .../flickr/content}/images/titlebar.png | Bin .../flickr/content}/images/titlebar.sci | 0 .../flickr/content}/images/toolbutton.png | Bin .../flickr/content}/images/toolbutton.sci | 0 .../flickr/content/qmldir | 0 .../flickr/flickr-90.qml | 0 .../{declarative => demos}/flickr/flickr.qml | 0 .../flickr/flickr.qmlproject | 0 .../minehunt/MinehuntCore/Explosion.qml | 0 .../minehunt/MinehuntCore/Tile.qml | 0 .../minehunt/MinehuntCore/pics/back.png | Bin .../minehunt/MinehuntCore/pics/background.png | Bin .../minehunt/MinehuntCore/pics/bomb-color.png | Bin .../minehunt/MinehuntCore/pics/bomb.png | Bin .../minehunt/MinehuntCore/pics/face-sad.png | Bin .../MinehuntCore/pics/face-smile-big.png | Bin .../minehunt/MinehuntCore/pics/face-smile.png | Bin .../minehunt/MinehuntCore/pics/flag-color.png | Bin .../minehunt/MinehuntCore/pics/flag.png | Bin .../minehunt/MinehuntCore/pics/front.png | Bin .../minehunt/MinehuntCore/pics/quit.png | Bin .../minehunt/MinehuntCore/pics/star.png | Bin .../minehunt/MinehuntCore/qmldir | 0 .../{declarative => demos}/minehunt/README | 0 .../{declarative => demos}/minehunt/main.cpp | 0 .../minehunt/minehunt.cpp | 0 .../minehunt/minehunt.h | 0 .../minehunt/minehunt.pro | 0 .../minehunt/minehunt.qml | 0 .../minehunt/minehunt.qmlproject | 0 .../minehunt/minehunt.qrc | 0 .../PhotoViewerCore/AlbumDelegate.qml | 0 .../PhotoViewerCore/BusyIndicator.qml | 0 .../photoviewer/PhotoViewerCore/Button.qml | 0 .../PhotoViewerCore/EditableButton.qml | 0 .../PhotoViewerCore/PhotoDelegate.qml | 0 .../PhotoViewerCore/ProgressBar.qml | 0 .../photoviewer/PhotoViewerCore/RssModel.qml | 0 .../photoviewer/PhotoViewerCore/Tag.qml | 0 .../PhotoViewerCore/images/box-shadow.png | Bin .../PhotoViewerCore/images/busy.png | Bin .../PhotoViewerCore/images/cardboard.png | Bin .../photoviewer/PhotoViewerCore/qmldir | 0 .../PhotoViewerCore/script}/script.js | 0 .../photoviewer/i18n/base.ts | 0 .../photoviewer/i18n/qml_fr.qm | Bin .../photoviewer/i18n/qml_fr.ts | 0 .../photoviewer/photoviewer.qml | 0 .../photoviewer/photoviewer.qmlproject | 0 .../plasmapatrol/PlasmaPatrol.qmlproject | 0 .../particles => demos}/plasmapatrol/TODO | 0 .../plasmapatrol/content/BlasterHardpoint.qml | 0 .../plasmapatrol/content/Button.qml | 0 .../plasmapatrol/content/CannonHardpoint.qml | 0 .../plasmapatrol/content/ChoiceBox.qml | 0 .../plasmapatrol/content/Cruiser.qml | 0 .../plasmapatrol/content/Frigate.qml | 0 .../plasmapatrol/content/Hardpoint.qml | 0 .../plasmapatrol/content/HelpScreens.qml | 0 .../plasmapatrol/content/LaserHardpoint.qml | 0 .../content/PlasmaPatrolParticles.qml | 0 .../plasmapatrol/content/SequentialLoader.qml | 0 .../plasmapatrol/content/Ship.qml | 0 .../plasmapatrol/content/Sloop.qml | 0 .../plasmapatrol/content/pics/TitleText.png | Bin .../content/pics/blur-circle2.png | Bin .../content/pics/blur-circle3.png | Bin .../content/pics}/finalfrontier.png | Bin .../plasmapatrol/content/pics}/meteor.png | Bin .../content/pics/meteor_explo.png | Bin .../plasmapatrol/content/pics}/nullRock.png | Bin .../plasmapatrol/content/pics}/particle.png | Bin .../plasmapatrol/content/pics}/star.png | Bin .../plasmapatrol/content/pics/star2.png | Bin .../plasmapatrol/content/pics/star3.png | Bin .../plasmapatrol/plasmapatrol.qml | 0 .../rssnews/content/BusyIndicator.qml | 0 .../rssnews/content/CategoryDelegate.qml | 0 .../rssnews/content/NewsDelegate.qml | 0 .../rssnews/content/RssFeeds.qml | 0 .../rssnews/content/ScrollBar.qml | 0 .../rssnews/content/images/busy.png | Bin .../rssnews/content/images/scrollbar.png | Bin .../rssnews/rssnews.qml | 0 .../rssnews/rssnews.qmlproject | 0 .../samegame/content/BoomBlock.qml | 0 .../samegame/content/Button.qml | 0 .../samegame/content/Dialog.qml | 0 .../samegame/content/GameArea.qml | 0 .../samegame/content/NameInputDialog.qml | 0 .../samegame/content/pics/background.png | Bin .../samegame/content/pics/blueStone.png | Bin .../samegame/content/pics/greenStone.png | Bin .../samegame}/content/pics/particle.png | Bin .../samegame/content/pics/redStone.png | Bin .../samegame/content/pics/yellowStone.png | Bin .../samegame/content/samegame.js | 0 .../samegame/samegame.qml | 0 .../samegame/samegame.qmlproject | 0 .../snake/content/Button.qml | 0 .../snake/content/Cookie.qml | 0 .../snake/content/HighScoreModel.qml | 0 .../snake/content/Link.qml | 0 .../snake/content/Skull.qml | 8 +- .../snake/content/pics/README | 0 .../snake/content/pics/background.png | Bin .../snake/content/pics/blueStar.png | Bin .../snake/content/pics/blueStone.png | Bin .../snake/content/pics/cookie.png | Bin .../snake/content/pics/eyes.svg | 0 .../snake/content/pics/head.png | Bin .../snake/content/pics/pause.png | Bin .../snake/content/pics/redStar.png | Bin .../snake/content/pics/redStone.png | Bin .../snake/content/pics/skull.png | Bin .../snake/content/pics/snake.jpg | Bin .../snake/content/pics/star.png | Bin .../snake/content/pics/stoneShadow.png | Bin .../snake/content/pics/yellowStar.png | Bin .../snake/content/pics/yellowStone.png | Bin .../snake/content/snake.js | 0 .../{declarative => demos}/snake/snake.qml | 19 +- .../snake/snake.qmlproject | 0 .../tic-tac-toe/content/Button.qml | 0 .../tic-tac-toe/content/TicTac.qml | 0 .../tic-tac-toe/content/pics/board.png | Bin .../tic-tac-toe/content/pics/o.png | Bin .../tic-tac-toe/content/pics/x.png | Bin .../tic-tac-toe/content/tic-tac-toe.js | 0 .../tic-tac-toe/tic-tac-toe.qml | 0 .../toys => demos}/tvtennis/tvtennis.qml | 0 .../twitter/TwitterCore/Button.qml | 0 .../twitter/TwitterCore/FatDelegate.qml | 0 .../twitter/TwitterCore/Input.qml | 0 .../twitter/TwitterCore/Loading.qml | 0 .../twitter/TwitterCore/MultiTitleBar.qml | 0 .../twitter/TwitterCore/RssModel.qml | 0 .../twitter/TwitterCore/SearchView.qml | 0 .../twitter/TwitterCore/TitleBar.qml | 0 .../twitter/TwitterCore/ToolBar.qml | 0 .../twitter/TwitterCore/UserModel.qml | 0 .../twitter/TwitterCore}/images/gloss.png | Bin .../twitter/TwitterCore}/images/lineedit.png | Bin .../twitter/TwitterCore}/images/lineedit.sci | 0 .../twitter/TwitterCore/images/loading.png | Bin .../twitter/TwitterCore}/images/quit.png | Bin .../twitter/TwitterCore}/images/stripes.png | Bin .../twitter/TwitterCore}/images/titlebar.png | Bin .../twitter/TwitterCore}/images/titlebar.sci | 0 .../TwitterCore}/images/toolbutton.png | Bin .../TwitterCore}/images/toolbutton.sci | 0 .../twitter/TwitterCore/qmldir | 0 .../twitter/twitter.qml | 0 .../twitter/twitter.qmlproject | 0 examples/embedded/embedded.pro | 2 - .../embedded/qmlcalculator/deployment.pri | 4 - .../embedded/qmlcalculator/qmlcalculator.cpp | 63 ---- .../embedded/qmlcalculator/qmlcalculator.pro | 5 - examples/embedded/qmlclocks/deployment.pri | 4 - examples/embedded/qmlclocks/qmlclocks.cpp | 63 ---- examples/embedded/qmlclocks/qmlclocks.pro | 5 - .../embedded/qmldialcontrol/deployment.pri | 4 - .../qmldialcontrol/qmldialcontrol.cpp | 63 ---- .../qmldialcontrol/qmldialcontrol.pro | 5 - examples/embedded/qmleasing/deployment.pri | 4 - examples/embedded/qmleasing/qmleasing.cpp | 63 ---- examples/embedded/qmleasing/qmleasing.pro | 5 - examples/embedded/qmlflickr/deployment.pri | 4 - examples/embedded/qmlflickr/qmlflickr.cpp | 104 ------ examples/embedded/qmlflickr/qmlflickr.pro | 5 - .../embedded/qmlphotoviewer/deployment.pri | 4 - .../qmlphotoviewer/qmlphotoviewer.cpp | 104 ------ .../qmlphotoviewer/qmlphotoviewer.pro | 5 - examples/embedded/qmltwitter/deployment.pri | 4 - examples/embedded/qmltwitter/qmltwitter.cpp | 103 ------ examples/embedded/qmltwitter/qmltwitter.pro | 5 - examples/examples.pro | 2 +- .../hello.qml | 0 examples/localstorage/localstorage.pro | 1 + .../particles/affectors/age.qml | 0 .../particles/affectors/attractor.qml | 0 .../particles/affectors/customaffector.qml | 0 .../particles/affectors/friction.qml | 0 .../particles/affectors/gravity.qml | 0 .../particles/affectors/groupgoal.qml | 0 .../particles/affectors/move.qml | 0 .../particles/affectors/spritegoal.qml | 0 .../particles/affectors/turbulence.qml | 0 .../particles/affectors/wander.qml | 0 .../customparticle/blurparticles.qml | 0 .../customparticle/fragmentshader.qml | 0 .../particles/customparticle/imagecolors.qml | 0 .../particles/emitters/burstandpulse.qml | 0 .../particles/emitters/customemitter.qml | 0 .../particles/emitters/emitmask.qml | 0 .../particles/emitters/maximumemitted.qml | 0 .../particles/emitters/shapeanddirection.qml | 0 .../particles/emitters/timedgroupchanges.qml | 0 .../particles/emitters/trailemitter.qml | 0 .../particles/emitters/velocityfrommotion.qml | 0 .../exampleslauncher/content/Button.qml | 0 .../exampleslauncher/content/Shell.qml | 0 .../exampleslauncher/content/launcher.js | 0 .../exampleslauncher/exampleslauncher.qml | 0 .../particles/imageparticle/allatonce.qml | 0 .../particles/imageparticle/colored.qml | 0 .../particles/imageparticle/colortable.qml | 0 .../particles/imageparticle/deformation.qml | 0 .../particles/imageparticle/rotation.qml | 0 .../particles/imageparticle/sharing.qml | 0 .../particles/imageparticle/sprites.qml | 0 .../particles/images/_explo.png | Bin .../particles/images/backgroundLeaves.jpg | Bin .../particles/images/bear_tiles.png | Bin .../particles/images/candle.png | Bin .../particles/images/colortable.png | Bin .../images}/finalfrontier.png | Bin .../particles/images/flower.png | Bin .../images/launcherIcons/allatonce.png | Bin .../images/launcherIcons/attractor.png | Bin .../images/launcherIcons/blurparticles.png | Bin .../particles/images/launcherIcons/close.png | Bin .../images/launcherIcons/colortable.png | Bin .../images/launcherIcons/customaffector.png | Bin .../images/launcherIcons/customemitter.png | Bin .../images/launcherIcons/deformation.png | Bin .../images/launcherIcons/delegates.png | Bin .../images/launcherIcons/dynamicemitters.png | Bin .../images/launcherIcons/emitmask.png | Bin .../particles/images/launcherIcons/flickr.png | Bin .../images/launcherIcons/fragmentshader.png | Bin .../images/launcherIcons/gridsplosion.png | Bin .../images/launcherIcons/groupgoal.png | Bin .../images/launcherIcons/imagecolors.png | Bin .../particles/images/launcherIcons/list.png | Bin .../images/launcherIcons/maximumemitted.png | Bin .../images/launcherIcons/multiplepainters.png | Bin .../images/launcherIcons/package.png | Bin .../images/launcherIcons/particleview.png | Bin .../images/launcherIcons/plasmapatrol.png | Bin .../particles/images/launcherIcons/remove.png | Bin .../images/launcherIcons/rotation.png | Bin .../images/launcherIcons/samegame.png | Bin .../launcherIcons/shapeanddirection.png | Bin .../images/launcherIcons/spaceexplorer.png | Bin .../images/launcherIcons/spritegoal.png | Bin .../images/launcherIcons/sprites.png | Bin .../launcherIcons/spritevariedparticles.png | Bin .../images/launcherIcons/startstop.png | Bin .../launcherIcons/timedgroupchanges.png | Bin .../images/launcherIcons/trailemitter.png | Bin .../particles/images/launcherIcons/trails.png | Bin .../images/launcherIcons/turbulence.png | Bin .../launcherIcons/velocityfrommotion.png | Bin .../particles/images/launcherIcons/wander.png | Bin .../particles/images/matchmask.png | Bin .../pics => particles/images}/meteor.png | Bin .../particles/images/meteor_explo.png | Bin .../particles/images/meteors.png | Bin .../pics => particles/images}/nullRock.png | Bin .../pics => particles/images}/particle.png | Bin .../particles/images/particle2.png | Bin .../particles/images/particle3.png | Bin .../particles/images/particle4.png | Bin .../particles/images/particleA.png | Bin .../particles/images/portal_bg.png | Bin .../particles/images/realLeaf1.png | Bin .../particles/images/realLeaf2.png | Bin .../particles/images/realLeaf3.png | Bin .../particles/images/realLeaf4.png | Bin .../particles/images/rocket.png | Bin .../particles/images/rocket2.png | Bin .../particles/images/sizeInOut.png | Bin .../particles/images/snowflake.png | Bin .../particles/images/sparkleSize.png | Bin .../pics => particles/images}/star.png | Bin .../particles/images/starfish_0.png | Bin .../particles/images/starfish_1.png | Bin .../particles/images/starfish_2.png | Bin .../particles/images/starfish_3.png | Bin .../particles/images/starfish_4.png | Bin .../particles/images/starfish_mask.png | Bin .../itemparticle/content}/Delegate.qml | 0 .../itemparticle/content/Delegate2.qml | 0 .../content/ExpandingDelegate.qml | 0 .../itemparticle/content/RssModel.qml | 0 .../particles/itemparticle/content/bubble.png | Bin .../itemparticle/content}/script.js | 0 .../particles/itemparticle/delegates.qml | 0 .../particles/itemparticle/particleview.qml | 0 examples/particles/particles.pro | 1 + .../particles/simple/dynamiccomparison.qml | 0 .../particles/simple/dynamicemitters.qml | 0 .../particles/simple/multiplepainters.qml | 0 .../particles/simple/startstop.qml | 0 .../cppextensions/cppextensions.pro | 0 .../cppextensions/cppextensions.qmlproject | 0 .../imageprovider/ImageProviderCore/qmldir | 0 .../imageprovider/imageprovider-example.qml | 0 .../imageprovider/imageprovider.cpp | 0 .../imageprovider/imageprovider.pro | 0 .../imageprovider/imageprovider.qmlproject | 0 .../networkaccessmanagerfactory/main.cpp | 0 .../networkaccessmanagerfactory.pro | 0 .../networkaccessmanagerfactory.qmlproject | 0 .../networkaccessmanagerfactory.qrc | 0 .../networkaccessmanagerfactory/view.qml | 0 .../cppextensions/plugins/README | 0 .../plugins/com/nokia/TimeExample/Clock.qml | 0 .../plugins/com/nokia/TimeExample}/center.png | Bin .../plugins/com/nokia/TimeExample}/clock.png | Bin .../plugins/com/nokia/TimeExample}/hour.png | Bin .../plugins/com/nokia/TimeExample}/minute.png | Bin .../plugins/com/nokia/TimeExample/qmldir | 0 .../cppextensions/plugins/plugin.cpp | 0 .../cppextensions/plugins/plugins.pro | 0 .../cppextensions/plugins/plugins.qml | 0 .../cppextensions/plugins/plugins.qmlproject | 0 .../referenceexamples/adding/adding.pro | 0 .../referenceexamples/adding/adding.qrc | 0 .../referenceexamples/adding/example.qml | 0 .../referenceexamples/adding/main.cpp | 0 .../referenceexamples/adding/person.cpp | 0 .../referenceexamples/adding/person.h | 0 .../referenceexamples/attached/attached.pro | 0 .../referenceexamples/attached/attached.qrc | 0 .../attached/birthdayparty.cpp | 0 .../attached/birthdayparty.h | 0 .../referenceexamples/attached/example.qml | 0 .../referenceexamples/attached/main.cpp | 0 .../referenceexamples/attached/person.cpp | 0 .../referenceexamples/attached/person.h | 0 .../referenceexamples/binding/binding.pro | 0 .../referenceexamples/binding/binding.qrc | 0 .../binding/birthdayparty.cpp | 0 .../referenceexamples/binding/birthdayparty.h | 0 .../referenceexamples/binding/example.qml | 0 .../binding/happybirthdaysong.cpp | 0 .../binding/happybirthdaysong.h | 0 .../referenceexamples/binding/main.cpp | 0 .../referenceexamples/binding/person.cpp | 0 .../referenceexamples/binding/person.h | 0 .../coercion/birthdayparty.cpp | 0 .../coercion/birthdayparty.h | 0 .../referenceexamples/coercion/coercion.pro | 0 .../referenceexamples/coercion/coercion.qrc | 0 .../referenceexamples/coercion/example.qml | 0 .../referenceexamples/coercion/main.cpp | 0 .../referenceexamples/coercion/person.cpp | 0 .../referenceexamples/coercion/person.h | 0 .../default/birthdayparty.cpp | 0 .../referenceexamples/default/birthdayparty.h | 0 .../referenceexamples/default/default.pro | 0 .../referenceexamples/default/default.qrc | 0 .../referenceexamples/default/example.qml | 0 .../referenceexamples/default/main.cpp | 0 .../referenceexamples/default/person.cpp | 0 .../referenceexamples/default/person.h | 0 .../referenceexamples/extended/example.qml | 0 .../referenceexamples/extended/extended.pro | 0 .../referenceexamples/extended/extended.qrc | 0 .../referenceexamples/extended/lineedit.cpp | 0 .../referenceexamples/extended/lineedit.h | 0 .../referenceexamples/extended/main.cpp | 0 .../grouped/birthdayparty.cpp | 0 .../referenceexamples/grouped/birthdayparty.h | 0 .../referenceexamples/grouped/example.qml | 0 .../referenceexamples/grouped/grouped.pro | 0 .../referenceexamples/grouped/grouped.qrc | 0 .../referenceexamples/grouped/main.cpp | 0 .../referenceexamples/grouped/person.cpp | 0 .../referenceexamples/grouped/person.h | 0 .../methods/birthdayparty.cpp | 0 .../referenceexamples/methods/birthdayparty.h | 0 .../referenceexamples/methods/example.qml | 0 .../referenceexamples/methods/main.cpp | 0 .../referenceexamples/methods/methods.pro | 0 .../referenceexamples/methods/methods.qrc | 0 .../referenceexamples/methods/person.cpp | 0 .../referenceexamples/methods/person.h | 0 .../properties/birthdayparty.cpp | 0 .../properties/birthdayparty.h | 0 .../referenceexamples/properties/example.qml | 0 .../referenceexamples/properties/main.cpp | 0 .../referenceexamples/properties/person.cpp | 0 .../referenceexamples/properties/person.h | 0 .../properties/properties.pro | 0 .../properties/properties.qrc | 0 .../referenceexamples/referenceexamples.pro | 0 .../referenceexamples.qmlproject | 0 .../signal/birthdayparty.cpp | 0 .../referenceexamples/signal/birthdayparty.h | 0 .../referenceexamples/signal/example.qml | 0 .../referenceexamples/signal/main.cpp | 0 .../referenceexamples/signal/person.cpp | 0 .../referenceexamples/signal/person.h | 0 .../referenceexamples/signal/signal.pro | 0 .../referenceexamples/signal/signal.qrc | 0 .../valuesource/birthdayparty.cpp | 0 .../valuesource/birthdayparty.h | 0 .../referenceexamples/valuesource/example.qml | 0 .../valuesource/happybirthdaysong.cpp | 0 .../valuesource/happybirthdaysong.h | 0 .../referenceexamples/valuesource/main.cpp | 0 .../referenceexamples/valuesource/person.cpp | 0 .../referenceexamples/valuesource/person.h | 0 .../valuesource/valuesource.pro | 0 .../valuesource/valuesource.qrc | 0 examples/{declarative => qml}/i18n/i18n.qml | 0 .../{declarative => qml}/i18n/i18n/base.ts | 0 .../i18n/i18n/qml_en_AU.ts | 0 .../{declarative => qml}/i18n/i18n/qml_fr.ts | 0 .../{declarative => qml}/locale/locale.qml | 0 examples/qml/qml.pro | 1 + .../{declarative => qml}/script/script.pro | 0 .../script/shell/main.cpp | 0 .../script/shell/shell.pro | 0 .../xml => qml}/xmlhttprequest/data.xml | 0 .../xmlhttprequest/xmlhttprequest-example.qml | 0 .../qtquick/accessibility/accessibility.pro | 10 + .../accessibility/accessibility.qml | 19 +- .../accessibility/accessibility.qmlproject} | 4 +- .../accessibility/content}/Button.qml | 1 + examples/qtquick/accessibility/main.cpp | 41 +++ examples/qtquick/animation/animation.pro | 10 + .../animation/animation.qml | 34 +- .../animation/animation.qmlproject | 0 .../animation/basics/color-animation.qml | 2 +- .../animation/basics/images}/face-smile.png | Bin .../animation/basics/images/moon.png | Bin .../animation/basics/images/shadow.png | Bin .../animation/basics}/images/star.png | Bin .../animation/basics}/images/sun.png | Bin .../animation/basics/property-animation.qml | 0 .../animation/behaviors/SideRect.qml | 0 .../animation/behaviors/behavior-example.qml | 2 +- .../animation/behaviors/wigglytext.qml | 6 +- .../animation/easing}/content/QuitButton.qml | 0 .../animation/easing}/content/quit.png | Bin .../animation/easing/easing.qml | 17 +- examples/qtquick/animation/main.cpp | 41 +++ .../animation/pathanimation/pathanimation.qml | 53 ++- .../pathinterpolator/pathinterpolator.qml | 31 +- .../animation/states/qt-logo.png | Bin .../animation/states/states.qml | 0 .../animation/states/transitions.qml | 0 .../canvas/bezierCurve/bezierCurve.qml | 0 .../canvas/clip/clip.qml | 0 .../canvas/contents/Button.qml | 0 .../canvas/contents/ScrollBar.qml | 0 .../canvas/contents/Slider.qml | 0 .../canvas/contents/Stocks.qml | 0 .../canvas/contents/TitleBar.qml | 0 .../canvas/contents/ToolBar.qml | 0 .../canvas/contents/images/button-pressed.png | Bin .../canvas/contents/images/button.png | Bin .../canvas/contents/images/default.svg | 0 .../canvas/contents}/images/gloss.png | Bin .../canvas/contents}/images/lineedit.png | Bin .../canvas/contents}/images/lineedit.sci | 0 .../canvas/contents}/images/quit.png | Bin .../canvas/contents}/images/stripes.png | Bin .../canvas/contents}/images/titlebar.png | Bin .../canvas/contents}/images/titlebar.sci | 0 .../canvas/contents}/images/toolbutton.png | Bin .../canvas/contents}/images/toolbutton.sci | 0 .../canvas/contents/qt-logo.png | Bin .../quadraticCurveTo/quadraticCurveTo.qml | 0 .../canvas/roundedrect/roundedrect.qml | 0 .../canvas/smile/smile.qml | 0 .../canvas/squircle/squircle.png | Bin .../canvas/squircle/squircle.qml | 0 .../canvas/stockchart/README | 0 .../com/nokia/StockChartExample/qmldir | 0 .../canvas/stockchart/model.cpp | 0 .../canvas/stockchart/model.h | 0 .../canvas/stockchart/plugin.cpp | 0 .../canvas/stockchart/stock.qml | 0 .../canvas/stockchart/stockchart.pro | 0 .../canvas/tiger/tiger.js | 0 .../canvas/tiger/tiger.qml | 0 .../canvas/twitterfriends/TwitterUser.qml | 0 .../canvas/twitterfriends/cache.js | 0 .../canvas/twitterfriends/twitter.qml | 0 .../draganddrop/dragtarget.qmlproject | 0 .../draganddrop/tiles/DragTile.qml | 0 .../draganddrop/tiles/DropTile.qml | 0 .../draganddrop/tiles/tiles.qml | 0 .../draganddrop/views/gridview.qml | 0 .../qtquick/imageelements/borderimage.qml | 103 ++++++ .../imageelements/content/BearSheet.png | Bin .../imageelements/content/ImageCell.qml | 0 .../imageelements/content/MyBorderImage.qml | 0 .../imageelements/content/ShadowRectangle.qml | 0 .../imageelements/content/bw.png | Bin .../imageelements/content/colors-round.sci | 0 .../imageelements/content/colors-stretch.sci | 0 .../imageelements/content/colors.png | Bin .../imageelements/content/qt-logo.png | Bin .../imageelements/content/shadow.png | Bin .../imageelements/content/speaker.png | Bin .../imageelements/image.qml} | 65 ++-- .../imageelements/imageelements.qml | 2 +- .../imageelements/imageelements.qmlproject | 0 .../imageelements/shadows.qml | 0 .../imageelements/simplesprite.qml | 0 .../imageelements/spriteimage.qml | 0 .../keyinteraction/focus/Core/ContextMenu.qml | 0 .../keyinteraction/focus/Core/GridMenu.qml | 0 .../keyinteraction/focus/Core/ListMenu.qml | 0 .../focus/Core/ListViewDelegate.qml | 0 .../focus/Core/images/arrow.png | Bin .../focus/Core/images/qt-logo.png | Bin .../keyinteraction/focus/focus.qml | 0 .../abstractitemmodel/abstractitemmodel.pro | 0 .../abstractitemmodel/abstractitemmodel.qrc | 0 .../modelviews/abstractitemmodel/main.cpp | 0 .../modelviews/abstractitemmodel/model.cpp | 0 .../modelviews/abstractitemmodel/model.h | 0 .../modelviews/abstractitemmodel/view.qml | 0 .../modelviews/gridview/gridview-example.qml | 0 .../gridview/pics/AddressBook_48.png | Bin .../gridview/pics/AudioPlayer_48.png | Bin .../modelviews/gridview/pics/Camera_48.png | Bin .../modelviews/gridview/pics/DateBook_48.png | Bin .../modelviews/gridview/pics/EMail_48.png | Bin .../modelviews/gridview/pics/TodoList_48.png | Bin .../gridview/pics/VideoPlayer_48.png | Bin .../modelviews/listview/content/PetsModel.qml | 0 .../listview/content/PressAndHoldButton.qml | 0 .../listview/content/RecipesModel.qml | 0 .../listview/content/TextButton.qml | 0 .../listview/content/ToggleButton.qml | 0 .../listview/content/pics/arrow-down.png | Bin .../listview/content/pics/arrow-up.png | Bin .../listview/content/pics/fruit-salad.jpg | Bin .../listview/content/pics/hamburger.jpg | Bin .../listview/content/pics/lemonade.jpg | Bin .../listview/content/pics/list-delete.png | Bin .../listview/content/pics/minus-sign.png | Bin .../listview/content/pics/moreDown.png | Bin .../listview/content/pics/moreUp.png | Bin .../listview/content/pics/pancakes.jpg | Bin .../listview/content/pics/plus-sign.png | Bin .../listview/content/pics/vegetable-soup.jpg | Bin .../modelviews/listview/dynamiclist.qml | 0 .../listview/expandingdelegates.qml | 0 .../modelviews/listview/highlight.qml | 0 .../modelviews/listview/highlightranges.qml | 0 .../modelviews/listview/sections.qml | 0 .../modelviews/modelviews.pro | 0 .../modelviews/modelviews.qml | 2 +- .../modelviews/modelviews.qmlproject | 0 .../modelviews/objectlistmodel/dataobject.cpp | 0 .../modelviews/objectlistmodel/dataobject.h | 0 .../modelviews/objectlistmodel/main.cpp | 0 .../objectlistmodel/objectlistmodel.pro | 0 .../objectlistmodel.qmlproject | 0 .../objectlistmodel/objectlistmodel.qrc | 0 .../modelviews/objectlistmodel/view.qml | 0 .../modelviews/package}/Delegate.qml | 0 .../modelviews/package/view.qml | 4 + .../modelviews/parallax/content/Clock.qml | 143 ++++++++ .../parallax/content/ParallaxView.qml | 0 .../parallax}/content/QuitButton.qml | 0 .../modelviews/parallax/content/Smiley.qml | 0 .../parallax/content/background.png | Bin 0 -> 46895 bytes .../modelviews/parallax/content/center.png | Bin 0 -> 765 bytes .../parallax/content/clock-night.png | Bin 0 -> 23359 bytes .../modelviews/parallax/content/clock.png | Bin 0 -> 20653 bytes .../modelviews/parallax/content/hour.png | Bin 0 -> 625 bytes .../modelviews/parallax/content/minute.png | Bin 0 -> 625 bytes .../parallax/content/pics/background.jpg | Bin .../parallax/content/pics}/face-smile.png | Bin .../parallax/content/pics/home-page.png | Bin .../parallax/content/pics/home-page.svg | 0 .../parallax/content/pics/shadow.png | Bin .../parallax/content/pics/yast-joystick.png | Bin .../parallax/content/pics/yast-wol.png | Bin .../modelviews/parallax}/content/quit.png | Bin .../modelviews/parallax/content/second.png | Bin 0 -> 303 bytes .../modelviews/parallax/parallax.qml | 1 - .../modelviews/pathview/pathview-example.qml | 0 .../pathview/pics/AddressBook_48.png | Bin .../pathview/pics/AudioPlayer_48.png | Bin .../modelviews/pathview/pics/Camera_48.png | Bin .../modelviews/pathview/pics/DateBook_48.png | Bin .../modelviews/pathview/pics/EMail_48.png | Bin .../modelviews/pathview/pics/TodoList_48.png | Bin .../pathview/pics/VideoPlayer_48.png | Bin .../modelviews/stringlistmodel/main.cpp | 0 .../stringlistmodel/stringlistmodel.pro | 0 .../stringlistmodel/stringlistmodel.qrc | 0 .../modelviews/stringlistmodel/view.qml | 0 .../visualdatamodel/dragselection.qml | 0 .../modelviews/visualdatamodel/slideshow.qml | 0 .../visualdatamodel/sortedmodel.qml | 0 .../visualdatamodel.qmlproject | 0 .../visualitemmodel/visualitemmodel.qml | 7 +- .../mousearea/mousearea-example.qml | 0 .../openglunderqml/main.cpp | 0 .../openglunderqml/main.qml | 0 .../openglunderqml/openglunderqml.pro | 0 .../openglunderqml/squircle.cpp | 0 .../openglunderqml/squircle.h | 0 .../painteditem/painteditem.pro | 0 .../painteditem/smile/main.cpp | 0 .../painteditem/smile/smile.pro | 0 .../painteditem/smile/smile.qml | 0 .../textballoons/TextBalloonPlugin/plugin.h | 0 .../textballoons/TextBalloonPlugin/qmldir | 0 .../painteditem/textballoons/textballoon.cpp | 0 .../painteditem/textballoons/textballoon.h | 0 .../painteditem/textballoons/textballoons.pro | 0 .../painteditem/textballoons/textballoons.qml | 0 .../positioners/content/Button.qml | 0 .../positioners/content/add.png | Bin .../positioners/content/del.png | Bin .../positioners-attachedproperties.qml | 0 .../positioners/positioners.qml | 6 +- examples/qtquick/qtquick.pro | 17 + .../layoutdirection/layoutdirection.qml | 0 .../layoutdirection.qmlproject | 0 .../layoutmirroring/layoutmirroring.qml | 0 .../layoutmirroring.qmlproject | 0 .../textalignment/textalignment.qml | 0 .../textalignment/textalignment.qmlproject | 0 .../shadereffects/content/Slider.qml | 0 .../shadereffects/content}/face-smile.png | Bin .../shadereffects/content/qt-logo.png | Bin .../qtquick/shadereffects/shadereffects.qml | 315 ++++++++++++++++++ .../text/fonts/availableFonts.qml | 0 .../text/fonts/banner.qml | 0 .../fonts/content/fonts/tarzeau_ocr_a.ttf | Bin .../text/fonts/fonts.qml | 0 .../text/fonts/hello.qml | 0 .../text/imgtag/TextWithImage.qml | 0 .../text/imgtag/images/face-sad.png | Bin .../text/imgtag/images/face-smile-big.png | Bin .../text/imgtag/images/face-smile.png | Bin .../text/imgtag/images/heart200.png | Bin .../text/imgtag/images/qtlogo.png | Bin .../text/imgtag/images/starfish_2.png | Bin .../text/imgtag/imgtag.qml | 0 .../text/styledtext-layout.qml | 0 .../{declarative => qtquick}/text/text.qml | 2 +- .../text/text.qmlproject | 0 .../text/textselection/pics/endHandle.png | Bin .../text/textselection/pics/endHandle.sci | 0 .../text/textselection/pics/startHandle.png | Bin .../text/textselection/pics/startHandle.sci | 0 .../text/textselection/textselection.qml | 0 .../threading/threadedlistmodel/dataloader.js | 0 .../threadedlistmodel.qmlproject | 0 .../threadedlistmodel/timedisplay.qml | 0 .../threading/workerscript/workerscript.js | 0 .../threading/workerscript/workerscript.qml | 0 .../workerscript/workerscript.qmlproject | 0 .../multipointtouch/bearwhack.qml | 0 .../content/AugmentedTouchPoint.qml | 0 .../multipointtouch/content/Bear0.png | Bin .../multipointtouch/content/Bear1.png | Bin .../multipointtouch/content/Bear2.png | Bin .../multipointtouch/content/Bear3.png | Bin .../multipointtouch/content/BearB.png | Bin .../content/BearWhackParticleSystem.qml | 0 .../multipointtouch/content/ParticleFlame.qml | 0 .../multipointtouch/content/blur-circle.png | Bin .../multipointtouch/content/blur-circle3.png | Bin .../multipointtouch/content/heart-blur.png | Bin .../multipointtouch/content/title.png | Bin .../multipointtouch/multiflame.qml | 0 .../pincharea/flickresize.qml | 0 .../touchinteraction/pincharea/qt-logo.jpg | Bin .../touchinteraction/touchinteraction.qml | 3 +- .../touchinteraction.qmlproject | 0 examples/{declarative => }/shared/Button.qml | 0 .../{declarative => }/shared/LauncherList.qml | 3 +- examples/{declarative => }/shared/README | 0 .../shared/SimpleLauncherDelegate.qml | 0 .../shared => shared/images}/back.png | Bin examples/shared/qmldir | 3 + examples/shared/shared.h | 49 +++ examples/shared/shared.pro | 9 + .../dynamicview/dynamicview1/PetsModel.qml | 0 .../dynamicview/dynamicview1/dynamicview.qml | 0 .../dynamicview/dynamicview2/PetsModel.qml | 0 .../dynamicview/dynamicview2/dynamicview.qml | 0 .../dynamicview/dynamicview3/PetsModel.qml | 0 .../dynamicview/dynamicview3/dynamicview.qml | 0 .../dynamicview/dynamicview4/ListSelector.qml | 0 .../dynamicview/dynamicview4/PetsModel.qml | 0 .../dynamicview/dynamicview4/dynamicview.qml | 0 .../extending/chapter1-basics/app.qml | 0 .../chapter1-basics/chapter1-basics.pro | 0 .../extending/chapter1-basics/main.cpp | 0 .../extending/chapter1-basics/piechart.cpp | 0 .../extending/chapter1-basics/piechart.h | 0 .../extending/chapter2-methods/app.qml | 0 .../chapter2-methods/chapter2-methods.pro | 0 .../extending/chapter2-methods/main.cpp | 0 .../extending/chapter2-methods/piechart.cpp | 0 .../extending/chapter2-methods/piechart.h | 0 .../extending/chapter3-bindings/app.qml | 0 .../chapter3-bindings/chapter3-bindings.pro | 0 .../extending/chapter3-bindings/main.cpp | 0 .../extending/chapter3-bindings/piechart.cpp | 0 .../extending/chapter3-bindings/piechart.h | 0 .../chapter4-customPropertyTypes/app.qml | 0 .../chapter4-customPropertyTypes.pro | 0 .../chapter4-customPropertyTypes/main.cpp | 0 .../chapter4-customPropertyTypes/piechart.cpp | 0 .../chapter4-customPropertyTypes/piechart.h | 0 .../chapter4-customPropertyTypes/pieslice.cpp | 0 .../chapter4-customPropertyTypes/pieslice.h | 0 .../extending/chapter5-listproperties/app.qml | 0 .../chapter5-listproperties.pro | 0 .../chapter5-listproperties/main.cpp | 0 .../chapter5-listproperties/piechart.cpp | 0 .../chapter5-listproperties/piechart.h | 0 .../chapter5-listproperties/pieslice.cpp | 0 .../chapter5-listproperties/pieslice.h | 0 .../chapter6-plugins/ChartsPlugin/qmldir | 0 .../extending/chapter6-plugins/app.qml | 0 .../chapter6-plugins/chapter6-plugins.pro | 0 .../chapter6-plugins/chartsplugin.cpp | 0 .../extending/chapter6-plugins/chartsplugin.h | 0 .../extending/chapter6-plugins/piechart.cpp | 0 .../extending/chapter6-plugins/piechart.h | 0 .../extending/chapter6-plugins/pieslice.cpp | 0 .../extending/chapter6-plugins/pieslice.h | 0 .../tutorials/extending/extending.pro | 0 .../tutorials/helloworld/Cell.qml | 0 .../tutorials/helloworld/tutorial1.qml | 0 .../tutorials/helloworld/tutorial2.qml | 0 .../tutorials/helloworld/tutorial3.qml | 0 .../tutorials/samegame/samegame1/Block.qml | 0 .../tutorials/samegame/samegame1/Button.qml | 0 .../tutorials/samegame/samegame1/samegame.qml | 0 .../samegame/samegame1/samegame1.qmlproject | 0 .../tutorials/samegame/samegame2/Block.qml | 0 .../tutorials/samegame/samegame2/Button.qml | 0 .../tutorials/samegame/samegame2/samegame.js | 0 .../tutorials/samegame/samegame2/samegame.qml | 0 .../samegame/samegame2/samegame2.qmlproject | 0 .../tutorials/samegame/samegame3/Block.qml | 0 .../tutorials/samegame/samegame3/Button.qml | 0 .../tutorials/samegame/samegame3/Dialog.qml | 0 .../tutorials/samegame/samegame3/samegame.js | 0 .../tutorials/samegame/samegame3/samegame.qml | 0 .../samegame/samegame3/samegame3.qmlproject | 0 .../samegame/samegame4/content/BoomBlock.qml | 0 .../samegame/samegame4/content/Button.qml | 0 .../samegame/samegame4/content/Dialog.qml | 0 .../samegame/samegame4/content/samegame.js | 0 .../samegame/samegame4/highscores/README | 0 .../samegame4/highscores/score_data.xml | 0 .../samegame4/highscores/score_style.xsl | 0 .../samegame/samegame4/highscores/scores.php | 0 .../tutorials/samegame/samegame4/samegame.qml | 0 .../samegame/samegame4/samegame4.qmlproject | 0 .../samegame/shared/pics/background.jpg | Bin .../samegame/shared/pics/blueStar.png | Bin .../samegame/shared/pics/blueStone.png | Bin .../samegame/shared/pics/greenStar.png | Bin .../samegame/shared/pics/greenStone.png | Bin .../samegame/shared/pics/redStar.png | Bin .../samegame/shared/pics/redStone.png | Bin .../tutorials/samegame/shared/pics/star.png | Bin .../samegame/shared/pics/yellowStone.png | Bin .../dialcontrol/content/Dial.qml | 0 .../dialcontrol/content/QuitButton.qml} | 31 +- .../dialcontrol/content/background.png | Bin .../dialcontrol/content/needle.png | Bin .../dialcontrol/content/needle_shadow.png | Bin .../dialcontrol/content/overlay.png | Bin .../dialcontrol/content/quit.png | Bin 0 -> 583 bytes .../ui-components/dialcontrol/dialcontrol.qml | 0 .../flipable/content/5_heart.png | Bin .../ui-components/flipable/content/9_club.png | Bin .../ui-components/flipable/content/Card.qml | 0 .../ui-components/flipable/content/back.png | Bin .../ui-components/flipable/flipable.qml | 0 .../progressbar/content/ProgressBar.qml | 0 .../progressbar/content/background.png | Bin .../ui-components/progressbar/main.qml | 0 .../ui-components/scrollbar/ScrollBar.qml | 0 .../ui-components/scrollbar/main.qml | 0 .../scrollbar/pics/niagara_falls.jpg | Bin .../scrollbar/scrollbar.qmlproject | 0 .../ui-components/searchbox/SearchBox.qml | 0 .../ui-components/searchbox/images/clear.png | Bin .../searchbox/images/lineedit-bg-focus.png | Bin .../searchbox/images/lineedit-bg.png | Bin .../ui-components/searchbox/main.qml | 0 .../searchbox/searchbox.qmlproject | 0 .../slideswitch/content/Switch.qml | 0 .../slideswitch/content/background.png | Bin .../slideswitch/content/background.svg | 0 .../slideswitch/content/knob.png | Bin .../slideswitch/content/knob.svg | 0 .../ui-components/slideswitch/slideswitch.qml | 0 .../ui-components/spinner/content/Spinner.qml | 0 .../spinner/content/spinner-bg.png | Bin .../spinner/content/spinner-select.png | Bin .../ui-components/spinner/main.qml | 0 .../ui-components/spinner/spinner.qmlproject | 0 .../ui-components/tabwidget/TabWidget.qml | 0 .../ui-components/tabwidget/main.qml | 0 .../ui-components/tabwidget/tab.png | Bin .../tabwidget/tabwidget.qmlproject | 0 examples/{declarative => }/window/Window.qml | 0 .../window/screen/screenInfo.qml | 0 .../{declarative => }/window/standalone.qml | 0 examples/{declarative => }/window/window.cpp | 0 examples/{declarative => }/window/window.pro | 0 tests/auto/qtquick2/examples/tst_examples.cpp | 25 +- 893 files changed, 1193 insertions(+), 1205 deletions(-) create mode 100644 examples/HACKING rename examples/{declarative => }/README (99%) delete mode 100644 examples/declarative/declarative.pro delete mode 100644 examples/declarative/shadereffects/shadereffects.qml delete mode 100644 examples/declarative/tutorials/tutorials.pro rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/Button.qml (98%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/Display.qml (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/calculator.js (96%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/button-.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/button-blue.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/button-green.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/button-purple.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/button-red.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/images/display.png (100%) rename examples/{declarative/calculator/content => demos/calculator/CalculatorCore}/qmldir (100%) create mode 100644 examples/demos/calculator/calculator-desktop.qml rename examples/{declarative/calculator/calculator.qml => demos/calculator/calculator-mobile.qml} (97%) create mode 100644 examples/demos/calculator/calculator.pro create mode 100644 examples/demos/calculator/calculator.qdoc create mode 100644 examples/demos/calculator/main.cpp rename examples/{declarative/toys => demos}/clocks/clocks.qml (100%) rename examples/{declarative/toys => demos}/clocks/content/Clock.qml (100%) rename examples/{declarative/animation/easing => demos/clocks}/content/QuitButton.qml (100%) rename examples/{declarative/toys => demos}/clocks/content/arrow.png (100%) rename examples/{declarative/toys => demos}/clocks/content/background.png (100%) rename examples/{declarative/cppextensions/plugins/com/nokia/TimeExample => demos/clocks/content}/center.png (100%) rename examples/{declarative/toys => demos}/clocks/content/clock-night.png (100%) rename examples/{declarative/cppextensions/plugins/com/nokia/TimeExample => demos/clocks/content}/clock.png (100%) rename examples/{declarative/cppextensions/plugins/com/nokia/TimeExample => demos/clocks/content}/hour.png (100%) rename examples/{declarative/cppextensions/plugins/com/nokia/TimeExample => demos/clocks/content}/minute.png (100%) rename examples/{declarative/animation/easing => demos/clocks}/content/quit.png (100%) rename examples/{declarative/toys => demos}/clocks/content/second.png (100%) rename examples/{declarative/toys => demos}/corkboards/content/Day.qml (100%) rename examples/{declarative/toys => demos}/corkboards/content/cork.jpg (100%) rename examples/{declarative/toys => demos}/corkboards/content/note-yellow.png (100%) rename examples/{declarative/toys => demos}/corkboards/content/tack.png (100%) rename examples/{declarative/toys => demos}/corkboards/corkboards.qml (100%) create mode 100644 examples/demos/demos.pro rename examples/{declarative/toys => demos}/dynamicscene/content/Button.qml (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/GenericSceneItem.qml (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/PaletteItem.qml (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/PerspectiveItem.qml (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/Sun.qml (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/images/NOTE (100%) rename examples/{declarative/animation/basics => demos/dynamicscene/content}/images/face-smile.png (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/images/moon.png (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/images/rabbit_brown.png (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/images/rabbit_bw.png (100%) rename examples/{declarative/animation/basics => demos/dynamicscene/content}/images/star.png (100%) rename examples/{declarative/animation/basics => demos/dynamicscene/content}/images/sun.png (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/images/tree_s.png (100%) rename examples/{declarative/toys => demos}/dynamicscene/content/itemCreation.js (100%) rename examples/{declarative/toys => demos}/dynamicscene/dynamicscene.qml (99%) rename examples/{declarative => demos}/flickr/content/Button.qml (100%) rename examples/{declarative => demos}/flickr/content/GridDelegate.qml (100%) rename examples/{declarative => demos}/flickr/content/ImageDetails.qml (100%) rename examples/{declarative => demos}/flickr/content/ListDelegate.qml (100%) rename examples/{declarative => demos}/flickr/content/Progress.qml (100%) rename examples/{declarative => demos}/flickr/content/RssModel.qml (100%) rename examples/{declarative => demos}/flickr/content/ScrollBar.qml (100%) rename examples/{declarative => demos}/flickr/content/Slider.qml (100%) rename examples/{declarative => demos}/flickr/content/TitleBar.qml (100%) rename examples/{declarative => demos}/flickr/content/ToolBar.qml (100%) rename examples/{declarative => demos}/flickr/content/UnifiedDelegate.qml (100%) rename examples/{declarative/canvas/contents => demos/flickr/content}/images/gloss.png (100%) mode change 100755 => 100644 rename examples/{declarative/canvas/contents => demos/flickr/content}/images/lineedit.png (100%) mode change 100755 => 100644 rename examples/{declarative/canvas/contents => demos/flickr/content}/images/lineedit.sci (100%) rename examples/{declarative => demos}/flickr/content/images/noise.png (100%) rename examples/{declarative => demos}/flickr/content/images/particle.png (100%) rename examples/{declarative/canvas/contents => demos/flickr/content}/images/quit.png (100%) mode change 100755 => 100644 rename examples/{declarative => demos}/flickr/content/images/squareParticle.png (100%) rename examples/{declarative/canvas/contents => demos/flickr/content}/images/stripes.png (100%) mode change 100755 => 100644 rename examples/{declarative/canvas/contents => demos/flickr/content}/images/titlebar.png (100%) mode change 100755 => 100644 rename examples/{declarative/canvas/contents => demos/flickr/content}/images/titlebar.sci (100%) rename examples/{declarative/canvas/contents => demos/flickr/content}/images/toolbutton.png (100%) mode change 100755 => 100644 rename examples/{declarative/canvas/contents => demos/flickr/content}/images/toolbutton.sci (100%) rename examples/{declarative => demos}/flickr/content/qmldir (100%) rename examples/{declarative => demos}/flickr/flickr-90.qml (100%) rename examples/{declarative => demos}/flickr/flickr.qml (100%) rename examples/{declarative => demos}/flickr/flickr.qmlproject (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/Explosion.qml (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/Tile.qml (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/back.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/background.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/bomb-color.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/bomb.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/face-sad.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/face-smile-big.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/face-smile.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/flag-color.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/flag.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/front.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/quit.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/pics/star.png (100%) rename examples/{declarative => demos}/minehunt/MinehuntCore/qmldir (100%) rename examples/{declarative => demos}/minehunt/README (100%) rename examples/{declarative => demos}/minehunt/main.cpp (100%) rename examples/{declarative => demos}/minehunt/minehunt.cpp (100%) rename examples/{declarative => demos}/minehunt/minehunt.h (100%) rename examples/{declarative => demos}/minehunt/minehunt.pro (100%) rename examples/{declarative => demos}/minehunt/minehunt.qml (100%) rename examples/{declarative => demos}/minehunt/minehunt.qmlproject (100%) rename examples/{declarative => demos}/minehunt/minehunt.qrc (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/AlbumDelegate.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/BusyIndicator.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/Button.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/EditableButton.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/PhotoDelegate.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/ProgressBar.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/RssModel.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/Tag.qml (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/images/box-shadow.png (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/images/busy.png (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/images/cardboard.png (100%) rename examples/{declarative => demos}/photoviewer/PhotoViewerCore/qmldir (100%) rename examples/{declarative/particles/itemparticle/content => demos/photoviewer/PhotoViewerCore/script}/script.js (100%) rename examples/{declarative => demos}/photoviewer/i18n/base.ts (100%) rename examples/{declarative => demos}/photoviewer/i18n/qml_fr.qm (100%) rename examples/{declarative => demos}/photoviewer/i18n/qml_fr.ts (100%) rename examples/{declarative => demos}/photoviewer/photoviewer.qml (100%) rename examples/{declarative => demos}/photoviewer/photoviewer.qmlproject (100%) rename examples/{declarative/particles => demos}/plasmapatrol/PlasmaPatrol.qmlproject (100%) rename examples/{declarative/particles => demos}/plasmapatrol/TODO (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/BlasterHardpoint.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Button.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/CannonHardpoint.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/ChoiceBox.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Cruiser.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Frigate.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Hardpoint.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/HelpScreens.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/LaserHardpoint.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/PlasmaPatrolParticles.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/SequentialLoader.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Ship.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/Sloop.qml (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/TitleText.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/blur-circle2.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/blur-circle3.png (100%) rename examples/{declarative/particles/images => demos/plasmapatrol/content/pics}/finalfrontier.png (100%) rename examples/{declarative/particles/images => demos/plasmapatrol/content/pics}/meteor.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/meteor_explo.png (100%) rename examples/{declarative/particles/images => demos/plasmapatrol/content/pics}/nullRock.png (100%) rename examples/{declarative/particles/images => demos/plasmapatrol/content/pics}/particle.png (100%) rename examples/{declarative/particles/images => demos/plasmapatrol/content/pics}/star.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/star2.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/content/pics/star3.png (100%) rename examples/{declarative/particles => demos}/plasmapatrol/plasmapatrol.qml (100%) rename examples/{declarative => demos}/rssnews/content/BusyIndicator.qml (100%) rename examples/{declarative => demos}/rssnews/content/CategoryDelegate.qml (100%) rename examples/{declarative => demos}/rssnews/content/NewsDelegate.qml (100%) rename examples/{declarative => demos}/rssnews/content/RssFeeds.qml (100%) rename examples/{declarative => demos}/rssnews/content/ScrollBar.qml (100%) rename examples/{declarative => demos}/rssnews/content/images/busy.png (100%) rename examples/{declarative => demos}/rssnews/content/images/scrollbar.png (100%) rename examples/{declarative => demos}/rssnews/rssnews.qml (100%) rename examples/{declarative => demos}/rssnews/rssnews.qmlproject (100%) rename examples/{declarative => demos}/samegame/content/BoomBlock.qml (100%) rename examples/{declarative => demos}/samegame/content/Button.qml (100%) rename examples/{declarative => demos}/samegame/content/Dialog.qml (100%) rename examples/{declarative => demos}/samegame/content/GameArea.qml (100%) rename examples/{declarative => demos}/samegame/content/NameInputDialog.qml (100%) rename examples/{declarative => demos}/samegame/content/pics/background.png (100%) rename examples/{declarative => demos}/samegame/content/pics/blueStone.png (100%) rename examples/{declarative => demos}/samegame/content/pics/greenStone.png (100%) rename examples/{declarative/particles/plasmapatrol => demos/samegame}/content/pics/particle.png (100%) rename examples/{declarative => demos}/samegame/content/pics/redStone.png (100%) rename examples/{declarative => demos}/samegame/content/pics/yellowStone.png (100%) rename examples/{declarative => demos}/samegame/content/samegame.js (100%) rename examples/{declarative => demos}/samegame/samegame.qml (100%) rename examples/{declarative => demos}/samegame/samegame.qmlproject (100%) rename examples/{declarative => demos}/snake/content/Button.qml (100%) rename examples/{declarative => demos}/snake/content/Cookie.qml (100%) rename examples/{declarative => demos}/snake/content/HighScoreModel.qml (100%) rename examples/{declarative => demos}/snake/content/Link.qml (100%) rename examples/{declarative => demos}/snake/content/Skull.qml (87%) rename examples/{declarative => demos}/snake/content/pics/README (100%) rename examples/{declarative => demos}/snake/content/pics/background.png (100%) rename examples/{declarative => demos}/snake/content/pics/blueStar.png (100%) rename examples/{declarative => demos}/snake/content/pics/blueStone.png (100%) rename examples/{declarative => demos}/snake/content/pics/cookie.png (100%) rename examples/{declarative => demos}/snake/content/pics/eyes.svg (100%) rename examples/{declarative => demos}/snake/content/pics/head.png (100%) rename examples/{declarative => demos}/snake/content/pics/pause.png (100%) rename examples/{declarative => demos}/snake/content/pics/redStar.png (100%) rename examples/{declarative => demos}/snake/content/pics/redStone.png (100%) rename examples/{declarative => demos}/snake/content/pics/skull.png (100%) rename examples/{declarative => demos}/snake/content/pics/snake.jpg (100%) rename examples/{declarative => demos}/snake/content/pics/star.png (100%) rename examples/{declarative => demos}/snake/content/pics/stoneShadow.png (100%) rename examples/{declarative => demos}/snake/content/pics/yellowStar.png (100%) rename examples/{declarative => demos}/snake/content/pics/yellowStone.png (100%) rename examples/{declarative => demos}/snake/content/snake.js (100%) rename examples/{declarative => demos}/snake/snake.qml (93%) rename examples/{declarative => demos}/snake/snake.qmlproject (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/Button.qml (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/TicTac.qml (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/pics/board.png (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/pics/o.png (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/pics/x.png (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/content/tic-tac-toe.js (100%) rename examples/{declarative/toys => demos}/tic-tac-toe/tic-tac-toe.qml (100%) rename examples/{declarative/toys => demos}/tvtennis/tvtennis.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/Button.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/FatDelegate.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/Input.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/Loading.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/MultiTitleBar.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/RssModel.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/SearchView.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/TitleBar.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/ToolBar.qml (100%) rename examples/{declarative => demos}/twitter/TwitterCore/UserModel.qml (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/gloss.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/lineedit.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/lineedit.sci (100%) rename examples/{declarative => demos}/twitter/TwitterCore/images/loading.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/quit.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/stripes.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/titlebar.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/titlebar.sci (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/toolbutton.png (100%) rename examples/{declarative/flickr/content => demos/twitter/TwitterCore}/images/toolbutton.sci (100%) rename examples/{declarative => demos}/twitter/TwitterCore/qmldir (100%) rename examples/{declarative => demos}/twitter/twitter.qml (100%) rename examples/{declarative => demos}/twitter/twitter.qmlproject (100%) delete mode 100644 examples/embedded/embedded.pro delete mode 100644 examples/embedded/qmlcalculator/deployment.pri delete mode 100644 examples/embedded/qmlcalculator/qmlcalculator.cpp delete mode 100644 examples/embedded/qmlcalculator/qmlcalculator.pro delete mode 100644 examples/embedded/qmlclocks/deployment.pri delete mode 100644 examples/embedded/qmlclocks/qmlclocks.cpp delete mode 100644 examples/embedded/qmlclocks/qmlclocks.pro delete mode 100644 examples/embedded/qmldialcontrol/deployment.pri delete mode 100644 examples/embedded/qmldialcontrol/qmldialcontrol.cpp delete mode 100644 examples/embedded/qmldialcontrol/qmldialcontrol.pro delete mode 100644 examples/embedded/qmleasing/deployment.pri delete mode 100644 examples/embedded/qmleasing/qmleasing.cpp delete mode 100644 examples/embedded/qmleasing/qmleasing.pro delete mode 100644 examples/embedded/qmlflickr/deployment.pri delete mode 100644 examples/embedded/qmlflickr/qmlflickr.cpp delete mode 100644 examples/embedded/qmlflickr/qmlflickr.pro delete mode 100644 examples/embedded/qmlphotoviewer/deployment.pri delete mode 100644 examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp delete mode 100644 examples/embedded/qmlphotoviewer/qmlphotoviewer.pro delete mode 100644 examples/embedded/qmltwitter/deployment.pri delete mode 100644 examples/embedded/qmltwitter/qmltwitter.cpp delete mode 100644 examples/embedded/qmltwitter/qmltwitter.pro rename examples/{declarative/sqllocalstorage => localstorage}/hello.qml (100%) create mode 100644 examples/localstorage/localstorage.pro rename examples/{declarative => }/particles/affectors/age.qml (100%) rename examples/{declarative => }/particles/affectors/attractor.qml (100%) rename examples/{declarative => }/particles/affectors/customaffector.qml (100%) rename examples/{declarative => }/particles/affectors/friction.qml (100%) rename examples/{declarative => }/particles/affectors/gravity.qml (100%) rename examples/{declarative => }/particles/affectors/groupgoal.qml (100%) rename examples/{declarative => }/particles/affectors/move.qml (100%) rename examples/{declarative => }/particles/affectors/spritegoal.qml (100%) rename examples/{declarative => }/particles/affectors/turbulence.qml (100%) rename examples/{declarative => }/particles/affectors/wander.qml (100%) rename examples/{declarative => }/particles/customparticle/blurparticles.qml (100%) rename examples/{declarative => }/particles/customparticle/fragmentshader.qml (100%) rename examples/{declarative => }/particles/customparticle/imagecolors.qml (100%) rename examples/{declarative => }/particles/emitters/burstandpulse.qml (100%) rename examples/{declarative => }/particles/emitters/customemitter.qml (100%) rename examples/{declarative => }/particles/emitters/emitmask.qml (100%) rename examples/{declarative => }/particles/emitters/maximumemitted.qml (100%) rename examples/{declarative => }/particles/emitters/shapeanddirection.qml (100%) rename examples/{declarative => }/particles/emitters/timedgroupchanges.qml (100%) rename examples/{declarative => }/particles/emitters/trailemitter.qml (100%) rename examples/{declarative => }/particles/emitters/velocityfrommotion.qml (100%) rename examples/{declarative => }/particles/exampleslauncher/content/Button.qml (100%) rename examples/{declarative => }/particles/exampleslauncher/content/Shell.qml (100%) rename examples/{declarative => }/particles/exampleslauncher/content/launcher.js (100%) rename examples/{declarative => }/particles/exampleslauncher/exampleslauncher.qml (100%) rename examples/{declarative => }/particles/imageparticle/allatonce.qml (100%) rename examples/{declarative => }/particles/imageparticle/colored.qml (100%) rename examples/{declarative => }/particles/imageparticle/colortable.qml (100%) rename examples/{declarative => }/particles/imageparticle/deformation.qml (100%) rename examples/{declarative => }/particles/imageparticle/rotation.qml (100%) rename examples/{declarative => }/particles/imageparticle/sharing.qml (100%) rename examples/{declarative => }/particles/imageparticle/sprites.qml (100%) rename examples/{declarative => }/particles/images/_explo.png (100%) rename examples/{declarative => }/particles/images/backgroundLeaves.jpg (100%) rename examples/{declarative => }/particles/images/bear_tiles.png (100%) rename examples/{declarative => }/particles/images/candle.png (100%) rename examples/{declarative => }/particles/images/colortable.png (100%) rename examples/{declarative/particles/plasmapatrol/content/pics => particles/images}/finalfrontier.png (100%) rename examples/{declarative => }/particles/images/flower.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/allatonce.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/attractor.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/blurparticles.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/close.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/colortable.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/customaffector.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/customemitter.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/deformation.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/delegates.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/dynamicemitters.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/emitmask.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/flickr.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/fragmentshader.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/gridsplosion.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/groupgoal.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/imagecolors.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/list.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/maximumemitted.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/multiplepainters.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/package.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/particleview.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/plasmapatrol.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/remove.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/rotation.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/samegame.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/shapeanddirection.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/spaceexplorer.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/spritegoal.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/sprites.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/spritevariedparticles.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/startstop.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/timedgroupchanges.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/trailemitter.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/trails.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/turbulence.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/velocityfrommotion.png (100%) rename examples/{declarative => }/particles/images/launcherIcons/wander.png (100%) rename examples/{declarative => }/particles/images/matchmask.png (100%) rename examples/{declarative/particles/plasmapatrol/content/pics => particles/images}/meteor.png (100%) rename examples/{declarative => }/particles/images/meteor_explo.png (100%) rename examples/{declarative => }/particles/images/meteors.png (100%) rename examples/{declarative/particles/plasmapatrol/content/pics => particles/images}/nullRock.png (100%) rename examples/{declarative/samegame/content/pics => particles/images}/particle.png (100%) rename examples/{declarative => }/particles/images/particle2.png (100%) rename examples/{declarative => }/particles/images/particle3.png (100%) rename examples/{declarative => }/particles/images/particle4.png (100%) rename examples/{declarative => }/particles/images/particleA.png (100%) rename examples/{declarative => }/particles/images/portal_bg.png (100%) rename examples/{declarative => }/particles/images/realLeaf1.png (100%) rename examples/{declarative => }/particles/images/realLeaf2.png (100%) rename examples/{declarative => }/particles/images/realLeaf3.png (100%) rename examples/{declarative => }/particles/images/realLeaf4.png (100%) rename examples/{declarative => }/particles/images/rocket.png (100%) rename examples/{declarative => }/particles/images/rocket2.png (100%) rename examples/{declarative => }/particles/images/sizeInOut.png (100%) rename examples/{declarative => }/particles/images/snowflake.png (100%) rename examples/{declarative => }/particles/images/sparkleSize.png (100%) rename examples/{declarative/particles/plasmapatrol/content/pics => particles/images}/star.png (100%) rename examples/{declarative => }/particles/images/starfish_0.png (100%) rename examples/{declarative => }/particles/images/starfish_1.png (100%) rename examples/{declarative => }/particles/images/starfish_2.png (100%) rename examples/{declarative => }/particles/images/starfish_3.png (100%) rename examples/{declarative => }/particles/images/starfish_4.png (100%) rename examples/{declarative => }/particles/images/starfish_mask.png (100%) rename examples/{declarative/modelviews/package => particles/itemparticle/content}/Delegate.qml (100%) rename examples/{declarative => }/particles/itemparticle/content/Delegate2.qml (100%) rename examples/{declarative => }/particles/itemparticle/content/ExpandingDelegate.qml (100%) rename examples/{declarative => }/particles/itemparticle/content/RssModel.qml (100%) rename examples/{declarative => }/particles/itemparticle/content/bubble.png (100%) rename examples/{declarative/photoviewer/PhotoViewerCore/script => particles/itemparticle/content}/script.js (100%) rename examples/{declarative => }/particles/itemparticle/delegates.qml (100%) rename examples/{declarative => }/particles/itemparticle/particleview.qml (100%) create mode 100644 examples/particles/particles.pro rename examples/{declarative => }/particles/simple/dynamiccomparison.qml (100%) rename examples/{declarative => }/particles/simple/dynamicemitters.qml (100%) rename examples/{declarative => }/particles/simple/multiplepainters.qml (100%) rename examples/{declarative => }/particles/simple/startstop.qml (100%) rename examples/{declarative => qml}/cppextensions/cppextensions.pro (100%) rename examples/{declarative => qml}/cppextensions/cppextensions.qmlproject (100%) rename examples/{declarative => qml}/cppextensions/imageprovider/ImageProviderCore/qmldir (100%) rename examples/{declarative => qml}/cppextensions/imageprovider/imageprovider-example.qml (100%) rename examples/{declarative => qml}/cppextensions/imageprovider/imageprovider.cpp (100%) rename examples/{declarative => qml}/cppextensions/imageprovider/imageprovider.pro (100%) rename examples/{declarative => qml}/cppextensions/imageprovider/imageprovider.qmlproject (100%) rename examples/{declarative => qml}/cppextensions/networkaccessmanagerfactory/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro (100%) rename examples/{declarative => qml}/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qmlproject (100%) rename examples/{declarative => qml}/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc (100%) rename examples/{declarative => qml}/cppextensions/networkaccessmanagerfactory/view.qml (100%) rename examples/{declarative => qml}/cppextensions/plugins/README (100%) rename examples/{declarative => qml}/cppextensions/plugins/com/nokia/TimeExample/Clock.qml (100%) rename examples/{declarative/toys/clocks/content => qml/cppextensions/plugins/com/nokia/TimeExample}/center.png (100%) rename examples/{declarative/toys/clocks/content => qml/cppextensions/plugins/com/nokia/TimeExample}/clock.png (100%) rename examples/{declarative/toys/clocks/content => qml/cppextensions/plugins/com/nokia/TimeExample}/hour.png (100%) rename examples/{declarative/toys/clocks/content => qml/cppextensions/plugins/com/nokia/TimeExample}/minute.png (100%) rename examples/{declarative => qml}/cppextensions/plugins/com/nokia/TimeExample/qmldir (100%) rename examples/{declarative => qml}/cppextensions/plugins/plugin.cpp (100%) rename examples/{declarative => qml}/cppextensions/plugins/plugins.pro (100%) rename examples/{declarative => qml}/cppextensions/plugins/plugins.qml (100%) rename examples/{declarative => qml}/cppextensions/plugins/plugins.qmlproject (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/adding.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/adding.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/adding/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/attached.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/attached.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/attached/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/binding.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/binding.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/happybirthdaysong.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/happybirthdaysong.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/binding/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/coercion.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/coercion.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/coercion/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/default.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/default.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/default/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/extended.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/extended.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/lineedit.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/lineedit.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/extended/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/grouped.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/grouped.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/grouped/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/methods.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/methods.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/methods/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/properties.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/properties/properties.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/referenceexamples.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/referenceexamples.qmlproject (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/signal.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/signal/signal.qrc (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/birthdayparty.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/birthdayparty.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/example.qml (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/happybirthdaysong.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/happybirthdaysong.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/main.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/person.cpp (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/person.h (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/valuesource.pro (100%) rename examples/{declarative => qml}/cppextensions/referenceexamples/valuesource/valuesource.qrc (100%) rename examples/{declarative => qml}/i18n/i18n.qml (100%) rename examples/{declarative => qml}/i18n/i18n/base.ts (100%) rename examples/{declarative => qml}/i18n/i18n/qml_en_AU.ts (100%) rename examples/{declarative => qml}/i18n/i18n/qml_fr.ts (100%) rename examples/{declarative => qml}/locale/locale.qml (100%) create mode 100644 examples/qml/qml.pro rename examples/{declarative => qml}/script/script.pro (100%) rename examples/{declarative => qml}/script/shell/main.cpp (100%) rename examples/{declarative => qml}/script/shell/shell.pro (100%) rename examples/{declarative/xml => qml}/xmlhttprequest/data.xml (100%) rename examples/{declarative/xml => qml}/xmlhttprequest/xmlhttprequest-example.qml (100%) create mode 100644 examples/qtquick/accessibility/accessibility.pro rename examples/{declarative => qtquick}/accessibility/accessibility.qml (91%) rename examples/{declarative/tutorials/tutorials.qmlproject => qtquick/accessibility/accessibility.qmlproject} (80%) rename examples/{declarative/accessibility/widgets => qtquick/accessibility/content}/Button.qml (98%) create mode 100644 examples/qtquick/accessibility/main.cpp create mode 100644 examples/qtquick/animation/animation.pro rename examples/{declarative => qtquick}/animation/animation.qml (69%) rename examples/{declarative => qtquick}/animation/animation.qmlproject (100%) rename examples/{declarative => qtquick}/animation/basics/color-animation.qml (99%) rename examples/{declarative/modelviews/parallax/content/pics => qtquick/animation/basics/images}/face-smile.png (100%) rename examples/{declarative => qtquick}/animation/basics/images/moon.png (100%) rename examples/{declarative => qtquick}/animation/basics/images/shadow.png (100%) rename examples/{declarative/toys/dynamicscene/content => qtquick/animation/basics}/images/star.png (100%) rename examples/{declarative/toys/dynamicscene/content => qtquick/animation/basics}/images/sun.png (100%) rename examples/{declarative => qtquick}/animation/basics/property-animation.qml (100%) rename examples/{declarative => qtquick}/animation/behaviors/SideRect.qml (100%) rename examples/{declarative => qtquick}/animation/behaviors/behavior-example.qml (99%) rename examples/{declarative => qtquick}/animation/behaviors/wigglytext.qml (97%) rename examples/{declarative/toys/clocks => qtquick/animation/easing}/content/QuitButton.qml (100%) rename examples/{declarative/toys/clocks => qtquick/animation/easing}/content/quit.png (100%) rename examples/{declarative => qtquick}/animation/easing/easing.qml (93%) create mode 100644 examples/qtquick/animation/main.cpp rename examples/{declarative => qtquick}/animation/pathanimation/pathanimation.qml (76%) rename examples/{declarative => qtquick}/animation/pathinterpolator/pathinterpolator.qml (87%) rename examples/{declarative => qtquick}/animation/states/qt-logo.png (100%) rename examples/{declarative => qtquick}/animation/states/states.qml (100%) rename examples/{declarative => qtquick}/animation/states/transitions.qml (100%) rename examples/{declarative => qtquick}/canvas/bezierCurve/bezierCurve.qml (100%) rename examples/{declarative => qtquick}/canvas/clip/clip.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/Button.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/ScrollBar.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/Slider.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/Stocks.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/TitleBar.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/ToolBar.qml (100%) rename examples/{declarative => qtquick}/canvas/contents/images/button-pressed.png (100%) rename examples/{declarative => qtquick}/canvas/contents/images/button.png (100%) rename examples/{declarative => qtquick}/canvas/contents/images/default.svg (100%) rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/gloss.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/lineedit.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/lineedit.sci (100%) rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/quit.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/stripes.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/titlebar.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/titlebar.sci (100%) rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/toolbutton.png (100%) mode change 100644 => 100755 rename examples/{declarative/twitter/TwitterCore => qtquick/canvas/contents}/images/toolbutton.sci (100%) rename examples/{declarative => qtquick}/canvas/contents/qt-logo.png (100%) rename examples/{declarative => qtquick}/canvas/quadraticCurveTo/quadraticCurveTo.qml (100%) rename examples/{declarative => qtquick}/canvas/roundedrect/roundedrect.qml (100%) rename examples/{declarative => qtquick}/canvas/smile/smile.qml (100%) rename examples/{declarative => qtquick}/canvas/squircle/squircle.png (100%) rename examples/{declarative => qtquick}/canvas/squircle/squircle.qml (100%) rename examples/{declarative => qtquick}/canvas/stockchart/README (100%) rename examples/{declarative => qtquick}/canvas/stockchart/com/nokia/StockChartExample/qmldir (100%) rename examples/{declarative => qtquick}/canvas/stockchart/model.cpp (100%) rename examples/{declarative => qtquick}/canvas/stockchart/model.h (100%) rename examples/{declarative => qtquick}/canvas/stockchart/plugin.cpp (100%) rename examples/{declarative => qtquick}/canvas/stockchart/stock.qml (100%) rename examples/{declarative => qtquick}/canvas/stockchart/stockchart.pro (100%) rename examples/{declarative => qtquick}/canvas/tiger/tiger.js (100%) rename examples/{declarative => qtquick}/canvas/tiger/tiger.qml (100%) rename examples/{declarative => qtquick}/canvas/twitterfriends/TwitterUser.qml (100%) rename examples/{declarative => qtquick}/canvas/twitterfriends/cache.js (100%) rename examples/{declarative => qtquick}/canvas/twitterfriends/twitter.qml (100%) rename examples/{declarative => qtquick}/draganddrop/dragtarget.qmlproject (100%) rename examples/{declarative => qtquick}/draganddrop/tiles/DragTile.qml (100%) rename examples/{declarative => qtquick}/draganddrop/tiles/DropTile.qml (100%) rename examples/{declarative => qtquick}/draganddrop/tiles/tiles.qml (100%) rename examples/{declarative => qtquick}/draganddrop/views/gridview.qml (100%) create mode 100644 examples/qtquick/imageelements/borderimage.qml rename examples/{declarative => qtquick}/imageelements/content/BearSheet.png (100%) rename examples/{declarative => qtquick}/imageelements/content/ImageCell.qml (100%) rename examples/{declarative => qtquick}/imageelements/content/MyBorderImage.qml (100%) rename examples/{declarative => qtquick}/imageelements/content/ShadowRectangle.qml (100%) rename examples/{declarative => qtquick}/imageelements/content/bw.png (100%) rename examples/{declarative => qtquick}/imageelements/content/colors-round.sci (100%) rename examples/{declarative => qtquick}/imageelements/content/colors-stretch.sci (100%) rename examples/{declarative => qtquick}/imageelements/content/colors.png (100%) rename examples/{declarative => qtquick}/imageelements/content/qt-logo.png (100%) rename examples/{declarative => qtquick}/imageelements/content/shadow.png (100%) rename examples/{declarative => qtquick}/imageelements/content/speaker.png (100%) rename examples/{declarative/imageelements/borderimage.qml => qtquick/imageelements/image.qml} (53%) rename examples/{declarative => qtquick}/imageelements/imageelements.qml (99%) rename examples/{declarative => qtquick}/imageelements/imageelements.qmlproject (100%) rename examples/{declarative => qtquick}/imageelements/shadows.qml (100%) rename examples/{declarative => qtquick}/imageelements/simplesprite.qml (100%) rename examples/{declarative => qtquick}/imageelements/spriteimage.qml (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/ContextMenu.qml (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/GridMenu.qml (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/ListMenu.qml (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/ListViewDelegate.qml (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/images/arrow.png (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/Core/images/qt-logo.png (100%) rename examples/{declarative => qtquick}/keyinteraction/focus/focus.qml (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/abstractitemmodel.pro (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/abstractitemmodel.qrc (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/main.cpp (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/model.cpp (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/model.h (100%) rename examples/{declarative => qtquick}/modelviews/abstractitemmodel/view.qml (100%) rename examples/{declarative => qtquick}/modelviews/gridview/gridview-example.qml (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/AddressBook_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/AudioPlayer_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/Camera_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/DateBook_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/EMail_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/TodoList_48.png (100%) rename examples/{declarative => qtquick}/modelviews/gridview/pics/VideoPlayer_48.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/PetsModel.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/PressAndHoldButton.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/RecipesModel.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/TextButton.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/ToggleButton.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/arrow-down.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/arrow-up.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/fruit-salad.jpg (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/hamburger.jpg (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/lemonade.jpg (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/list-delete.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/minus-sign.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/moreDown.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/moreUp.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/pancakes.jpg (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/plus-sign.png (100%) rename examples/{declarative => qtquick}/modelviews/listview/content/pics/vegetable-soup.jpg (100%) rename examples/{declarative => qtquick}/modelviews/listview/dynamiclist.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/expandingdelegates.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/highlight.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/highlightranges.qml (100%) rename examples/{declarative => qtquick}/modelviews/listview/sections.qml (100%) rename examples/{declarative => qtquick}/modelviews/modelviews.pro (100%) rename examples/{declarative => qtquick}/modelviews/modelviews.qml (99%) rename examples/{declarative => qtquick}/modelviews/modelviews.qmlproject (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/dataobject.cpp (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/dataobject.h (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/main.cpp (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/objectlistmodel.pro (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/objectlistmodel.qmlproject (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/objectlistmodel.qrc (100%) rename examples/{declarative => qtquick}/modelviews/objectlistmodel/view.qml (100%) rename examples/{declarative/particles/itemparticle/content => qtquick/modelviews/package}/Delegate.qml (100%) rename examples/{declarative => qtquick}/modelviews/package/view.qml (96%) create mode 100644 examples/qtquick/modelviews/parallax/content/Clock.qml rename examples/{declarative => qtquick}/modelviews/parallax/content/ParallaxView.qml (100%) rename examples/{declarative/ui-components/dialcontrol => qtquick/modelviews/parallax}/content/QuitButton.qml (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/Smiley.qml (100%) create mode 100644 examples/qtquick/modelviews/parallax/content/background.png create mode 100644 examples/qtquick/modelviews/parallax/content/center.png create mode 100644 examples/qtquick/modelviews/parallax/content/clock-night.png create mode 100644 examples/qtquick/modelviews/parallax/content/clock.png create mode 100644 examples/qtquick/modelviews/parallax/content/hour.png create mode 100644 examples/qtquick/modelviews/parallax/content/minute.png rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/background.jpg (100%) rename examples/{declarative/shadereffects/content => qtquick/modelviews/parallax/content/pics}/face-smile.png (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/home-page.png (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/home-page.svg (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/shadow.png (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/yast-joystick.png (100%) rename examples/{declarative => qtquick}/modelviews/parallax/content/pics/yast-wol.png (100%) rename examples/{declarative/ui-components/dialcontrol => qtquick/modelviews/parallax}/content/quit.png (100%) create mode 100644 examples/qtquick/modelviews/parallax/content/second.png rename examples/{declarative => qtquick}/modelviews/parallax/parallax.qml (97%) rename examples/{declarative => qtquick}/modelviews/pathview/pathview-example.qml (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/AddressBook_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/AudioPlayer_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/Camera_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/DateBook_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/EMail_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/TodoList_48.png (100%) rename examples/{declarative => qtquick}/modelviews/pathview/pics/VideoPlayer_48.png (100%) rename examples/{declarative => qtquick}/modelviews/stringlistmodel/main.cpp (100%) rename examples/{declarative => qtquick}/modelviews/stringlistmodel/stringlistmodel.pro (100%) rename examples/{declarative => qtquick}/modelviews/stringlistmodel/stringlistmodel.qrc (100%) rename examples/{declarative => qtquick}/modelviews/stringlistmodel/view.qml (100%) rename examples/{declarative => qtquick}/modelviews/visualdatamodel/dragselection.qml (100%) rename examples/{declarative => qtquick}/modelviews/visualdatamodel/slideshow.qml (100%) rename examples/{declarative => qtquick}/modelviews/visualdatamodel/sortedmodel.qml (100%) rename examples/{declarative => qtquick}/modelviews/visualdatamodel/visualdatamodel.qmlproject (100%) rename examples/{declarative => qtquick}/modelviews/visualitemmodel/visualitemmodel.qml (98%) rename examples/{declarative/touchinteraction => qtquick}/mousearea/mousearea-example.qml (100%) rename examples/{declarative => qtquick}/openglunderqml/main.cpp (100%) rename examples/{declarative => qtquick}/openglunderqml/main.qml (100%) rename examples/{declarative => qtquick}/openglunderqml/openglunderqml.pro (100%) rename examples/{declarative => qtquick}/openglunderqml/squircle.cpp (100%) rename examples/{declarative => qtquick}/openglunderqml/squircle.h (100%) rename examples/{declarative => qtquick}/painteditem/painteditem.pro (100%) rename examples/{declarative => qtquick}/painteditem/smile/main.cpp (100%) rename examples/{declarative => qtquick}/painteditem/smile/smile.pro (100%) rename examples/{declarative => qtquick}/painteditem/smile/smile.qml (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/TextBalloonPlugin/plugin.h (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/TextBalloonPlugin/qmldir (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/textballoon.cpp (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/textballoon.h (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/textballoons.pro (100%) rename examples/{declarative => qtquick}/painteditem/textballoons/textballoons.qml (100%) rename examples/{declarative => qtquick}/positioners/content/Button.qml (100%) rename examples/{declarative => qtquick}/positioners/content/add.png (100%) rename examples/{declarative => qtquick}/positioners/content/del.png (100%) rename examples/{declarative => qtquick}/positioners/positioners-attachedproperties.qml (100%) rename examples/{declarative => qtquick}/positioners/positioners.qml (98%) create mode 100644 examples/qtquick/qtquick.pro rename examples/{declarative => qtquick}/righttoleft/layoutdirection/layoutdirection.qml (100%) rename examples/{declarative => qtquick}/righttoleft/layoutdirection/layoutdirection.qmlproject (100%) rename examples/{declarative => qtquick}/righttoleft/layoutmirroring/layoutmirroring.qml (100%) rename examples/{declarative => qtquick}/righttoleft/layoutmirroring/layoutmirroring.qmlproject (100%) rename examples/{declarative => qtquick}/righttoleft/textalignment/textalignment.qml (100%) rename examples/{declarative => qtquick}/righttoleft/textalignment/textalignment.qmlproject (100%) rename examples/{declarative => qtquick}/shadereffects/content/Slider.qml (100%) rename examples/{declarative/toys/dynamicscene/content/images => qtquick/shadereffects/content}/face-smile.png (100%) rename examples/{declarative => qtquick}/shadereffects/content/qt-logo.png (100%) create mode 100644 examples/qtquick/shadereffects/shadereffects.qml rename examples/{declarative => qtquick}/text/fonts/availableFonts.qml (100%) rename examples/{declarative => qtquick}/text/fonts/banner.qml (100%) rename examples/{declarative => qtquick}/text/fonts/content/fonts/tarzeau_ocr_a.ttf (100%) rename examples/{declarative => qtquick}/text/fonts/fonts.qml (100%) rename examples/{declarative => qtquick}/text/fonts/hello.qml (100%) rename examples/{declarative => qtquick}/text/imgtag/TextWithImage.qml (100%) rename examples/{declarative => qtquick}/text/imgtag/images/face-sad.png (100%) rename examples/{declarative => qtquick}/text/imgtag/images/face-smile-big.png (100%) rename examples/{declarative => qtquick}/text/imgtag/images/face-smile.png (100%) rename examples/{declarative => qtquick}/text/imgtag/images/heart200.png (100%) rename examples/{declarative => qtquick}/text/imgtag/images/qtlogo.png (100%) rename examples/{declarative => qtquick}/text/imgtag/images/starfish_2.png (100%) rename examples/{declarative => qtquick}/text/imgtag/imgtag.qml (100%) rename examples/{declarative => qtquick}/text/styledtext-layout.qml (100%) rename examples/{declarative => qtquick}/text/text.qml (99%) rename examples/{declarative => qtquick}/text/text.qmlproject (100%) rename examples/{declarative => qtquick}/text/textselection/pics/endHandle.png (100%) rename examples/{declarative => qtquick}/text/textselection/pics/endHandle.sci (100%) rename examples/{declarative => qtquick}/text/textselection/pics/startHandle.png (100%) rename examples/{declarative => qtquick}/text/textselection/pics/startHandle.sci (100%) rename examples/{declarative => qtquick}/text/textselection/textselection.qml (100%) rename examples/{declarative => qtquick}/threading/threadedlistmodel/dataloader.js (100%) rename examples/{declarative => qtquick}/threading/threadedlistmodel/threadedlistmodel.qmlproject (100%) rename examples/{declarative => qtquick}/threading/threadedlistmodel/timedisplay.qml (100%) rename examples/{declarative => qtquick}/threading/workerscript/workerscript.js (100%) rename examples/{declarative => qtquick}/threading/workerscript/workerscript.qml (100%) rename examples/{declarative => qtquick}/threading/workerscript/workerscript.qmlproject (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/bearwhack.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/Bear0.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/Bear1.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/Bear2.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/Bear3.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/BearB.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/ParticleFlame.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/blur-circle.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/blur-circle3.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/heart-blur.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/content/title.png (100%) rename examples/{declarative => qtquick}/touchinteraction/multipointtouch/multiflame.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/pincharea/flickresize.qml (100%) rename examples/{declarative => qtquick}/touchinteraction/pincharea/qt-logo.jpg (100%) rename examples/{declarative => qtquick}/touchinteraction/touchinteraction.qml (94%) rename examples/{declarative => qtquick}/touchinteraction/touchinteraction.qmlproject (100%) rename examples/{declarative => }/shared/Button.qml (100%) rename examples/{declarative => }/shared/LauncherList.qml (97%) rename examples/{declarative => }/shared/README (100%) rename examples/{declarative => }/shared/SimpleLauncherDelegate.qml (100%) rename examples/{declarative/shared => shared/images}/back.png (100%) create mode 100644 examples/shared/qmldir create mode 100644 examples/shared/shared.h create mode 100644 examples/shared/shared.pro rename examples/{declarative => }/tutorials/dynamicview/dynamicview1/PetsModel.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview1/dynamicview.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview2/PetsModel.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview2/dynamicview.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview3/PetsModel.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview3/dynamicview.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview4/ListSelector.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview4/PetsModel.qml (100%) rename examples/{declarative => }/tutorials/dynamicview/dynamicview4/dynamicview.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter1-basics/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter1-basics/chapter1-basics.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter1-basics/main.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter1-basics/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter1-basics/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter2-methods/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter2-methods/chapter2-methods.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter2-methods/main.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter2-methods/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter2-methods/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter3-bindings/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter3-bindings/chapter3-bindings.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter3-bindings/main.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter3-bindings/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter3-bindings/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/main.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter4-customPropertyTypes/pieslice.h (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/main.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/pieslice.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter5-listproperties/pieslice.h (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/app.qml (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/chapter6-plugins.pro (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/chartsplugin.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/chartsplugin.h (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/piechart.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/piechart.h (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/pieslice.cpp (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/pieslice.h (100%) rename examples/{declarative => }/tutorials/extending/extending.pro (100%) rename examples/{declarative => }/tutorials/helloworld/Cell.qml (100%) rename examples/{declarative => }/tutorials/helloworld/tutorial1.qml (100%) rename examples/{declarative => }/tutorials/helloworld/tutorial2.qml (100%) rename examples/{declarative => }/tutorials/helloworld/tutorial3.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame1/Block.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame1/Button.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame1/samegame.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame1/samegame1.qmlproject (100%) rename examples/{declarative => }/tutorials/samegame/samegame2/Block.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame2/Button.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame2/samegame.js (100%) rename examples/{declarative => }/tutorials/samegame/samegame2/samegame.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame2/samegame2.qmlproject (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/Block.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/Button.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/Dialog.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/samegame.js (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/samegame.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame3/samegame3.qmlproject (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/content/BoomBlock.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/content/Button.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/content/Dialog.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/content/samegame.js (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/highscores/README (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/highscores/score_data.xml (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/highscores/score_style.xsl (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/highscores/scores.php (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/samegame.qml (100%) rename examples/{declarative => }/tutorials/samegame/samegame4/samegame4.qmlproject (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/background.jpg (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/blueStar.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/blueStone.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/greenStar.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/greenStone.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/redStar.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/redStone.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/star.png (100%) rename examples/{declarative => }/tutorials/samegame/shared/pics/yellowStone.png (100%) rename examples/{declarative => tutorials}/ui-components/dialcontrol/content/Dial.qml (100%) rename examples/{declarative/imageelements/image.qml => tutorials/ui-components/dialcontrol/content/QuitButton.qml} (73%) rename examples/{declarative => tutorials}/ui-components/dialcontrol/content/background.png (100%) rename examples/{declarative => tutorials}/ui-components/dialcontrol/content/needle.png (100%) rename examples/{declarative => tutorials}/ui-components/dialcontrol/content/needle_shadow.png (100%) rename examples/{declarative => tutorials}/ui-components/dialcontrol/content/overlay.png (100%) create mode 100644 examples/tutorials/ui-components/dialcontrol/content/quit.png rename examples/{declarative => tutorials}/ui-components/dialcontrol/dialcontrol.qml (100%) rename examples/{declarative => tutorials}/ui-components/flipable/content/5_heart.png (100%) rename examples/{declarative => tutorials}/ui-components/flipable/content/9_club.png (100%) rename examples/{declarative => tutorials}/ui-components/flipable/content/Card.qml (100%) rename examples/{declarative => tutorials}/ui-components/flipable/content/back.png (100%) rename examples/{declarative => tutorials}/ui-components/flipable/flipable.qml (100%) rename examples/{declarative => tutorials}/ui-components/progressbar/content/ProgressBar.qml (100%) rename examples/{declarative => tutorials}/ui-components/progressbar/content/background.png (100%) rename examples/{declarative => tutorials}/ui-components/progressbar/main.qml (100%) rename examples/{declarative => tutorials}/ui-components/scrollbar/ScrollBar.qml (100%) rename examples/{declarative => tutorials}/ui-components/scrollbar/main.qml (100%) rename examples/{declarative => tutorials}/ui-components/scrollbar/pics/niagara_falls.jpg (100%) rename examples/{declarative => tutorials}/ui-components/scrollbar/scrollbar.qmlproject (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/SearchBox.qml (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/images/clear.png (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/images/lineedit-bg-focus.png (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/images/lineedit-bg.png (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/main.qml (100%) rename examples/{declarative => tutorials}/ui-components/searchbox/searchbox.qmlproject (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/content/Switch.qml (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/content/background.png (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/content/background.svg (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/content/knob.png (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/content/knob.svg (100%) rename examples/{declarative => tutorials}/ui-components/slideswitch/slideswitch.qml (100%) rename examples/{declarative => tutorials}/ui-components/spinner/content/Spinner.qml (100%) rename examples/{declarative => tutorials}/ui-components/spinner/content/spinner-bg.png (100%) rename examples/{declarative => tutorials}/ui-components/spinner/content/spinner-select.png (100%) rename examples/{declarative => tutorials}/ui-components/spinner/main.qml (100%) rename examples/{declarative => tutorials}/ui-components/spinner/spinner.qmlproject (100%) rename examples/{declarative => tutorials}/ui-components/tabwidget/TabWidget.qml (100%) rename examples/{declarative => tutorials}/ui-components/tabwidget/main.qml (100%) rename examples/{declarative => tutorials}/ui-components/tabwidget/tab.png (100%) rename examples/{declarative => tutorials}/ui-components/tabwidget/tabwidget.qmlproject (100%) rename examples/{declarative => }/window/Window.qml (100%) rename examples/{declarative => }/window/screen/screenInfo.qml (100%) rename examples/{declarative => }/window/standalone.qml (100%) rename examples/{declarative => }/window/window.cpp (100%) rename examples/{declarative => }/window/window.pro (100%) diff --git a/.gitignore b/.gitignore index e1bf85aa29..4c8776bc5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,6 @@ # This file is used to ignore files which are generated in the Qt build system # ---------------------------------------------------------------------------- -examples/*/*/* -!examples/*/*/*[.]* -!examples/*/*/README -examples/*/*/*[.]app -!examples/declarative/* -!examples/tutorials/* -!examples/tutorials/*/* -!examples/ja_JP/*/* -demos/*/* -!demos/spectrum/* -demos/spectrum/bin -!demos/*/*[.]* -demos/*/*[.]app -!demos/declarative/* config.tests/*/*/* !config.tests/*/*/*[.]* config.tests/*/*/*[.]app @@ -273,4 +259,4 @@ tests/auto/*/*.o tests/auto/*/*.moc tests/auto/*/*/*.o tests/auto/*/*/*.moc -src/declarative/generated/ \ No newline at end of file +src/declarative/generated/ diff --git a/doc/config/qtquick.qdocconf b/doc/config/qtquick.qdocconf index 69e860919e..3f4645aeaa 100644 --- a/doc/config/qtquick.qdocconf +++ b/doc/config/qtquick.qdocconf @@ -19,7 +19,8 @@ headerdirs += ../src \ imagedirs += ../src/images \ sourcedirs += ../src \ - ../../src + ../../src \ + ../../examples #indexes = $QT5DOC/doc/html/qt.index diff --git a/doc/src/examples/examples-groups.qdoc b/doc/src/examples/examples-groups.qdoc index 9a6dafa435..a346794b96 100644 --- a/doc/src/examples/examples-groups.qdoc +++ b/doc/src/examples/examples-groups.qdoc @@ -31,15 +31,6 @@ \image qml-i18n-example.png \brief This is an internationalization example */ -/*! - \title QML Examples - Shader Effects - \example declarative/shadereffects - \image qml-shadereffects-example.png - \brief This is a shader effects example - - This example demonstrates a couple of visual effects that you can perform - with shaders in QtQuick 2.0 -*/ /*! \title QML Examples - Positioners \example declarative/positioners @@ -48,16 +39,6 @@ This example demonstrates the positioners and some of their animations. */ -/*! - \title QML Examples - Animation - \example declarative/animation - \brief This is a collection of QML examples - \image qml-animations-example.png - - This is a collection of small QML examples relating to animation. Each example is - a small QML file, usually containing or emphasizing a particular element or - feature. You can run and observe the behavior of each example. -*/ /*! \title QML Examples - Image Elements \example declarative/imageelements diff --git a/doc/src/examples/examples-toys.qdoc b/doc/src/examples/examples-toys.qdoc index f076c1de6c..7414579e19 100644 --- a/doc/src/examples/examples-toys.qdoc +++ b/doc/src/examples/examples-toys.qdoc @@ -26,13 +26,6 @@ ****************************************************************************/ -/*! - \title QML Example - Calculator - \example declarative/calculator - \brief This is an example application written in QML. - \image qml-calculator-demo-small.png -*/ - /*! \title QML Example - Samegame \example declarative/samegame diff --git a/examples/HACKING b/examples/HACKING new file mode 100644 index 0000000000..a3aa3e9a77 --- /dev/null +++ b/examples/HACKING @@ -0,0 +1,23 @@ +Some guidelines for QtDeclarative examples + +Snippets +--- +Snippets are snatches of QML code that won't even run on their own. They don't belong here, they belong in doc/src/snippets. They should be contained in files that will compile on their own, for automated syntax validation, but don't have to look like anything. + +Examples +--- + +Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements). The code should be held to a high level of quality, and should be understandable by people new to QML. + +Unless the demonstrated feature uses it, assume no interface devices other than a screen that can show a 320x480 rectangle and a generic pointing device (with the shared subset of mouse/touch functionality). + +Groups of similar examples should be placed in one folder with a single launcher application, which uses the QtQuick.Examples module for common components. + +The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher. + +Demos +--- + +Demos are examples of creating full applications using QML. They should fit both a desktop and a mobile form factor, they should have their own start screen and method of exiting the application. They should be at a level of quality that you'd be comfortable submitting them to an app store for a platform of the appropriate hardware (screen size, input methods, etc.). The code should be written to a level that is easily understood and modified by a QML expert. + +Demos should have a qdoc file in their directory explaining the demo at a high level. The demo should be buildable as a full C++ application and preferably runnable with the standard qml file launcher. diff --git a/examples/declarative/README b/examples/README similarity index 99% rename from examples/declarative/README rename to examples/README index 56c48d71fb..aba1e2cc0d 100644 --- a/examples/declarative/README +++ b/examples/README @@ -8,6 +8,5 @@ and loading data models from C++ and interacting with them. Mostof these examples can be viewed directly with the QML viewer utility, without requiring compilation. - Documentation for these examples can be found via the Examples link in the main Qt documentation. diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro deleted file mode 100644 index 883c0afe2d..0000000000 --- a/examples/declarative/declarative.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = subdirs - -# These examples contain some C++ and need to be built -SUBDIRS = \ - cppextensions \ - minehunt \ - modelviews \ - painteditem \ - tutorials \ - script - -# These examples contain no C++ and can simply be copied -sources.files = \ - animation \ - calculator \ - cppextensions \ - flickr \ - i18n \ - imageelements \ - keyinteraction \ - photoviewer \ - positioners \ - rssnews \ - samegame \ - snake \ - sqllocalstorage \ - text \ - threading \ - touchinteraction \ - toys \ - twitter \ - ui-components \ - webbrowser \ - xml - - -sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative -INSTALLS += sources diff --git a/examples/declarative/shadereffects/shadereffects.qml b/examples/declarative/shadereffects/shadereffects.qml deleted file mode 100644 index 842e42b89f..0000000000 --- a/examples/declarative/shadereffects/shadereffects.qml +++ /dev/null @@ -1,300 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the Declarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Image { - width: 640 - height: 360 - source: "../snake/content/pics/background.png" - - ShaderEffectSource { - id: theSource - sourceItem: theItem - smooth: true - } - - function saturate(x) { - return Math.min(Math.max(x, 0), 1) - } - - function sliderToColor(x) { - return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)), - saturate(Math.min(6 * x, 4 - 6 * x)), - saturate(Math.min(6 * x - 2, 6 - 6 * x))) - } - - Grid { - anchors.centerIn: parent - columns: 3 - - Item { - id: theItem - width: 180 - height: 180 - ListView { - anchors.centerIn: parent - width: 160 - height: 140 - clip: true - snapMode: ListView.SnapOneItem - model: VisualItemModel { - Text { - width: 160 - height: 140 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: 120 - font.family: "Times" - color: "blue" - text: "Qt" - } - Image { - width: 160 - height: 140 - source: "content/qt-logo.png" - smooth: true - } - Image { - width: 160 - height: 140 - source: "content/face-smile.png" - smooth: true - } - } - } - } - ShaderEffect { - width: 180 - height: 180 - property variant source: theSource - property real amplitude: 0.04 * wobbleSlider.value - property real frequency: 20 - property real time: 0 - NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } - fragmentShader: - "uniform lowp float qt_Opacity;" + - "uniform highp float amplitude;" + - "uniform highp float frequency;" + - "uniform highp float time;" + - "uniform sampler2D source;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + - " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + - "}" - Slider { - id: wobbleSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffect { - width: 180 - height: 180 - property variant source: theSource - property variant shadow: ShaderEffectSource { - smooth: true - sourceItem: ShaderEffect { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(0.0, 1.0 / height) - property variant source: ShaderEffectSource { - smooth: true - sourceItem: ShaderEffect { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(1.0 / width, 0.0) - property variant source: theSource - fragmentShader: " - uniform lowp float qt_Opacity; - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; - }" - } - } - fragmentShader: " - uniform lowp float qt_Opacity; - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; - }" - } - } - property real angle: 0 - property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle)) - NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } - property variant delta: Qt.size(offset.x / width, offset.y / height) - property real darkness: shadowSlider.value - fragmentShader: " - uniform lowp float qt_Opacity; - uniform highp vec2 offset; - uniform sampler2D source; - uniform sampler2D shadow; - uniform highp float darkness; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 fg = texture2D(source, qt_TexCoord0); - lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); - gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity; - }" - Slider { - id: shadowSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffect { - width: 180 - height: 180 - property variant source: theSource - property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform sampler2D source; - uniform highp vec2 delta; - uniform highp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta); - lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y)); - lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y)); - lowp vec4 br = texture2D(source, qt_TexCoord0 + delta); - lowp vec4 gx = (tl + bl) - (tr + br); - lowp vec4 gy = (tl + tr) - (bl + br); - gl_FragColor.xyz = vec3(0.); - gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity; - }" - } - ShaderEffect { - width: 180 - height: 180 - property variant source: theSource - property color tint: sliderToColor(colorizeSlider.value) - fragmentShader: " - uniform sampler2D source; - uniform lowp vec4 tint; - uniform lowp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 c = texture2D(source, qt_TexCoord0); - lowp float lo = min(min(c.x, c.y), c.z); - lowp float hi = max(max(c.x, c.y), c.z); - gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w); - }" - Slider { - id: colorizeSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffect { - width: 180 - height: 180 - mesh: Qt.size(10, 10) - property variant source: theSource - property real bend: 0 - property real minimize: 0 - property real side: genieSlider.value - SequentialAnimation on bend { - loops: Animation.Infinite - NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1600 } - NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1000 } - } - SequentialAnimation on minimize { - loops: Animation.Infinite - PauseAnimation { duration: 300 } - NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1000 } - NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1300 } - } - vertexShader: " - uniform highp mat4 qt_Matrix; - uniform highp float bend; - uniform highp float minimize; - uniform highp float side; - uniform highp float width; - uniform highp float height; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - qt_TexCoord0 = qt_MultiTexCoord0; - highp vec4 pos = qt_Vertex; - pos.y = mix(qt_Vertex.y, height, minimize); - highp float t = pos.y / height; - t = (3. - 2. * t) * t * t; - pos.x = mix(qt_Vertex.x, side * width, t * bend); - gl_Position = qt_Matrix * pos; - }" - Slider { - id: genieSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - } -} diff --git a/examples/declarative/tutorials/tutorials.pro b/examples/declarative/tutorials/tutorials.pro deleted file mode 100644 index 0a82c1e704..0000000000 --- a/examples/declarative/tutorials/tutorials.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - extending - diff --git a/examples/declarative/calculator/content/Button.qml b/examples/demos/calculator/CalculatorCore/Button.qml similarity index 98% rename from examples/declarative/calculator/content/Button.qml rename to examples/demos/calculator/CalculatorCore/Button.qml index 6b480eb9b8..872fc81174 100644 --- a/examples/declarative/calculator/content/Button.qml +++ b/examples/demos/calculator/CalculatorCore/Button.qml @@ -72,7 +72,7 @@ BorderImage { id: mouseArea anchors.fill: parent onClicked: { - doOp(operation) + window.doOp(operation) button.clicked() } } diff --git a/examples/declarative/calculator/content/Display.qml b/examples/demos/calculator/CalculatorCore/Display.qml similarity index 100% rename from examples/declarative/calculator/content/Display.qml rename to examples/demos/calculator/CalculatorCore/Display.qml diff --git a/examples/declarative/calculator/content/calculator.js b/examples/demos/calculator/CalculatorCore/calculator.js similarity index 96% rename from examples/declarative/calculator/content/calculator.js rename to examples/demos/calculator/CalculatorCore/calculator.js index 7c363c7f30..e2b5692cf3 100644 --- a/examples/declarative/calculator/content/calculator.js +++ b/examples/demos/calculator/CalculatorCore/calculator.js @@ -15,6 +15,10 @@ function disabled(op) { } function doOperation(op) { + if (op == '*')//Keyboard Aliases + op = multiplication; + if (op == '/') + op = division; if (disabled(op)) { return } diff --git a/examples/declarative/calculator/content/images/button-.png b/examples/demos/calculator/CalculatorCore/images/button-.png similarity index 100% rename from examples/declarative/calculator/content/images/button-.png rename to examples/demos/calculator/CalculatorCore/images/button-.png diff --git a/examples/declarative/calculator/content/images/button-blue.png b/examples/demos/calculator/CalculatorCore/images/button-blue.png similarity index 100% rename from examples/declarative/calculator/content/images/button-blue.png rename to examples/demos/calculator/CalculatorCore/images/button-blue.png diff --git a/examples/declarative/calculator/content/images/button-green.png b/examples/demos/calculator/CalculatorCore/images/button-green.png similarity index 100% rename from examples/declarative/calculator/content/images/button-green.png rename to examples/demos/calculator/CalculatorCore/images/button-green.png diff --git a/examples/declarative/calculator/content/images/button-purple.png b/examples/demos/calculator/CalculatorCore/images/button-purple.png similarity index 100% rename from examples/declarative/calculator/content/images/button-purple.png rename to examples/demos/calculator/CalculatorCore/images/button-purple.png diff --git a/examples/declarative/calculator/content/images/button-red.png b/examples/demos/calculator/CalculatorCore/images/button-red.png similarity index 100% rename from examples/declarative/calculator/content/images/button-red.png rename to examples/demos/calculator/CalculatorCore/images/button-red.png diff --git a/examples/declarative/calculator/content/images/display.png b/examples/demos/calculator/CalculatorCore/images/display.png similarity index 100% rename from examples/declarative/calculator/content/images/display.png rename to examples/demos/calculator/CalculatorCore/images/display.png diff --git a/examples/declarative/calculator/content/qmldir b/examples/demos/calculator/CalculatorCore/qmldir similarity index 100% rename from examples/declarative/calculator/content/qmldir rename to examples/demos/calculator/CalculatorCore/qmldir diff --git a/examples/demos/calculator/calculator-desktop.qml b/examples/demos/calculator/calculator-desktop.qml new file mode 100644 index 0000000000..7e72f50beb --- /dev/null +++ b/examples/demos/calculator/calculator-desktop.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.0 +import "CalculatorCore" +import "CalculatorCore/calculator.js" as CalcEngine + +Rectangle { + id: window + + width: 640; height: 480 + color: "#282828" + + property string rotateLeft: "\u2939" + property string rotateRight: "\u2935" + property string leftArrow: "\u2190" + property string division : "\u00f7" + property string multiplication : "\u00d7" + property string squareRoot : "\u221a" + property string plusminus : "\u00b1" + + function doOp(operation) { CalcEngine.doOperation(operation) } + focus: true + Keys.onPressed: doOp(event.text); + + Item { + id: main + width: 640 + height: 480 + anchors.centerIn: parent + + Column { + id: box; spacing: 8 + + anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } + + Display { + id: display + width: box.width-3 + height: 64 + } + + Column { + id: column; spacing: 6 + + property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Row { + spacing: 6 + Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" } + Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } + Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } + Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } + } + + Row { + spacing: 6 + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } + } + + Grid { + id: grid; rows: 5; columns: 5; spacing: 6 + + property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) + + Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: division } + Button { width: grid.w; height: column.h; operation: squareRoot } + Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: multiplication } + Button { width: grid.w; height: column.h; operation: "x^2" } + Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "-" } + Button { width: grid.w; height: column.h; operation: "1/x" } + Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "." } + Button { width: grid.w; height: column.h; operation: plusminus } + Button { width: grid.w; height: column.h; operation: "+" } + Button { width: grid.w; height: column.h; operation: "="; color: 'red' } + } + } + } + + } +} diff --git a/examples/declarative/calculator/calculator.qml b/examples/demos/calculator/calculator-mobile.qml similarity index 97% rename from examples/declarative/calculator/calculator.qml rename to examples/demos/calculator/calculator-mobile.qml index e2d6679b89..b4fc372b39 100644 --- a/examples/declarative/calculator/calculator.qml +++ b/examples/demos/calculator/calculator-mobile.qml @@ -41,13 +41,13 @@ import QtQuick 2.0 import QtQuick.Window 2.0 -import "content" -import "content/calculator.js" as CalcEngine +import "CalculatorCore" +import "CalculatorCore/calculator.js" as CalcEngine Rectangle { id: window - width: 360; height: 480 + width: 320; height: 480 color: "#282828" property string rotateLeft: "\u2939" @@ -64,6 +64,7 @@ Rectangle { id: main state: "orientation " + Screen.orientation + //Note: Assumes a primarily portrait device property bool landscapeWindow: window.width > window.height property real baseWidth: landscapeWindow ? window.height : window.width property real baseHeight: landscapeWindow ? window.width : window.height diff --git a/examples/demos/calculator/calculator.pro b/examples/demos/calculator/calculator.pro new file mode 100644 index 0000000000..3bf3b8ca2f --- /dev/null +++ b/examples/demos/calculator/calculator.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick declarative +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator +qml.files = calculator-desktop.qml calculator-mobile.qml CalculatorCore +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator +INSTALLS += target qml diff --git a/examples/demos/calculator/calculator.qdoc b/examples/demos/calculator/calculator.qdoc new file mode 100644 index 0000000000..e94bdb4cfd --- /dev/null +++ b/examples/demos/calculator/calculator.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QML Demo - Calculator + \example declarative/calculator + \brief This is an example calculator application written in QML. + \image qml-calculator-demo-small.png + + The Calculator demo implements a simple calculator in QML. It is written for desktop and portrait devices, + although on device it supports orientation changes. +*/ + diff --git a/examples/demos/calculator/main.cpp b/examples/demos/calculator/main.cpp new file mode 100644 index 0000000000..c7f9b29952 --- /dev/null +++ b/examples/demos/calculator/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +void usage() +{ + printf("Pass -desktop to use the Desktop UI"); + exit(0); +} + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc,argv); + QQuickView view; + QUrl launchFile = QUrl::fromLocalFile(QLatin1String("calculator-mobile.qml")); + if (app.arguments().contains(QLatin1String("-help"))) + usage(); + if (app.arguments().contains(QLatin1String("-desktop"))) + launchFile = QUrl::fromLocalFile(QLatin1String("calculator-desktop.qml")); + view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); + view.setSource(launchFile); + view.show(); + return app.exec(); +} + diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/demos/clocks/clocks.qml similarity index 100% rename from examples/declarative/toys/clocks/clocks.qml rename to examples/demos/clocks/clocks.qml diff --git a/examples/declarative/toys/clocks/content/Clock.qml b/examples/demos/clocks/content/Clock.qml similarity index 100% rename from examples/declarative/toys/clocks/content/Clock.qml rename to examples/demos/clocks/content/Clock.qml diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/demos/clocks/content/QuitButton.qml similarity index 100% rename from examples/declarative/animation/easing/content/QuitButton.qml rename to examples/demos/clocks/content/QuitButton.qml diff --git a/examples/declarative/toys/clocks/content/arrow.png b/examples/demos/clocks/content/arrow.png similarity index 100% rename from examples/declarative/toys/clocks/content/arrow.png rename to examples/demos/clocks/content/arrow.png diff --git a/examples/declarative/toys/clocks/content/background.png b/examples/demos/clocks/content/background.png similarity index 100% rename from examples/declarative/toys/clocks/content/background.png rename to examples/demos/clocks/content/background.png diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/center.png b/examples/demos/clocks/content/center.png similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/center.png rename to examples/demos/clocks/content/center.png diff --git a/examples/declarative/toys/clocks/content/clock-night.png b/examples/demos/clocks/content/clock-night.png similarity index 100% rename from examples/declarative/toys/clocks/content/clock-night.png rename to examples/demos/clocks/content/clock-night.png diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/clock.png b/examples/demos/clocks/content/clock.png similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/clock.png rename to examples/demos/clocks/content/clock.png diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/hour.png b/examples/demos/clocks/content/hour.png similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/hour.png rename to examples/demos/clocks/content/hour.png diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/minute.png b/examples/demos/clocks/content/minute.png similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/minute.png rename to examples/demos/clocks/content/minute.png diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/demos/clocks/content/quit.png similarity index 100% rename from examples/declarative/animation/easing/content/quit.png rename to examples/demos/clocks/content/quit.png diff --git a/examples/declarative/toys/clocks/content/second.png b/examples/demos/clocks/content/second.png similarity index 100% rename from examples/declarative/toys/clocks/content/second.png rename to examples/demos/clocks/content/second.png diff --git a/examples/declarative/toys/corkboards/content/Day.qml b/examples/demos/corkboards/content/Day.qml similarity index 100% rename from examples/declarative/toys/corkboards/content/Day.qml rename to examples/demos/corkboards/content/Day.qml diff --git a/examples/declarative/toys/corkboards/content/cork.jpg b/examples/demos/corkboards/content/cork.jpg similarity index 100% rename from examples/declarative/toys/corkboards/content/cork.jpg rename to examples/demos/corkboards/content/cork.jpg diff --git a/examples/declarative/toys/corkboards/content/note-yellow.png b/examples/demos/corkboards/content/note-yellow.png similarity index 100% rename from examples/declarative/toys/corkboards/content/note-yellow.png rename to examples/demos/corkboards/content/note-yellow.png diff --git a/examples/declarative/toys/corkboards/content/tack.png b/examples/demos/corkboards/content/tack.png similarity index 100% rename from examples/declarative/toys/corkboards/content/tack.png rename to examples/demos/corkboards/content/tack.png diff --git a/examples/declarative/toys/corkboards/corkboards.qml b/examples/demos/corkboards/corkboards.qml similarity index 100% rename from examples/declarative/toys/corkboards/corkboards.qml rename to examples/demos/corkboards/corkboards.qml diff --git a/examples/demos/demos.pro b/examples/demos/demos.pro new file mode 100644 index 0000000000..abe718b910 --- /dev/null +++ b/examples/demos/demos.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = calculator diff --git a/examples/declarative/toys/dynamicscene/content/Button.qml b/examples/demos/dynamicscene/content/Button.qml similarity index 100% rename from examples/declarative/toys/dynamicscene/content/Button.qml rename to examples/demos/dynamicscene/content/Button.qml diff --git a/examples/declarative/toys/dynamicscene/content/GenericSceneItem.qml b/examples/demos/dynamicscene/content/GenericSceneItem.qml similarity index 100% rename from examples/declarative/toys/dynamicscene/content/GenericSceneItem.qml rename to examples/demos/dynamicscene/content/GenericSceneItem.qml diff --git a/examples/declarative/toys/dynamicscene/content/PaletteItem.qml b/examples/demos/dynamicscene/content/PaletteItem.qml similarity index 100% rename from examples/declarative/toys/dynamicscene/content/PaletteItem.qml rename to examples/demos/dynamicscene/content/PaletteItem.qml diff --git a/examples/declarative/toys/dynamicscene/content/PerspectiveItem.qml b/examples/demos/dynamicscene/content/PerspectiveItem.qml similarity index 100% rename from examples/declarative/toys/dynamicscene/content/PerspectiveItem.qml rename to examples/demos/dynamicscene/content/PerspectiveItem.qml diff --git a/examples/declarative/toys/dynamicscene/content/Sun.qml b/examples/demos/dynamicscene/content/Sun.qml similarity index 100% rename from examples/declarative/toys/dynamicscene/content/Sun.qml rename to examples/demos/dynamicscene/content/Sun.qml diff --git a/examples/declarative/toys/dynamicscene/content/images/NOTE b/examples/demos/dynamicscene/content/images/NOTE similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/NOTE rename to examples/demos/dynamicscene/content/images/NOTE diff --git a/examples/declarative/animation/basics/images/face-smile.png b/examples/demos/dynamicscene/content/images/face-smile.png similarity index 100% rename from examples/declarative/animation/basics/images/face-smile.png rename to examples/demos/dynamicscene/content/images/face-smile.png diff --git a/examples/declarative/toys/dynamicscene/content/images/moon.png b/examples/demos/dynamicscene/content/images/moon.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/moon.png rename to examples/demos/dynamicscene/content/images/moon.png diff --git a/examples/declarative/toys/dynamicscene/content/images/rabbit_brown.png b/examples/demos/dynamicscene/content/images/rabbit_brown.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/rabbit_brown.png rename to examples/demos/dynamicscene/content/images/rabbit_brown.png diff --git a/examples/declarative/toys/dynamicscene/content/images/rabbit_bw.png b/examples/demos/dynamicscene/content/images/rabbit_bw.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/rabbit_bw.png rename to examples/demos/dynamicscene/content/images/rabbit_bw.png diff --git a/examples/declarative/animation/basics/images/star.png b/examples/demos/dynamicscene/content/images/star.png similarity index 100% rename from examples/declarative/animation/basics/images/star.png rename to examples/demos/dynamicscene/content/images/star.png diff --git a/examples/declarative/animation/basics/images/sun.png b/examples/demos/dynamicscene/content/images/sun.png similarity index 100% rename from examples/declarative/animation/basics/images/sun.png rename to examples/demos/dynamicscene/content/images/sun.png diff --git a/examples/declarative/toys/dynamicscene/content/images/tree_s.png b/examples/demos/dynamicscene/content/images/tree_s.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/tree_s.png rename to examples/demos/dynamicscene/content/images/tree_s.png diff --git a/examples/declarative/toys/dynamicscene/content/itemCreation.js b/examples/demos/dynamicscene/content/itemCreation.js similarity index 100% rename from examples/declarative/toys/dynamicscene/content/itemCreation.js rename to examples/demos/dynamicscene/content/itemCreation.js diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/demos/dynamicscene/dynamicscene.qml similarity index 99% rename from examples/declarative/toys/dynamicscene/dynamicscene.qml rename to examples/demos/dynamicscene/dynamicscene.qml index e64eb0fd0f..c64df5cfc0 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.qml +++ b/examples/demos/dynamicscene/dynamicscene.qml @@ -48,7 +48,7 @@ Item { property int activeSuns: 0 property int centerOffset: 72 - height: 480; width: 360 + height: 480; width: 320 MouseArea { diff --git a/examples/declarative/flickr/content/Button.qml b/examples/demos/flickr/content/Button.qml similarity index 100% rename from examples/declarative/flickr/content/Button.qml rename to examples/demos/flickr/content/Button.qml diff --git a/examples/declarative/flickr/content/GridDelegate.qml b/examples/demos/flickr/content/GridDelegate.qml similarity index 100% rename from examples/declarative/flickr/content/GridDelegate.qml rename to examples/demos/flickr/content/GridDelegate.qml diff --git a/examples/declarative/flickr/content/ImageDetails.qml b/examples/demos/flickr/content/ImageDetails.qml similarity index 100% rename from examples/declarative/flickr/content/ImageDetails.qml rename to examples/demos/flickr/content/ImageDetails.qml diff --git a/examples/declarative/flickr/content/ListDelegate.qml b/examples/demos/flickr/content/ListDelegate.qml similarity index 100% rename from examples/declarative/flickr/content/ListDelegate.qml rename to examples/demos/flickr/content/ListDelegate.qml diff --git a/examples/declarative/flickr/content/Progress.qml b/examples/demos/flickr/content/Progress.qml similarity index 100% rename from examples/declarative/flickr/content/Progress.qml rename to examples/demos/flickr/content/Progress.qml diff --git a/examples/declarative/flickr/content/RssModel.qml b/examples/demos/flickr/content/RssModel.qml similarity index 100% rename from examples/declarative/flickr/content/RssModel.qml rename to examples/demos/flickr/content/RssModel.qml diff --git a/examples/declarative/flickr/content/ScrollBar.qml b/examples/demos/flickr/content/ScrollBar.qml similarity index 100% rename from examples/declarative/flickr/content/ScrollBar.qml rename to examples/demos/flickr/content/ScrollBar.qml diff --git a/examples/declarative/flickr/content/Slider.qml b/examples/demos/flickr/content/Slider.qml similarity index 100% rename from examples/declarative/flickr/content/Slider.qml rename to examples/demos/flickr/content/Slider.qml diff --git a/examples/declarative/flickr/content/TitleBar.qml b/examples/demos/flickr/content/TitleBar.qml similarity index 100% rename from examples/declarative/flickr/content/TitleBar.qml rename to examples/demos/flickr/content/TitleBar.qml diff --git a/examples/declarative/flickr/content/ToolBar.qml b/examples/demos/flickr/content/ToolBar.qml similarity index 100% rename from examples/declarative/flickr/content/ToolBar.qml rename to examples/demos/flickr/content/ToolBar.qml diff --git a/examples/declarative/flickr/content/UnifiedDelegate.qml b/examples/demos/flickr/content/UnifiedDelegate.qml similarity index 100% rename from examples/declarative/flickr/content/UnifiedDelegate.qml rename to examples/demos/flickr/content/UnifiedDelegate.qml diff --git a/examples/declarative/canvas/contents/images/gloss.png b/examples/demos/flickr/content/images/gloss.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/gloss.png rename to examples/demos/flickr/content/images/gloss.png diff --git a/examples/declarative/canvas/contents/images/lineedit.png b/examples/demos/flickr/content/images/lineedit.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/lineedit.png rename to examples/demos/flickr/content/images/lineedit.png diff --git a/examples/declarative/canvas/contents/images/lineedit.sci b/examples/demos/flickr/content/images/lineedit.sci similarity index 100% rename from examples/declarative/canvas/contents/images/lineedit.sci rename to examples/demos/flickr/content/images/lineedit.sci diff --git a/examples/declarative/flickr/content/images/noise.png b/examples/demos/flickr/content/images/noise.png similarity index 100% rename from examples/declarative/flickr/content/images/noise.png rename to examples/demos/flickr/content/images/noise.png diff --git a/examples/declarative/flickr/content/images/particle.png b/examples/demos/flickr/content/images/particle.png similarity index 100% rename from examples/declarative/flickr/content/images/particle.png rename to examples/demos/flickr/content/images/particle.png diff --git a/examples/declarative/canvas/contents/images/quit.png b/examples/demos/flickr/content/images/quit.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/quit.png rename to examples/demos/flickr/content/images/quit.png diff --git a/examples/declarative/flickr/content/images/squareParticle.png b/examples/demos/flickr/content/images/squareParticle.png similarity index 100% rename from examples/declarative/flickr/content/images/squareParticle.png rename to examples/demos/flickr/content/images/squareParticle.png diff --git a/examples/declarative/canvas/contents/images/stripes.png b/examples/demos/flickr/content/images/stripes.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/stripes.png rename to examples/demos/flickr/content/images/stripes.png diff --git a/examples/declarative/canvas/contents/images/titlebar.png b/examples/demos/flickr/content/images/titlebar.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/titlebar.png rename to examples/demos/flickr/content/images/titlebar.png diff --git a/examples/declarative/canvas/contents/images/titlebar.sci b/examples/demos/flickr/content/images/titlebar.sci similarity index 100% rename from examples/declarative/canvas/contents/images/titlebar.sci rename to examples/demos/flickr/content/images/titlebar.sci diff --git a/examples/declarative/canvas/contents/images/toolbutton.png b/examples/demos/flickr/content/images/toolbutton.png old mode 100755 new mode 100644 similarity index 100% rename from examples/declarative/canvas/contents/images/toolbutton.png rename to examples/demos/flickr/content/images/toolbutton.png diff --git a/examples/declarative/canvas/contents/images/toolbutton.sci b/examples/demos/flickr/content/images/toolbutton.sci similarity index 100% rename from examples/declarative/canvas/contents/images/toolbutton.sci rename to examples/demos/flickr/content/images/toolbutton.sci diff --git a/examples/declarative/flickr/content/qmldir b/examples/demos/flickr/content/qmldir similarity index 100% rename from examples/declarative/flickr/content/qmldir rename to examples/demos/flickr/content/qmldir diff --git a/examples/declarative/flickr/flickr-90.qml b/examples/demos/flickr/flickr-90.qml similarity index 100% rename from examples/declarative/flickr/flickr-90.qml rename to examples/demos/flickr/flickr-90.qml diff --git a/examples/declarative/flickr/flickr.qml b/examples/demos/flickr/flickr.qml similarity index 100% rename from examples/declarative/flickr/flickr.qml rename to examples/demos/flickr/flickr.qml diff --git a/examples/declarative/flickr/flickr.qmlproject b/examples/demos/flickr/flickr.qmlproject similarity index 100% rename from examples/declarative/flickr/flickr.qmlproject rename to examples/demos/flickr/flickr.qmlproject diff --git a/examples/declarative/minehunt/MinehuntCore/Explosion.qml b/examples/demos/minehunt/MinehuntCore/Explosion.qml similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/Explosion.qml rename to examples/demos/minehunt/MinehuntCore/Explosion.qml diff --git a/examples/declarative/minehunt/MinehuntCore/Tile.qml b/examples/demos/minehunt/MinehuntCore/Tile.qml similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/Tile.qml rename to examples/demos/minehunt/MinehuntCore/Tile.qml diff --git a/examples/declarative/minehunt/MinehuntCore/pics/back.png b/examples/demos/minehunt/MinehuntCore/pics/back.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/back.png rename to examples/demos/minehunt/MinehuntCore/pics/back.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/background.png b/examples/demos/minehunt/MinehuntCore/pics/background.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/background.png rename to examples/demos/minehunt/MinehuntCore/pics/background.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png b/examples/demos/minehunt/MinehuntCore/pics/bomb-color.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png rename to examples/demos/minehunt/MinehuntCore/pics/bomb-color.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/bomb.png b/examples/demos/minehunt/MinehuntCore/pics/bomb.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/bomb.png rename to examples/demos/minehunt/MinehuntCore/pics/bomb.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-sad.png b/examples/demos/minehunt/MinehuntCore/pics/face-sad.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/face-sad.png rename to examples/demos/minehunt/MinehuntCore/pics/face-sad.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png b/examples/demos/minehunt/MinehuntCore/pics/face-smile-big.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png rename to examples/demos/minehunt/MinehuntCore/pics/face-smile-big.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-smile.png b/examples/demos/minehunt/MinehuntCore/pics/face-smile.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/face-smile.png rename to examples/demos/minehunt/MinehuntCore/pics/face-smile.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/flag-color.png b/examples/demos/minehunt/MinehuntCore/pics/flag-color.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/flag-color.png rename to examples/demos/minehunt/MinehuntCore/pics/flag-color.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/flag.png b/examples/demos/minehunt/MinehuntCore/pics/flag.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/flag.png rename to examples/demos/minehunt/MinehuntCore/pics/flag.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/front.png b/examples/demos/minehunt/MinehuntCore/pics/front.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/front.png rename to examples/demos/minehunt/MinehuntCore/pics/front.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/quit.png b/examples/demos/minehunt/MinehuntCore/pics/quit.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/quit.png rename to examples/demos/minehunt/MinehuntCore/pics/quit.png diff --git a/examples/declarative/minehunt/MinehuntCore/pics/star.png b/examples/demos/minehunt/MinehuntCore/pics/star.png similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/pics/star.png rename to examples/demos/minehunt/MinehuntCore/pics/star.png diff --git a/examples/declarative/minehunt/MinehuntCore/qmldir b/examples/demos/minehunt/MinehuntCore/qmldir similarity index 100% rename from examples/declarative/minehunt/MinehuntCore/qmldir rename to examples/demos/minehunt/MinehuntCore/qmldir diff --git a/examples/declarative/minehunt/README b/examples/demos/minehunt/README similarity index 100% rename from examples/declarative/minehunt/README rename to examples/demos/minehunt/README diff --git a/examples/declarative/minehunt/main.cpp b/examples/demos/minehunt/main.cpp similarity index 100% rename from examples/declarative/minehunt/main.cpp rename to examples/demos/minehunt/main.cpp diff --git a/examples/declarative/minehunt/minehunt.cpp b/examples/demos/minehunt/minehunt.cpp similarity index 100% rename from examples/declarative/minehunt/minehunt.cpp rename to examples/demos/minehunt/minehunt.cpp diff --git a/examples/declarative/minehunt/minehunt.h b/examples/demos/minehunt/minehunt.h similarity index 100% rename from examples/declarative/minehunt/minehunt.h rename to examples/demos/minehunt/minehunt.h diff --git a/examples/declarative/minehunt/minehunt.pro b/examples/demos/minehunt/minehunt.pro similarity index 100% rename from examples/declarative/minehunt/minehunt.pro rename to examples/demos/minehunt/minehunt.pro diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/demos/minehunt/minehunt.qml similarity index 100% rename from examples/declarative/minehunt/minehunt.qml rename to examples/demos/minehunt/minehunt.qml diff --git a/examples/declarative/minehunt/minehunt.qmlproject b/examples/demos/minehunt/minehunt.qmlproject similarity index 100% rename from examples/declarative/minehunt/minehunt.qmlproject rename to examples/demos/minehunt/minehunt.qmlproject diff --git a/examples/declarative/minehunt/minehunt.qrc b/examples/demos/minehunt/minehunt.qrc similarity index 100% rename from examples/declarative/minehunt/minehunt.qrc rename to examples/demos/minehunt/minehunt.qrc diff --git a/examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml rename to examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml rename to examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/Button.qml b/examples/demos/photoviewer/PhotoViewerCore/Button.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/Button.qml rename to examples/demos/photoviewer/PhotoViewerCore/Button.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/EditableButton.qml rename to examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml rename to examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml rename to examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/RssModel.qml b/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/RssModel.qml rename to examples/demos/photoviewer/PhotoViewerCore/RssModel.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/Tag.qml b/examples/demos/photoviewer/PhotoViewerCore/Tag.qml similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/Tag.qml rename to examples/demos/photoviewer/PhotoViewerCore/Tag.qml diff --git a/examples/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png rename to examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png diff --git a/examples/declarative/photoviewer/PhotoViewerCore/images/busy.png b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/images/busy.png rename to examples/demos/photoviewer/PhotoViewerCore/images/busy.png diff --git a/examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png rename to examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png diff --git a/examples/declarative/photoviewer/PhotoViewerCore/qmldir b/examples/demos/photoviewer/PhotoViewerCore/qmldir similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/qmldir rename to examples/demos/photoviewer/PhotoViewerCore/qmldir diff --git a/examples/declarative/particles/itemparticle/content/script.js b/examples/demos/photoviewer/PhotoViewerCore/script/script.js similarity index 100% rename from examples/declarative/particles/itemparticle/content/script.js rename to examples/demos/photoviewer/PhotoViewerCore/script/script.js diff --git a/examples/declarative/photoviewer/i18n/base.ts b/examples/demos/photoviewer/i18n/base.ts similarity index 100% rename from examples/declarative/photoviewer/i18n/base.ts rename to examples/demos/photoviewer/i18n/base.ts diff --git a/examples/declarative/photoviewer/i18n/qml_fr.qm b/examples/demos/photoviewer/i18n/qml_fr.qm similarity index 100% rename from examples/declarative/photoviewer/i18n/qml_fr.qm rename to examples/demos/photoviewer/i18n/qml_fr.qm diff --git a/examples/declarative/photoviewer/i18n/qml_fr.ts b/examples/demos/photoviewer/i18n/qml_fr.ts similarity index 100% rename from examples/declarative/photoviewer/i18n/qml_fr.ts rename to examples/demos/photoviewer/i18n/qml_fr.ts diff --git a/examples/declarative/photoviewer/photoviewer.qml b/examples/demos/photoviewer/photoviewer.qml similarity index 100% rename from examples/declarative/photoviewer/photoviewer.qml rename to examples/demos/photoviewer/photoviewer.qml diff --git a/examples/declarative/photoviewer/photoviewer.qmlproject b/examples/demos/photoviewer/photoviewer.qmlproject similarity index 100% rename from examples/declarative/photoviewer/photoviewer.qmlproject rename to examples/demos/photoviewer/photoviewer.qmlproject diff --git a/examples/declarative/particles/plasmapatrol/PlasmaPatrol.qmlproject b/examples/demos/plasmapatrol/PlasmaPatrol.qmlproject similarity index 100% rename from examples/declarative/particles/plasmapatrol/PlasmaPatrol.qmlproject rename to examples/demos/plasmapatrol/PlasmaPatrol.qmlproject diff --git a/examples/declarative/particles/plasmapatrol/TODO b/examples/demos/plasmapatrol/TODO similarity index 100% rename from examples/declarative/particles/plasmapatrol/TODO rename to examples/demos/plasmapatrol/TODO diff --git a/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml b/examples/demos/plasmapatrol/content/BlasterHardpoint.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml rename to examples/demos/plasmapatrol/content/BlasterHardpoint.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Button.qml b/examples/demos/plasmapatrol/content/Button.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Button.qml rename to examples/demos/plasmapatrol/content/Button.qml diff --git a/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml b/examples/demos/plasmapatrol/content/CannonHardpoint.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml rename to examples/demos/plasmapatrol/content/CannonHardpoint.qml diff --git a/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml b/examples/demos/plasmapatrol/content/ChoiceBox.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml rename to examples/demos/plasmapatrol/content/ChoiceBox.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Cruiser.qml b/examples/demos/plasmapatrol/content/Cruiser.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Cruiser.qml rename to examples/demos/plasmapatrol/content/Cruiser.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Frigate.qml b/examples/demos/plasmapatrol/content/Frigate.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Frigate.qml rename to examples/demos/plasmapatrol/content/Frigate.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml b/examples/demos/plasmapatrol/content/Hardpoint.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Hardpoint.qml rename to examples/demos/plasmapatrol/content/Hardpoint.qml diff --git a/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml b/examples/demos/plasmapatrol/content/HelpScreens.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/HelpScreens.qml rename to examples/demos/plasmapatrol/content/HelpScreens.qml diff --git a/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml b/examples/demos/plasmapatrol/content/LaserHardpoint.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml rename to examples/demos/plasmapatrol/content/LaserHardpoint.qml diff --git a/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml rename to examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml diff --git a/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml b/examples/demos/plasmapatrol/content/SequentialLoader.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml rename to examples/demos/plasmapatrol/content/SequentialLoader.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Ship.qml b/examples/demos/plasmapatrol/content/Ship.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Ship.qml rename to examples/demos/plasmapatrol/content/Ship.qml diff --git a/examples/declarative/particles/plasmapatrol/content/Sloop.qml b/examples/demos/plasmapatrol/content/Sloop.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/Sloop.qml rename to examples/demos/plasmapatrol/content/Sloop.qml diff --git a/examples/declarative/particles/plasmapatrol/content/pics/TitleText.png b/examples/demos/plasmapatrol/content/pics/TitleText.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/TitleText.png rename to examples/demos/plasmapatrol/content/pics/TitleText.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/blur-circle2.png b/examples/demos/plasmapatrol/content/pics/blur-circle2.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/blur-circle2.png rename to examples/demos/plasmapatrol/content/pics/blur-circle2.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/blur-circle3.png b/examples/demos/plasmapatrol/content/pics/blur-circle3.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/blur-circle3.png rename to examples/demos/plasmapatrol/content/pics/blur-circle3.png diff --git a/examples/declarative/particles/images/finalfrontier.png b/examples/demos/plasmapatrol/content/pics/finalfrontier.png similarity index 100% rename from examples/declarative/particles/images/finalfrontier.png rename to examples/demos/plasmapatrol/content/pics/finalfrontier.png diff --git a/examples/declarative/particles/images/meteor.png b/examples/demos/plasmapatrol/content/pics/meteor.png similarity index 100% rename from examples/declarative/particles/images/meteor.png rename to examples/demos/plasmapatrol/content/pics/meteor.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/meteor_explo.png b/examples/demos/plasmapatrol/content/pics/meteor_explo.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/meteor_explo.png rename to examples/demos/plasmapatrol/content/pics/meteor_explo.png diff --git a/examples/declarative/particles/images/nullRock.png b/examples/demos/plasmapatrol/content/pics/nullRock.png similarity index 100% rename from examples/declarative/particles/images/nullRock.png rename to examples/demos/plasmapatrol/content/pics/nullRock.png diff --git a/examples/declarative/particles/images/particle.png b/examples/demos/plasmapatrol/content/pics/particle.png similarity index 100% rename from examples/declarative/particles/images/particle.png rename to examples/demos/plasmapatrol/content/pics/particle.png diff --git a/examples/declarative/particles/images/star.png b/examples/demos/plasmapatrol/content/pics/star.png similarity index 100% rename from examples/declarative/particles/images/star.png rename to examples/demos/plasmapatrol/content/pics/star.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/star2.png b/examples/demos/plasmapatrol/content/pics/star2.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/star2.png rename to examples/demos/plasmapatrol/content/pics/star2.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/star3.png b/examples/demos/plasmapatrol/content/pics/star3.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/star3.png rename to examples/demos/plasmapatrol/content/pics/star3.png diff --git a/examples/declarative/particles/plasmapatrol/plasmapatrol.qml b/examples/demos/plasmapatrol/plasmapatrol.qml similarity index 100% rename from examples/declarative/particles/plasmapatrol/plasmapatrol.qml rename to examples/demos/plasmapatrol/plasmapatrol.qml diff --git a/examples/declarative/rssnews/content/BusyIndicator.qml b/examples/demos/rssnews/content/BusyIndicator.qml similarity index 100% rename from examples/declarative/rssnews/content/BusyIndicator.qml rename to examples/demos/rssnews/content/BusyIndicator.qml diff --git a/examples/declarative/rssnews/content/CategoryDelegate.qml b/examples/demos/rssnews/content/CategoryDelegate.qml similarity index 100% rename from examples/declarative/rssnews/content/CategoryDelegate.qml rename to examples/demos/rssnews/content/CategoryDelegate.qml diff --git a/examples/declarative/rssnews/content/NewsDelegate.qml b/examples/demos/rssnews/content/NewsDelegate.qml similarity index 100% rename from examples/declarative/rssnews/content/NewsDelegate.qml rename to examples/demos/rssnews/content/NewsDelegate.qml diff --git a/examples/declarative/rssnews/content/RssFeeds.qml b/examples/demos/rssnews/content/RssFeeds.qml similarity index 100% rename from examples/declarative/rssnews/content/RssFeeds.qml rename to examples/demos/rssnews/content/RssFeeds.qml diff --git a/examples/declarative/rssnews/content/ScrollBar.qml b/examples/demos/rssnews/content/ScrollBar.qml similarity index 100% rename from examples/declarative/rssnews/content/ScrollBar.qml rename to examples/demos/rssnews/content/ScrollBar.qml diff --git a/examples/declarative/rssnews/content/images/busy.png b/examples/demos/rssnews/content/images/busy.png similarity index 100% rename from examples/declarative/rssnews/content/images/busy.png rename to examples/demos/rssnews/content/images/busy.png diff --git a/examples/declarative/rssnews/content/images/scrollbar.png b/examples/demos/rssnews/content/images/scrollbar.png similarity index 100% rename from examples/declarative/rssnews/content/images/scrollbar.png rename to examples/demos/rssnews/content/images/scrollbar.png diff --git a/examples/declarative/rssnews/rssnews.qml b/examples/demos/rssnews/rssnews.qml similarity index 100% rename from examples/declarative/rssnews/rssnews.qml rename to examples/demos/rssnews/rssnews.qml diff --git a/examples/declarative/rssnews/rssnews.qmlproject b/examples/demos/rssnews/rssnews.qmlproject similarity index 100% rename from examples/declarative/rssnews/rssnews.qmlproject rename to examples/demos/rssnews/rssnews.qmlproject diff --git a/examples/declarative/samegame/content/BoomBlock.qml b/examples/demos/samegame/content/BoomBlock.qml similarity index 100% rename from examples/declarative/samegame/content/BoomBlock.qml rename to examples/demos/samegame/content/BoomBlock.qml diff --git a/examples/declarative/samegame/content/Button.qml b/examples/demos/samegame/content/Button.qml similarity index 100% rename from examples/declarative/samegame/content/Button.qml rename to examples/demos/samegame/content/Button.qml diff --git a/examples/declarative/samegame/content/Dialog.qml b/examples/demos/samegame/content/Dialog.qml similarity index 100% rename from examples/declarative/samegame/content/Dialog.qml rename to examples/demos/samegame/content/Dialog.qml diff --git a/examples/declarative/samegame/content/GameArea.qml b/examples/demos/samegame/content/GameArea.qml similarity index 100% rename from examples/declarative/samegame/content/GameArea.qml rename to examples/demos/samegame/content/GameArea.qml diff --git a/examples/declarative/samegame/content/NameInputDialog.qml b/examples/demos/samegame/content/NameInputDialog.qml similarity index 100% rename from examples/declarative/samegame/content/NameInputDialog.qml rename to examples/demos/samegame/content/NameInputDialog.qml diff --git a/examples/declarative/samegame/content/pics/background.png b/examples/demos/samegame/content/pics/background.png similarity index 100% rename from examples/declarative/samegame/content/pics/background.png rename to examples/demos/samegame/content/pics/background.png diff --git a/examples/declarative/samegame/content/pics/blueStone.png b/examples/demos/samegame/content/pics/blueStone.png similarity index 100% rename from examples/declarative/samegame/content/pics/blueStone.png rename to examples/demos/samegame/content/pics/blueStone.png diff --git a/examples/declarative/samegame/content/pics/greenStone.png b/examples/demos/samegame/content/pics/greenStone.png similarity index 100% rename from examples/declarative/samegame/content/pics/greenStone.png rename to examples/demos/samegame/content/pics/greenStone.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/particle.png b/examples/demos/samegame/content/pics/particle.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/particle.png rename to examples/demos/samegame/content/pics/particle.png diff --git a/examples/declarative/samegame/content/pics/redStone.png b/examples/demos/samegame/content/pics/redStone.png similarity index 100% rename from examples/declarative/samegame/content/pics/redStone.png rename to examples/demos/samegame/content/pics/redStone.png diff --git a/examples/declarative/samegame/content/pics/yellowStone.png b/examples/demos/samegame/content/pics/yellowStone.png similarity index 100% rename from examples/declarative/samegame/content/pics/yellowStone.png rename to examples/demos/samegame/content/pics/yellowStone.png diff --git a/examples/declarative/samegame/content/samegame.js b/examples/demos/samegame/content/samegame.js similarity index 100% rename from examples/declarative/samegame/content/samegame.js rename to examples/demos/samegame/content/samegame.js diff --git a/examples/declarative/samegame/samegame.qml b/examples/demos/samegame/samegame.qml similarity index 100% rename from examples/declarative/samegame/samegame.qml rename to examples/demos/samegame/samegame.qml diff --git a/examples/declarative/samegame/samegame.qmlproject b/examples/demos/samegame/samegame.qmlproject similarity index 100% rename from examples/declarative/samegame/samegame.qmlproject rename to examples/demos/samegame/samegame.qmlproject diff --git a/examples/declarative/snake/content/Button.qml b/examples/demos/snake/content/Button.qml similarity index 100% rename from examples/declarative/snake/content/Button.qml rename to examples/demos/snake/content/Button.qml diff --git a/examples/declarative/snake/content/Cookie.qml b/examples/demos/snake/content/Cookie.qml similarity index 100% rename from examples/declarative/snake/content/Cookie.qml rename to examples/demos/snake/content/Cookie.qml diff --git a/examples/declarative/snake/content/HighScoreModel.qml b/examples/demos/snake/content/HighScoreModel.qml similarity index 100% rename from examples/declarative/snake/content/HighScoreModel.qml rename to examples/demos/snake/content/HighScoreModel.qml diff --git a/examples/declarative/snake/content/Link.qml b/examples/demos/snake/content/Link.qml similarity index 100% rename from examples/declarative/snake/content/Link.qml rename to examples/demos/snake/content/Link.qml diff --git a/examples/declarative/snake/content/Skull.qml b/examples/demos/snake/content/Skull.qml similarity index 87% rename from examples/declarative/snake/content/Skull.qml rename to examples/demos/snake/content/Skull.qml index ce3d108e04..9026790a5d 100644 --- a/examples/declarative/snake/content/Skull.qml +++ b/examples/demos/snake/content/Skull.qml @@ -48,10 +48,10 @@ Image { property int verticalMovement; property int horizontalMovement; - x: margin + column * gridSize + 2 - y: margin + row * gridSize - 3 - Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } - Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } + x: screen.margin + column * screen.gridSize + 2 + y: screen.margin + row * screen.gridSize - 3 + Behavior on x { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0 } } opacity: spawned ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 200 } } diff --git a/examples/declarative/snake/content/pics/README b/examples/demos/snake/content/pics/README similarity index 100% rename from examples/declarative/snake/content/pics/README rename to examples/demos/snake/content/pics/README diff --git a/examples/declarative/snake/content/pics/background.png b/examples/demos/snake/content/pics/background.png similarity index 100% rename from examples/declarative/snake/content/pics/background.png rename to examples/demos/snake/content/pics/background.png diff --git a/examples/declarative/snake/content/pics/blueStar.png b/examples/demos/snake/content/pics/blueStar.png similarity index 100% rename from examples/declarative/snake/content/pics/blueStar.png rename to examples/demos/snake/content/pics/blueStar.png diff --git a/examples/declarative/snake/content/pics/blueStone.png b/examples/demos/snake/content/pics/blueStone.png similarity index 100% rename from examples/declarative/snake/content/pics/blueStone.png rename to examples/demos/snake/content/pics/blueStone.png diff --git a/examples/declarative/snake/content/pics/cookie.png b/examples/demos/snake/content/pics/cookie.png similarity index 100% rename from examples/declarative/snake/content/pics/cookie.png rename to examples/demos/snake/content/pics/cookie.png diff --git a/examples/declarative/snake/content/pics/eyes.svg b/examples/demos/snake/content/pics/eyes.svg similarity index 100% rename from examples/declarative/snake/content/pics/eyes.svg rename to examples/demos/snake/content/pics/eyes.svg diff --git a/examples/declarative/snake/content/pics/head.png b/examples/demos/snake/content/pics/head.png similarity index 100% rename from examples/declarative/snake/content/pics/head.png rename to examples/demos/snake/content/pics/head.png diff --git a/examples/declarative/snake/content/pics/pause.png b/examples/demos/snake/content/pics/pause.png similarity index 100% rename from examples/declarative/snake/content/pics/pause.png rename to examples/demos/snake/content/pics/pause.png diff --git a/examples/declarative/snake/content/pics/redStar.png b/examples/demos/snake/content/pics/redStar.png similarity index 100% rename from examples/declarative/snake/content/pics/redStar.png rename to examples/demos/snake/content/pics/redStar.png diff --git a/examples/declarative/snake/content/pics/redStone.png b/examples/demos/snake/content/pics/redStone.png similarity index 100% rename from examples/declarative/snake/content/pics/redStone.png rename to examples/demos/snake/content/pics/redStone.png diff --git a/examples/declarative/snake/content/pics/skull.png b/examples/demos/snake/content/pics/skull.png similarity index 100% rename from examples/declarative/snake/content/pics/skull.png rename to examples/demos/snake/content/pics/skull.png diff --git a/examples/declarative/snake/content/pics/snake.jpg b/examples/demos/snake/content/pics/snake.jpg similarity index 100% rename from examples/declarative/snake/content/pics/snake.jpg rename to examples/demos/snake/content/pics/snake.jpg diff --git a/examples/declarative/snake/content/pics/star.png b/examples/demos/snake/content/pics/star.png similarity index 100% rename from examples/declarative/snake/content/pics/star.png rename to examples/demos/snake/content/pics/star.png diff --git a/examples/declarative/snake/content/pics/stoneShadow.png b/examples/demos/snake/content/pics/stoneShadow.png similarity index 100% rename from examples/declarative/snake/content/pics/stoneShadow.png rename to examples/demos/snake/content/pics/stoneShadow.png diff --git a/examples/declarative/snake/content/pics/yellowStar.png b/examples/demos/snake/content/pics/yellowStar.png similarity index 100% rename from examples/declarative/snake/content/pics/yellowStar.png rename to examples/demos/snake/content/pics/yellowStar.png diff --git a/examples/declarative/snake/content/pics/yellowStone.png b/examples/demos/snake/content/pics/yellowStone.png similarity index 100% rename from examples/declarative/snake/content/pics/yellowStone.png rename to examples/demos/snake/content/pics/yellowStone.png diff --git a/examples/declarative/snake/content/snake.js b/examples/demos/snake/content/snake.js similarity index 100% rename from examples/declarative/snake/content/snake.js rename to examples/demos/snake/content/snake.js diff --git a/examples/declarative/snake/snake.qml b/examples/demos/snake/snake.qml similarity index 93% rename from examples/declarative/snake/snake.qml rename to examples/demos/snake/snake.qml index f25b626d02..fca3273def 100644 --- a/examples/declarative/snake/snake.qml +++ b/examples/demos/snake/snake.qml @@ -42,7 +42,7 @@ import QtQuick 2.0 import "content" as Content import "content/snake.js" as Logic - +Item{ Rectangle { id: screen; SystemPalette { id: activePalette } @@ -75,14 +75,14 @@ Rectangle { Timer { id: heartbeat; - interval: heartbeatInterval; - running: activeGame + interval: screen.heartbeatInterval; + running: screen.activeGame repeat: true onTriggered: { Logic.move() } } Timer { id: halfbeat; - interval: halfbeatInterval; + interval: screen.halfbeatInterval; repeat: true running: heartbeat.running onTriggered: { Logic.moveSkull() } @@ -96,7 +96,7 @@ Rectangle { Timer { id: startHeartbeatTimer; interval: 1000 ; - onTriggered: { state = "running"; activeGame = true; } + onTriggered: { screen.state = "running"; screen.activeGame = true; } } Image{ @@ -138,7 +138,7 @@ Rectangle { font.pointSize: 24 anchors.horizontalCenter: parent.horizontalCenter; //horizontalAlignment: Text.AlignHCenter - text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore; + text: "Last Score:\t" + screen.lastScore + "\nHighscore:\t" + highScores.topScore; } } } @@ -158,8 +158,8 @@ Rectangle { color: "transparent" anchors.horizontalCenter: parent.horizontalCenter y: (screen.height - 32 - height)/2; - width: numColumnsAvailable * gridSize + 2*margin - height: numRowsAvailable * gridSize + 2*margin + width: screen.numColumnsAvailable * screen.gridSize + 2*screen.margin + height: screen.numRowsAvailable * screen.gridSize + 2*screen.margin Content.Skull { @@ -226,7 +226,7 @@ Rectangle { Text { color: activePalette.text - text: "Score: " + score; font.bold: true + text: "Score: " + screen.score; font.bold: true anchors.right: parent.right; anchors.rightMargin: 3 anchors.verticalCenter: parent.verticalCenter } @@ -270,3 +270,4 @@ Rectangle { ] } +} diff --git a/examples/declarative/snake/snake.qmlproject b/examples/demos/snake/snake.qmlproject similarity index 100% rename from examples/declarative/snake/snake.qmlproject rename to examples/demos/snake/snake.qmlproject diff --git a/examples/declarative/toys/tic-tac-toe/content/Button.qml b/examples/demos/tic-tac-toe/content/Button.qml similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/Button.qml rename to examples/demos/tic-tac-toe/content/Button.qml diff --git a/examples/declarative/toys/tic-tac-toe/content/TicTac.qml b/examples/demos/tic-tac-toe/content/TicTac.qml similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/TicTac.qml rename to examples/demos/tic-tac-toe/content/TicTac.qml diff --git a/examples/declarative/toys/tic-tac-toe/content/pics/board.png b/examples/demos/tic-tac-toe/content/pics/board.png similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/pics/board.png rename to examples/demos/tic-tac-toe/content/pics/board.png diff --git a/examples/declarative/toys/tic-tac-toe/content/pics/o.png b/examples/demos/tic-tac-toe/content/pics/o.png similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/pics/o.png rename to examples/demos/tic-tac-toe/content/pics/o.png diff --git a/examples/declarative/toys/tic-tac-toe/content/pics/x.png b/examples/demos/tic-tac-toe/content/pics/x.png similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/pics/x.png rename to examples/demos/tic-tac-toe/content/pics/x.png diff --git a/examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js b/examples/demos/tic-tac-toe/content/tic-tac-toe.js similarity index 100% rename from examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js rename to examples/demos/tic-tac-toe/content/tic-tac-toe.js diff --git a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml b/examples/demos/tic-tac-toe/tic-tac-toe.qml similarity index 100% rename from examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml rename to examples/demos/tic-tac-toe/tic-tac-toe.qml diff --git a/examples/declarative/toys/tvtennis/tvtennis.qml b/examples/demos/tvtennis/tvtennis.qml similarity index 100% rename from examples/declarative/toys/tvtennis/tvtennis.qml rename to examples/demos/tvtennis/tvtennis.qml diff --git a/examples/declarative/twitter/TwitterCore/Button.qml b/examples/demos/twitter/TwitterCore/Button.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/Button.qml rename to examples/demos/twitter/TwitterCore/Button.qml diff --git a/examples/declarative/twitter/TwitterCore/FatDelegate.qml b/examples/demos/twitter/TwitterCore/FatDelegate.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/FatDelegate.qml rename to examples/demos/twitter/TwitterCore/FatDelegate.qml diff --git a/examples/declarative/twitter/TwitterCore/Input.qml b/examples/demos/twitter/TwitterCore/Input.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/Input.qml rename to examples/demos/twitter/TwitterCore/Input.qml diff --git a/examples/declarative/twitter/TwitterCore/Loading.qml b/examples/demos/twitter/TwitterCore/Loading.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/Loading.qml rename to examples/demos/twitter/TwitterCore/Loading.qml diff --git a/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml b/examples/demos/twitter/TwitterCore/MultiTitleBar.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/MultiTitleBar.qml rename to examples/demos/twitter/TwitterCore/MultiTitleBar.qml diff --git a/examples/declarative/twitter/TwitterCore/RssModel.qml b/examples/demos/twitter/TwitterCore/RssModel.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/RssModel.qml rename to examples/demos/twitter/TwitterCore/RssModel.qml diff --git a/examples/declarative/twitter/TwitterCore/SearchView.qml b/examples/demos/twitter/TwitterCore/SearchView.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/SearchView.qml rename to examples/demos/twitter/TwitterCore/SearchView.qml diff --git a/examples/declarative/twitter/TwitterCore/TitleBar.qml b/examples/demos/twitter/TwitterCore/TitleBar.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/TitleBar.qml rename to examples/demos/twitter/TwitterCore/TitleBar.qml diff --git a/examples/declarative/twitter/TwitterCore/ToolBar.qml b/examples/demos/twitter/TwitterCore/ToolBar.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/ToolBar.qml rename to examples/demos/twitter/TwitterCore/ToolBar.qml diff --git a/examples/declarative/twitter/TwitterCore/UserModel.qml b/examples/demos/twitter/TwitterCore/UserModel.qml similarity index 100% rename from examples/declarative/twitter/TwitterCore/UserModel.qml rename to examples/demos/twitter/TwitterCore/UserModel.qml diff --git a/examples/declarative/flickr/content/images/gloss.png b/examples/demos/twitter/TwitterCore/images/gloss.png similarity index 100% rename from examples/declarative/flickr/content/images/gloss.png rename to examples/demos/twitter/TwitterCore/images/gloss.png diff --git a/examples/declarative/flickr/content/images/lineedit.png b/examples/demos/twitter/TwitterCore/images/lineedit.png similarity index 100% rename from examples/declarative/flickr/content/images/lineedit.png rename to examples/demos/twitter/TwitterCore/images/lineedit.png diff --git a/examples/declarative/flickr/content/images/lineedit.sci b/examples/demos/twitter/TwitterCore/images/lineedit.sci similarity index 100% rename from examples/declarative/flickr/content/images/lineedit.sci rename to examples/demos/twitter/TwitterCore/images/lineedit.sci diff --git a/examples/declarative/twitter/TwitterCore/images/loading.png b/examples/demos/twitter/TwitterCore/images/loading.png similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/loading.png rename to examples/demos/twitter/TwitterCore/images/loading.png diff --git a/examples/declarative/flickr/content/images/quit.png b/examples/demos/twitter/TwitterCore/images/quit.png similarity index 100% rename from examples/declarative/flickr/content/images/quit.png rename to examples/demos/twitter/TwitterCore/images/quit.png diff --git a/examples/declarative/flickr/content/images/stripes.png b/examples/demos/twitter/TwitterCore/images/stripes.png similarity index 100% rename from examples/declarative/flickr/content/images/stripes.png rename to examples/demos/twitter/TwitterCore/images/stripes.png diff --git a/examples/declarative/flickr/content/images/titlebar.png b/examples/demos/twitter/TwitterCore/images/titlebar.png similarity index 100% rename from examples/declarative/flickr/content/images/titlebar.png rename to examples/demos/twitter/TwitterCore/images/titlebar.png diff --git a/examples/declarative/flickr/content/images/titlebar.sci b/examples/demos/twitter/TwitterCore/images/titlebar.sci similarity index 100% rename from examples/declarative/flickr/content/images/titlebar.sci rename to examples/demos/twitter/TwitterCore/images/titlebar.sci diff --git a/examples/declarative/flickr/content/images/toolbutton.png b/examples/demos/twitter/TwitterCore/images/toolbutton.png similarity index 100% rename from examples/declarative/flickr/content/images/toolbutton.png rename to examples/demos/twitter/TwitterCore/images/toolbutton.png diff --git a/examples/declarative/flickr/content/images/toolbutton.sci b/examples/demos/twitter/TwitterCore/images/toolbutton.sci similarity index 100% rename from examples/declarative/flickr/content/images/toolbutton.sci rename to examples/demos/twitter/TwitterCore/images/toolbutton.sci diff --git a/examples/declarative/twitter/TwitterCore/qmldir b/examples/demos/twitter/TwitterCore/qmldir similarity index 100% rename from examples/declarative/twitter/TwitterCore/qmldir rename to examples/demos/twitter/TwitterCore/qmldir diff --git a/examples/declarative/twitter/twitter.qml b/examples/demos/twitter/twitter.qml similarity index 100% rename from examples/declarative/twitter/twitter.qml rename to examples/demos/twitter/twitter.qml diff --git a/examples/declarative/twitter/twitter.qmlproject b/examples/demos/twitter/twitter.qmlproject similarity index 100% rename from examples/declarative/twitter/twitter.qmlproject rename to examples/demos/twitter/twitter.qmlproject diff --git a/examples/embedded/embedded.pro b/examples/embedded/embedded.pro deleted file mode 100644 index 81334fa552..0000000000 --- a/examples/embedded/embedded.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += qmleasing qmlflickr qmldialcontrol qmlcalculator qmlphotoviewer qmlclocks qmltwitter diff --git a/examples/embedded/qmlcalculator/deployment.pri b/examples/embedded/qmlcalculator/deployment.pri deleted file mode 100644 index a3627b8fa2..0000000000 --- a/examples/embedded/qmlcalculator/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmlcalculator_src = $$PWD/../../declarative/calculator - -qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core -DEPLOYMENT += qmlcalculator_files diff --git a/examples/embedded/qmlcalculator/qmlcalculator.cpp b/examples/embedded/qmlcalculator/qmlcalculator.cpp deleted file mode 100644 index 4be7bc462d..0000000000 --- a/examples/embedded/qmlcalculator/qmlcalculator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("calculator.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - - view.show(); - return application.exec(); -} diff --git a/examples/embedded/qmlcalculator/qmlcalculator.pro b/examples/embedded/qmlcalculator/qmlcalculator.pro deleted file mode 100644 index 25c16ca78a..0000000000 --- a/examples/embedded/qmlcalculator/qmlcalculator.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative -SOURCES += $$PWD/qmlcalculator.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmlclocks/deployment.pri b/examples/embedded/qmlclocks/deployment.pri deleted file mode 100644 index 771a4dba76..0000000000 --- a/examples/embedded/qmlclocks/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmlclocks_src = $$PWD/../../../examples/declarative/toys/clocks - -qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content -DEPLOYMENT += qmlclocks_files diff --git a/examples/embedded/qmlclocks/qmlclocks.cpp b/examples/embedded/qmlclocks/qmlclocks.cpp deleted file mode 100644 index ce42ec7b18..0000000000 --- a/examples/embedded/qmlclocks/qmlclocks.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("clocks.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - - view.show(); - return application.exec(); -} diff --git a/examples/embedded/qmlclocks/qmlclocks.pro b/examples/embedded/qmlclocks/qmlclocks.pro deleted file mode 100644 index 8e9dcdf87c..0000000000 --- a/examples/embedded/qmlclocks/qmlclocks.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative -SOURCES += $$PWD/qmlclocks.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmldialcontrol/deployment.pri b/examples/embedded/qmldialcontrol/deployment.pri deleted file mode 100644 index d845120923..0000000000 --- a/examples/embedded/qmldialcontrol/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmldialcontrol_src = $$PWD/../../../examples/declarative/ui-components/dialcontrol - -qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content -DEPLOYMENT += qmldialcontrol_files diff --git a/examples/embedded/qmldialcontrol/qmldialcontrol.cpp b/examples/embedded/qmldialcontrol/qmldialcontrol.cpp deleted file mode 100644 index e66f6f6c56..0000000000 --- a/examples/embedded/qmldialcontrol/qmldialcontrol.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("dialcontrol.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - - view.show(); - return application.exec(); -} diff --git a/examples/embedded/qmldialcontrol/qmldialcontrol.pro b/examples/embedded/qmldialcontrol/qmldialcontrol.pro deleted file mode 100644 index 08f876b926..0000000000 --- a/examples/embedded/qmldialcontrol/qmldialcontrol.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative -SOURCES += $$PWD/qmldialcontrol.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmleasing/deployment.pri b/examples/embedded/qmleasing/deployment.pri deleted file mode 100644 index 7a5d0401cb..0000000000 --- a/examples/embedded/qmleasing/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmleasing_src = $$PWD/../../../examples/declarative/animation/easing - -qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content -DEPLOYMENT += qmleasing_files diff --git a/examples/embedded/qmleasing/qmleasing.cpp b/examples/embedded/qmleasing/qmleasing.cpp deleted file mode 100644 index 8220e03cff..0000000000 --- a/examples/embedded/qmleasing/qmleasing.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("easing.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - - view.show(); - return application.exec(); -} diff --git a/examples/embedded/qmleasing/qmleasing.pro b/examples/embedded/qmleasing/qmleasing.pro deleted file mode 100644 index c9f008d42e..0000000000 --- a/examples/embedded/qmleasing/qmleasing.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative -SOURCES += $$PWD/qmleasing.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmlflickr/deployment.pri b/examples/embedded/qmlflickr/deployment.pri deleted file mode 100644 index 0d76ddc1db..0000000000 --- a/examples/embedded/qmlflickr/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmlflickr_src = $$PWD/../../declarative/flickr - -qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile -DEPLOYMENT += qmlflickr_files diff --git a/examples/embedded/qmlflickr/qmlflickr.cpp b/examples/embedded/qmlflickr/qmlflickr.cpp deleted file mode 100644 index 93b28f7cec..0000000000 --- a/examples/embedded/qmlflickr/qmlflickr.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("flickr.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); - return application.exec(); -} - diff --git a/examples/embedded/qmlflickr/qmlflickr.pro b/examples/embedded/qmlflickr/qmlflickr.pro deleted file mode 100644 index 869d651b05..0000000000 --- a/examples/embedded/qmlflickr/qmlflickr.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmlflickr.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmlphotoviewer/deployment.pri b/examples/embedded/qmlphotoviewer/deployment.pri deleted file mode 100644 index 504373914a..0000000000 --- a/examples/embedded/qmlphotoviewer/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmlphotoviewer_src = $$PWD/../../declarative/photoviewer - -qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore -DEPLOYMENT += qmlphotoviewer_files diff --git a/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp deleted file mode 100644 index 32c9d24eaa..0000000000 --- a/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("photoviewer.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); - return application.exec(); -} - diff --git a/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro b/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro deleted file mode 100644 index 9941b2e226..0000000000 --- a/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmlphotoviewer.cpp -include($$PWD/deployment.pri) diff --git a/examples/embedded/qmltwitter/deployment.pri b/examples/embedded/qmltwitter/deployment.pri deleted file mode 100644 index a3c045ca54..0000000000 --- a/examples/embedded/qmltwitter/deployment.pri +++ /dev/null @@ -1,4 +0,0 @@ -qmltwitter_src = $$PWD/../../declarative/twitter - -qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore -DEPLOYMENT += qmltwitter_files diff --git a/examples/embedded/qmltwitter/qmltwitter.cpp b/examples/embedded/qmltwitter/qmltwitter.cpp deleted file mode 100644 index 19b187bc82..0000000000 --- a/examples/embedded/qmltwitter/qmltwitter.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("twitter.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); - return application.exec(); -} - diff --git a/examples/embedded/qmltwitter/qmltwitter.pro b/examples/embedded/qmltwitter/qmltwitter.pro deleted file mode 100644 index ce40cd7489..0000000000 --- a/examples/embedded/qmltwitter/qmltwitter.pro +++ /dev/null @@ -1,5 +0,0 @@ -!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmltwitter.cpp -include($$PWD/deployment.pri) diff --git a/examples/examples.pro b/examples/examples.pro index 2c9497dde0..2b78ed7e12 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += declarative tutorials +SUBDIRS += demos shared localstorage particles qml qtquick tutorials window contains(QT_CONFIG, qmltest): SUBDIRS += qmltest diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/localstorage/hello.qml similarity index 100% rename from examples/declarative/sqllocalstorage/hello.qml rename to examples/localstorage/hello.qml diff --git a/examples/localstorage/localstorage.pro b/examples/localstorage/localstorage.pro new file mode 100644 index 0000000000..967108504e --- /dev/null +++ b/examples/localstorage/localstorage.pro @@ -0,0 +1 @@ +TEMPLATE = subdirs diff --git a/examples/declarative/particles/affectors/age.qml b/examples/particles/affectors/age.qml similarity index 100% rename from examples/declarative/particles/affectors/age.qml rename to examples/particles/affectors/age.qml diff --git a/examples/declarative/particles/affectors/attractor.qml b/examples/particles/affectors/attractor.qml similarity index 100% rename from examples/declarative/particles/affectors/attractor.qml rename to examples/particles/affectors/attractor.qml diff --git a/examples/declarative/particles/affectors/customaffector.qml b/examples/particles/affectors/customaffector.qml similarity index 100% rename from examples/declarative/particles/affectors/customaffector.qml rename to examples/particles/affectors/customaffector.qml diff --git a/examples/declarative/particles/affectors/friction.qml b/examples/particles/affectors/friction.qml similarity index 100% rename from examples/declarative/particles/affectors/friction.qml rename to examples/particles/affectors/friction.qml diff --git a/examples/declarative/particles/affectors/gravity.qml b/examples/particles/affectors/gravity.qml similarity index 100% rename from examples/declarative/particles/affectors/gravity.qml rename to examples/particles/affectors/gravity.qml diff --git a/examples/declarative/particles/affectors/groupgoal.qml b/examples/particles/affectors/groupgoal.qml similarity index 100% rename from examples/declarative/particles/affectors/groupgoal.qml rename to examples/particles/affectors/groupgoal.qml diff --git a/examples/declarative/particles/affectors/move.qml b/examples/particles/affectors/move.qml similarity index 100% rename from examples/declarative/particles/affectors/move.qml rename to examples/particles/affectors/move.qml diff --git a/examples/declarative/particles/affectors/spritegoal.qml b/examples/particles/affectors/spritegoal.qml similarity index 100% rename from examples/declarative/particles/affectors/spritegoal.qml rename to examples/particles/affectors/spritegoal.qml diff --git a/examples/declarative/particles/affectors/turbulence.qml b/examples/particles/affectors/turbulence.qml similarity index 100% rename from examples/declarative/particles/affectors/turbulence.qml rename to examples/particles/affectors/turbulence.qml diff --git a/examples/declarative/particles/affectors/wander.qml b/examples/particles/affectors/wander.qml similarity index 100% rename from examples/declarative/particles/affectors/wander.qml rename to examples/particles/affectors/wander.qml diff --git a/examples/declarative/particles/customparticle/blurparticles.qml b/examples/particles/customparticle/blurparticles.qml similarity index 100% rename from examples/declarative/particles/customparticle/blurparticles.qml rename to examples/particles/customparticle/blurparticles.qml diff --git a/examples/declarative/particles/customparticle/fragmentshader.qml b/examples/particles/customparticle/fragmentshader.qml similarity index 100% rename from examples/declarative/particles/customparticle/fragmentshader.qml rename to examples/particles/customparticle/fragmentshader.qml diff --git a/examples/declarative/particles/customparticle/imagecolors.qml b/examples/particles/customparticle/imagecolors.qml similarity index 100% rename from examples/declarative/particles/customparticle/imagecolors.qml rename to examples/particles/customparticle/imagecolors.qml diff --git a/examples/declarative/particles/emitters/burstandpulse.qml b/examples/particles/emitters/burstandpulse.qml similarity index 100% rename from examples/declarative/particles/emitters/burstandpulse.qml rename to examples/particles/emitters/burstandpulse.qml diff --git a/examples/declarative/particles/emitters/customemitter.qml b/examples/particles/emitters/customemitter.qml similarity index 100% rename from examples/declarative/particles/emitters/customemitter.qml rename to examples/particles/emitters/customemitter.qml diff --git a/examples/declarative/particles/emitters/emitmask.qml b/examples/particles/emitters/emitmask.qml similarity index 100% rename from examples/declarative/particles/emitters/emitmask.qml rename to examples/particles/emitters/emitmask.qml diff --git a/examples/declarative/particles/emitters/maximumemitted.qml b/examples/particles/emitters/maximumemitted.qml similarity index 100% rename from examples/declarative/particles/emitters/maximumemitted.qml rename to examples/particles/emitters/maximumemitted.qml diff --git a/examples/declarative/particles/emitters/shapeanddirection.qml b/examples/particles/emitters/shapeanddirection.qml similarity index 100% rename from examples/declarative/particles/emitters/shapeanddirection.qml rename to examples/particles/emitters/shapeanddirection.qml diff --git a/examples/declarative/particles/emitters/timedgroupchanges.qml b/examples/particles/emitters/timedgroupchanges.qml similarity index 100% rename from examples/declarative/particles/emitters/timedgroupchanges.qml rename to examples/particles/emitters/timedgroupchanges.qml diff --git a/examples/declarative/particles/emitters/trailemitter.qml b/examples/particles/emitters/trailemitter.qml similarity index 100% rename from examples/declarative/particles/emitters/trailemitter.qml rename to examples/particles/emitters/trailemitter.qml diff --git a/examples/declarative/particles/emitters/velocityfrommotion.qml b/examples/particles/emitters/velocityfrommotion.qml similarity index 100% rename from examples/declarative/particles/emitters/velocityfrommotion.qml rename to examples/particles/emitters/velocityfrommotion.qml diff --git a/examples/declarative/particles/exampleslauncher/content/Button.qml b/examples/particles/exampleslauncher/content/Button.qml similarity index 100% rename from examples/declarative/particles/exampleslauncher/content/Button.qml rename to examples/particles/exampleslauncher/content/Button.qml diff --git a/examples/declarative/particles/exampleslauncher/content/Shell.qml b/examples/particles/exampleslauncher/content/Shell.qml similarity index 100% rename from examples/declarative/particles/exampleslauncher/content/Shell.qml rename to examples/particles/exampleslauncher/content/Shell.qml diff --git a/examples/declarative/particles/exampleslauncher/content/launcher.js b/examples/particles/exampleslauncher/content/launcher.js similarity index 100% rename from examples/declarative/particles/exampleslauncher/content/launcher.js rename to examples/particles/exampleslauncher/content/launcher.js diff --git a/examples/declarative/particles/exampleslauncher/exampleslauncher.qml b/examples/particles/exampleslauncher/exampleslauncher.qml similarity index 100% rename from examples/declarative/particles/exampleslauncher/exampleslauncher.qml rename to examples/particles/exampleslauncher/exampleslauncher.qml diff --git a/examples/declarative/particles/imageparticle/allatonce.qml b/examples/particles/imageparticle/allatonce.qml similarity index 100% rename from examples/declarative/particles/imageparticle/allatonce.qml rename to examples/particles/imageparticle/allatonce.qml diff --git a/examples/declarative/particles/imageparticle/colored.qml b/examples/particles/imageparticle/colored.qml similarity index 100% rename from examples/declarative/particles/imageparticle/colored.qml rename to examples/particles/imageparticle/colored.qml diff --git a/examples/declarative/particles/imageparticle/colortable.qml b/examples/particles/imageparticle/colortable.qml similarity index 100% rename from examples/declarative/particles/imageparticle/colortable.qml rename to examples/particles/imageparticle/colortable.qml diff --git a/examples/declarative/particles/imageparticle/deformation.qml b/examples/particles/imageparticle/deformation.qml similarity index 100% rename from examples/declarative/particles/imageparticle/deformation.qml rename to examples/particles/imageparticle/deformation.qml diff --git a/examples/declarative/particles/imageparticle/rotation.qml b/examples/particles/imageparticle/rotation.qml similarity index 100% rename from examples/declarative/particles/imageparticle/rotation.qml rename to examples/particles/imageparticle/rotation.qml diff --git a/examples/declarative/particles/imageparticle/sharing.qml b/examples/particles/imageparticle/sharing.qml similarity index 100% rename from examples/declarative/particles/imageparticle/sharing.qml rename to examples/particles/imageparticle/sharing.qml diff --git a/examples/declarative/particles/imageparticle/sprites.qml b/examples/particles/imageparticle/sprites.qml similarity index 100% rename from examples/declarative/particles/imageparticle/sprites.qml rename to examples/particles/imageparticle/sprites.qml diff --git a/examples/declarative/particles/images/_explo.png b/examples/particles/images/_explo.png similarity index 100% rename from examples/declarative/particles/images/_explo.png rename to examples/particles/images/_explo.png diff --git a/examples/declarative/particles/images/backgroundLeaves.jpg b/examples/particles/images/backgroundLeaves.jpg similarity index 100% rename from examples/declarative/particles/images/backgroundLeaves.jpg rename to examples/particles/images/backgroundLeaves.jpg diff --git a/examples/declarative/particles/images/bear_tiles.png b/examples/particles/images/bear_tiles.png similarity index 100% rename from examples/declarative/particles/images/bear_tiles.png rename to examples/particles/images/bear_tiles.png diff --git a/examples/declarative/particles/images/candle.png b/examples/particles/images/candle.png similarity index 100% rename from examples/declarative/particles/images/candle.png rename to examples/particles/images/candle.png diff --git a/examples/declarative/particles/images/colortable.png b/examples/particles/images/colortable.png similarity index 100% rename from examples/declarative/particles/images/colortable.png rename to examples/particles/images/colortable.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/finalfrontier.png b/examples/particles/images/finalfrontier.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/finalfrontier.png rename to examples/particles/images/finalfrontier.png diff --git a/examples/declarative/particles/images/flower.png b/examples/particles/images/flower.png similarity index 100% rename from examples/declarative/particles/images/flower.png rename to examples/particles/images/flower.png diff --git a/examples/declarative/particles/images/launcherIcons/allatonce.png b/examples/particles/images/launcherIcons/allatonce.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/allatonce.png rename to examples/particles/images/launcherIcons/allatonce.png diff --git a/examples/declarative/particles/images/launcherIcons/attractor.png b/examples/particles/images/launcherIcons/attractor.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/attractor.png rename to examples/particles/images/launcherIcons/attractor.png diff --git a/examples/declarative/particles/images/launcherIcons/blurparticles.png b/examples/particles/images/launcherIcons/blurparticles.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/blurparticles.png rename to examples/particles/images/launcherIcons/blurparticles.png diff --git a/examples/declarative/particles/images/launcherIcons/close.png b/examples/particles/images/launcherIcons/close.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/close.png rename to examples/particles/images/launcherIcons/close.png diff --git a/examples/declarative/particles/images/launcherIcons/colortable.png b/examples/particles/images/launcherIcons/colortable.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/colortable.png rename to examples/particles/images/launcherIcons/colortable.png diff --git a/examples/declarative/particles/images/launcherIcons/customaffector.png b/examples/particles/images/launcherIcons/customaffector.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/customaffector.png rename to examples/particles/images/launcherIcons/customaffector.png diff --git a/examples/declarative/particles/images/launcherIcons/customemitter.png b/examples/particles/images/launcherIcons/customemitter.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/customemitter.png rename to examples/particles/images/launcherIcons/customemitter.png diff --git a/examples/declarative/particles/images/launcherIcons/deformation.png b/examples/particles/images/launcherIcons/deformation.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/deformation.png rename to examples/particles/images/launcherIcons/deformation.png diff --git a/examples/declarative/particles/images/launcherIcons/delegates.png b/examples/particles/images/launcherIcons/delegates.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/delegates.png rename to examples/particles/images/launcherIcons/delegates.png diff --git a/examples/declarative/particles/images/launcherIcons/dynamicemitters.png b/examples/particles/images/launcherIcons/dynamicemitters.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/dynamicemitters.png rename to examples/particles/images/launcherIcons/dynamicemitters.png diff --git a/examples/declarative/particles/images/launcherIcons/emitmask.png b/examples/particles/images/launcherIcons/emitmask.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/emitmask.png rename to examples/particles/images/launcherIcons/emitmask.png diff --git a/examples/declarative/particles/images/launcherIcons/flickr.png b/examples/particles/images/launcherIcons/flickr.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/flickr.png rename to examples/particles/images/launcherIcons/flickr.png diff --git a/examples/declarative/particles/images/launcherIcons/fragmentshader.png b/examples/particles/images/launcherIcons/fragmentshader.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/fragmentshader.png rename to examples/particles/images/launcherIcons/fragmentshader.png diff --git a/examples/declarative/particles/images/launcherIcons/gridsplosion.png b/examples/particles/images/launcherIcons/gridsplosion.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/gridsplosion.png rename to examples/particles/images/launcherIcons/gridsplosion.png diff --git a/examples/declarative/particles/images/launcherIcons/groupgoal.png b/examples/particles/images/launcherIcons/groupgoal.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/groupgoal.png rename to examples/particles/images/launcherIcons/groupgoal.png diff --git a/examples/declarative/particles/images/launcherIcons/imagecolors.png b/examples/particles/images/launcherIcons/imagecolors.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/imagecolors.png rename to examples/particles/images/launcherIcons/imagecolors.png diff --git a/examples/declarative/particles/images/launcherIcons/list.png b/examples/particles/images/launcherIcons/list.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/list.png rename to examples/particles/images/launcherIcons/list.png diff --git a/examples/declarative/particles/images/launcherIcons/maximumemitted.png b/examples/particles/images/launcherIcons/maximumemitted.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/maximumemitted.png rename to examples/particles/images/launcherIcons/maximumemitted.png diff --git a/examples/declarative/particles/images/launcherIcons/multiplepainters.png b/examples/particles/images/launcherIcons/multiplepainters.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/multiplepainters.png rename to examples/particles/images/launcherIcons/multiplepainters.png diff --git a/examples/declarative/particles/images/launcherIcons/package.png b/examples/particles/images/launcherIcons/package.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/package.png rename to examples/particles/images/launcherIcons/package.png diff --git a/examples/declarative/particles/images/launcherIcons/particleview.png b/examples/particles/images/launcherIcons/particleview.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/particleview.png rename to examples/particles/images/launcherIcons/particleview.png diff --git a/examples/declarative/particles/images/launcherIcons/plasmapatrol.png b/examples/particles/images/launcherIcons/plasmapatrol.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/plasmapatrol.png rename to examples/particles/images/launcherIcons/plasmapatrol.png diff --git a/examples/declarative/particles/images/launcherIcons/remove.png b/examples/particles/images/launcherIcons/remove.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/remove.png rename to examples/particles/images/launcherIcons/remove.png diff --git a/examples/declarative/particles/images/launcherIcons/rotation.png b/examples/particles/images/launcherIcons/rotation.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/rotation.png rename to examples/particles/images/launcherIcons/rotation.png diff --git a/examples/declarative/particles/images/launcherIcons/samegame.png b/examples/particles/images/launcherIcons/samegame.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/samegame.png rename to examples/particles/images/launcherIcons/samegame.png diff --git a/examples/declarative/particles/images/launcherIcons/shapeanddirection.png b/examples/particles/images/launcherIcons/shapeanddirection.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/shapeanddirection.png rename to examples/particles/images/launcherIcons/shapeanddirection.png diff --git a/examples/declarative/particles/images/launcherIcons/spaceexplorer.png b/examples/particles/images/launcherIcons/spaceexplorer.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/spaceexplorer.png rename to examples/particles/images/launcherIcons/spaceexplorer.png diff --git a/examples/declarative/particles/images/launcherIcons/spritegoal.png b/examples/particles/images/launcherIcons/spritegoal.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/spritegoal.png rename to examples/particles/images/launcherIcons/spritegoal.png diff --git a/examples/declarative/particles/images/launcherIcons/sprites.png b/examples/particles/images/launcherIcons/sprites.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/sprites.png rename to examples/particles/images/launcherIcons/sprites.png diff --git a/examples/declarative/particles/images/launcherIcons/spritevariedparticles.png b/examples/particles/images/launcherIcons/spritevariedparticles.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/spritevariedparticles.png rename to examples/particles/images/launcherIcons/spritevariedparticles.png diff --git a/examples/declarative/particles/images/launcherIcons/startstop.png b/examples/particles/images/launcherIcons/startstop.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/startstop.png rename to examples/particles/images/launcherIcons/startstop.png diff --git a/examples/declarative/particles/images/launcherIcons/timedgroupchanges.png b/examples/particles/images/launcherIcons/timedgroupchanges.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/timedgroupchanges.png rename to examples/particles/images/launcherIcons/timedgroupchanges.png diff --git a/examples/declarative/particles/images/launcherIcons/trailemitter.png b/examples/particles/images/launcherIcons/trailemitter.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/trailemitter.png rename to examples/particles/images/launcherIcons/trailemitter.png diff --git a/examples/declarative/particles/images/launcherIcons/trails.png b/examples/particles/images/launcherIcons/trails.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/trails.png rename to examples/particles/images/launcherIcons/trails.png diff --git a/examples/declarative/particles/images/launcherIcons/turbulence.png b/examples/particles/images/launcherIcons/turbulence.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/turbulence.png rename to examples/particles/images/launcherIcons/turbulence.png diff --git a/examples/declarative/particles/images/launcherIcons/velocityfrommotion.png b/examples/particles/images/launcherIcons/velocityfrommotion.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/velocityfrommotion.png rename to examples/particles/images/launcherIcons/velocityfrommotion.png diff --git a/examples/declarative/particles/images/launcherIcons/wander.png b/examples/particles/images/launcherIcons/wander.png similarity index 100% rename from examples/declarative/particles/images/launcherIcons/wander.png rename to examples/particles/images/launcherIcons/wander.png diff --git a/examples/declarative/particles/images/matchmask.png b/examples/particles/images/matchmask.png similarity index 100% rename from examples/declarative/particles/images/matchmask.png rename to examples/particles/images/matchmask.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/meteor.png b/examples/particles/images/meteor.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/meteor.png rename to examples/particles/images/meteor.png diff --git a/examples/declarative/particles/images/meteor_explo.png b/examples/particles/images/meteor_explo.png similarity index 100% rename from examples/declarative/particles/images/meteor_explo.png rename to examples/particles/images/meteor_explo.png diff --git a/examples/declarative/particles/images/meteors.png b/examples/particles/images/meteors.png similarity index 100% rename from examples/declarative/particles/images/meteors.png rename to examples/particles/images/meteors.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/nullRock.png b/examples/particles/images/nullRock.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/nullRock.png rename to examples/particles/images/nullRock.png diff --git a/examples/declarative/samegame/content/pics/particle.png b/examples/particles/images/particle.png similarity index 100% rename from examples/declarative/samegame/content/pics/particle.png rename to examples/particles/images/particle.png diff --git a/examples/declarative/particles/images/particle2.png b/examples/particles/images/particle2.png similarity index 100% rename from examples/declarative/particles/images/particle2.png rename to examples/particles/images/particle2.png diff --git a/examples/declarative/particles/images/particle3.png b/examples/particles/images/particle3.png similarity index 100% rename from examples/declarative/particles/images/particle3.png rename to examples/particles/images/particle3.png diff --git a/examples/declarative/particles/images/particle4.png b/examples/particles/images/particle4.png similarity index 100% rename from examples/declarative/particles/images/particle4.png rename to examples/particles/images/particle4.png diff --git a/examples/declarative/particles/images/particleA.png b/examples/particles/images/particleA.png similarity index 100% rename from examples/declarative/particles/images/particleA.png rename to examples/particles/images/particleA.png diff --git a/examples/declarative/particles/images/portal_bg.png b/examples/particles/images/portal_bg.png similarity index 100% rename from examples/declarative/particles/images/portal_bg.png rename to examples/particles/images/portal_bg.png diff --git a/examples/declarative/particles/images/realLeaf1.png b/examples/particles/images/realLeaf1.png similarity index 100% rename from examples/declarative/particles/images/realLeaf1.png rename to examples/particles/images/realLeaf1.png diff --git a/examples/declarative/particles/images/realLeaf2.png b/examples/particles/images/realLeaf2.png similarity index 100% rename from examples/declarative/particles/images/realLeaf2.png rename to examples/particles/images/realLeaf2.png diff --git a/examples/declarative/particles/images/realLeaf3.png b/examples/particles/images/realLeaf3.png similarity index 100% rename from examples/declarative/particles/images/realLeaf3.png rename to examples/particles/images/realLeaf3.png diff --git a/examples/declarative/particles/images/realLeaf4.png b/examples/particles/images/realLeaf4.png similarity index 100% rename from examples/declarative/particles/images/realLeaf4.png rename to examples/particles/images/realLeaf4.png diff --git a/examples/declarative/particles/images/rocket.png b/examples/particles/images/rocket.png similarity index 100% rename from examples/declarative/particles/images/rocket.png rename to examples/particles/images/rocket.png diff --git a/examples/declarative/particles/images/rocket2.png b/examples/particles/images/rocket2.png similarity index 100% rename from examples/declarative/particles/images/rocket2.png rename to examples/particles/images/rocket2.png diff --git a/examples/declarative/particles/images/sizeInOut.png b/examples/particles/images/sizeInOut.png similarity index 100% rename from examples/declarative/particles/images/sizeInOut.png rename to examples/particles/images/sizeInOut.png diff --git a/examples/declarative/particles/images/snowflake.png b/examples/particles/images/snowflake.png similarity index 100% rename from examples/declarative/particles/images/snowflake.png rename to examples/particles/images/snowflake.png diff --git a/examples/declarative/particles/images/sparkleSize.png b/examples/particles/images/sparkleSize.png similarity index 100% rename from examples/declarative/particles/images/sparkleSize.png rename to examples/particles/images/sparkleSize.png diff --git a/examples/declarative/particles/plasmapatrol/content/pics/star.png b/examples/particles/images/star.png similarity index 100% rename from examples/declarative/particles/plasmapatrol/content/pics/star.png rename to examples/particles/images/star.png diff --git a/examples/declarative/particles/images/starfish_0.png b/examples/particles/images/starfish_0.png similarity index 100% rename from examples/declarative/particles/images/starfish_0.png rename to examples/particles/images/starfish_0.png diff --git a/examples/declarative/particles/images/starfish_1.png b/examples/particles/images/starfish_1.png similarity index 100% rename from examples/declarative/particles/images/starfish_1.png rename to examples/particles/images/starfish_1.png diff --git a/examples/declarative/particles/images/starfish_2.png b/examples/particles/images/starfish_2.png similarity index 100% rename from examples/declarative/particles/images/starfish_2.png rename to examples/particles/images/starfish_2.png diff --git a/examples/declarative/particles/images/starfish_3.png b/examples/particles/images/starfish_3.png similarity index 100% rename from examples/declarative/particles/images/starfish_3.png rename to examples/particles/images/starfish_3.png diff --git a/examples/declarative/particles/images/starfish_4.png b/examples/particles/images/starfish_4.png similarity index 100% rename from examples/declarative/particles/images/starfish_4.png rename to examples/particles/images/starfish_4.png diff --git a/examples/declarative/particles/images/starfish_mask.png b/examples/particles/images/starfish_mask.png similarity index 100% rename from examples/declarative/particles/images/starfish_mask.png rename to examples/particles/images/starfish_mask.png diff --git a/examples/declarative/modelviews/package/Delegate.qml b/examples/particles/itemparticle/content/Delegate.qml similarity index 100% rename from examples/declarative/modelviews/package/Delegate.qml rename to examples/particles/itemparticle/content/Delegate.qml diff --git a/examples/declarative/particles/itemparticle/content/Delegate2.qml b/examples/particles/itemparticle/content/Delegate2.qml similarity index 100% rename from examples/declarative/particles/itemparticle/content/Delegate2.qml rename to examples/particles/itemparticle/content/Delegate2.qml diff --git a/examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml b/examples/particles/itemparticle/content/ExpandingDelegate.qml similarity index 100% rename from examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml rename to examples/particles/itemparticle/content/ExpandingDelegate.qml diff --git a/examples/declarative/particles/itemparticle/content/RssModel.qml b/examples/particles/itemparticle/content/RssModel.qml similarity index 100% rename from examples/declarative/particles/itemparticle/content/RssModel.qml rename to examples/particles/itemparticle/content/RssModel.qml diff --git a/examples/declarative/particles/itemparticle/content/bubble.png b/examples/particles/itemparticle/content/bubble.png similarity index 100% rename from examples/declarative/particles/itemparticle/content/bubble.png rename to examples/particles/itemparticle/content/bubble.png diff --git a/examples/declarative/photoviewer/PhotoViewerCore/script/script.js b/examples/particles/itemparticle/content/script.js similarity index 100% rename from examples/declarative/photoviewer/PhotoViewerCore/script/script.js rename to examples/particles/itemparticle/content/script.js diff --git a/examples/declarative/particles/itemparticle/delegates.qml b/examples/particles/itemparticle/delegates.qml similarity index 100% rename from examples/declarative/particles/itemparticle/delegates.qml rename to examples/particles/itemparticle/delegates.qml diff --git a/examples/declarative/particles/itemparticle/particleview.qml b/examples/particles/itemparticle/particleview.qml similarity index 100% rename from examples/declarative/particles/itemparticle/particleview.qml rename to examples/particles/itemparticle/particleview.qml diff --git a/examples/particles/particles.pro b/examples/particles/particles.pro new file mode 100644 index 0000000000..967108504e --- /dev/null +++ b/examples/particles/particles.pro @@ -0,0 +1 @@ +TEMPLATE = subdirs diff --git a/examples/declarative/particles/simple/dynamiccomparison.qml b/examples/particles/simple/dynamiccomparison.qml similarity index 100% rename from examples/declarative/particles/simple/dynamiccomparison.qml rename to examples/particles/simple/dynamiccomparison.qml diff --git a/examples/declarative/particles/simple/dynamicemitters.qml b/examples/particles/simple/dynamicemitters.qml similarity index 100% rename from examples/declarative/particles/simple/dynamicemitters.qml rename to examples/particles/simple/dynamicemitters.qml diff --git a/examples/declarative/particles/simple/multiplepainters.qml b/examples/particles/simple/multiplepainters.qml similarity index 100% rename from examples/declarative/particles/simple/multiplepainters.qml rename to examples/particles/simple/multiplepainters.qml diff --git a/examples/declarative/particles/simple/startstop.qml b/examples/particles/simple/startstop.qml similarity index 100% rename from examples/declarative/particles/simple/startstop.qml rename to examples/particles/simple/startstop.qml diff --git a/examples/declarative/cppextensions/cppextensions.pro b/examples/qml/cppextensions/cppextensions.pro similarity index 100% rename from examples/declarative/cppextensions/cppextensions.pro rename to examples/qml/cppextensions/cppextensions.pro diff --git a/examples/declarative/cppextensions/cppextensions.qmlproject b/examples/qml/cppextensions/cppextensions.qmlproject similarity index 100% rename from examples/declarative/cppextensions/cppextensions.qmlproject rename to examples/qml/cppextensions/cppextensions.qmlproject diff --git a/examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir b/examples/qml/cppextensions/imageprovider/ImageProviderCore/qmldir similarity index 100% rename from examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir rename to examples/qml/cppextensions/imageprovider/ImageProviderCore/qmldir diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml b/examples/qml/cppextensions/imageprovider/imageprovider-example.qml similarity index 100% rename from examples/declarative/cppextensions/imageprovider/imageprovider-example.qml rename to examples/qml/cppextensions/imageprovider/imageprovider-example.qml diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp b/examples/qml/cppextensions/imageprovider/imageprovider.cpp similarity index 100% rename from examples/declarative/cppextensions/imageprovider/imageprovider.cpp rename to examples/qml/cppextensions/imageprovider/imageprovider.cpp diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/qml/cppextensions/imageprovider/imageprovider.pro similarity index 100% rename from examples/declarative/cppextensions/imageprovider/imageprovider.pro rename to examples/qml/cppextensions/imageprovider/imageprovider.pro diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.qmlproject b/examples/qml/cppextensions/imageprovider/imageprovider.qmlproject similarity index 100% rename from examples/declarative/cppextensions/imageprovider/imageprovider.qmlproject rename to examples/qml/cppextensions/imageprovider/imageprovider.qmlproject diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp b/examples/qml/cppextensions/networkaccessmanagerfactory/main.cpp similarity index 100% rename from examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp rename to examples/qml/cppextensions/networkaccessmanagerfactory/main.cpp diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro b/examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro similarity index 100% rename from examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro rename to examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qmlproject b/examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qmlproject similarity index 100% rename from examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qmlproject rename to examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qmlproject diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc b/examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc similarity index 100% rename from examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc rename to examples/qml/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml b/examples/qml/cppextensions/networkaccessmanagerfactory/view.qml similarity index 100% rename from examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml rename to examples/qml/cppextensions/networkaccessmanagerfactory/view.qml diff --git a/examples/declarative/cppextensions/plugins/README b/examples/qml/cppextensions/plugins/README similarity index 100% rename from examples/declarative/cppextensions/plugins/README rename to examples/qml/cppextensions/plugins/README diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/Clock.qml similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/Clock.qml diff --git a/examples/declarative/toys/clocks/content/center.png b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/center.png similarity index 100% rename from examples/declarative/toys/clocks/content/center.png rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/center.png diff --git a/examples/declarative/toys/clocks/content/clock.png b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/clock.png similarity index 100% rename from examples/declarative/toys/clocks/content/clock.png rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/clock.png diff --git a/examples/declarative/toys/clocks/content/hour.png b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/hour.png similarity index 100% rename from examples/declarative/toys/clocks/content/hour.png rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/hour.png diff --git a/examples/declarative/toys/clocks/content/minute.png b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/minute.png similarity index 100% rename from examples/declarative/toys/clocks/content/minute.png rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/minute.png diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir b/examples/qml/cppextensions/plugins/com/nokia/TimeExample/qmldir similarity index 100% rename from examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir rename to examples/qml/cppextensions/plugins/com/nokia/TimeExample/qmldir diff --git a/examples/declarative/cppextensions/plugins/plugin.cpp b/examples/qml/cppextensions/plugins/plugin.cpp similarity index 100% rename from examples/declarative/cppextensions/plugins/plugin.cpp rename to examples/qml/cppextensions/plugins/plugin.cpp diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/qml/cppextensions/plugins/plugins.pro similarity index 100% rename from examples/declarative/cppextensions/plugins/plugins.pro rename to examples/qml/cppextensions/plugins/plugins.pro diff --git a/examples/declarative/cppextensions/plugins/plugins.qml b/examples/qml/cppextensions/plugins/plugins.qml similarity index 100% rename from examples/declarative/cppextensions/plugins/plugins.qml rename to examples/qml/cppextensions/plugins/plugins.qml diff --git a/examples/declarative/cppextensions/plugins/plugins.qmlproject b/examples/qml/cppextensions/plugins/plugins.qmlproject similarity index 100% rename from examples/declarative/cppextensions/plugins/plugins.qmlproject rename to examples/qml/cppextensions/plugins/plugins.qmlproject diff --git a/examples/declarative/cppextensions/referenceexamples/adding/adding.pro b/examples/qml/cppextensions/referenceexamples/adding/adding.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/adding.pro rename to examples/qml/cppextensions/referenceexamples/adding/adding.pro diff --git a/examples/declarative/cppextensions/referenceexamples/adding/adding.qrc b/examples/qml/cppextensions/referenceexamples/adding/adding.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/adding.qrc rename to examples/qml/cppextensions/referenceexamples/adding/adding.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/adding/example.qml b/examples/qml/cppextensions/referenceexamples/adding/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/example.qml rename to examples/qml/cppextensions/referenceexamples/adding/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp b/examples/qml/cppextensions/referenceexamples/adding/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/main.cpp rename to examples/qml/cppextensions/referenceexamples/adding/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/adding/person.cpp b/examples/qml/cppextensions/referenceexamples/adding/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/person.cpp rename to examples/qml/cppextensions/referenceexamples/adding/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/adding/person.h b/examples/qml/cppextensions/referenceexamples/adding/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/adding/person.h rename to examples/qml/cppextensions/referenceexamples/adding/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/attached/attached.pro b/examples/qml/cppextensions/referenceexamples/attached/attached.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/attached.pro rename to examples/qml/cppextensions/referenceexamples/attached/attached.pro diff --git a/examples/declarative/cppextensions/referenceexamples/attached/attached.qrc b/examples/qml/cppextensions/referenceexamples/attached/attached.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/attached.qrc rename to examples/qml/cppextensions/referenceexamples/attached/attached.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/attached/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/attached/example.qml b/examples/qml/cppextensions/referenceexamples/attached/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/example.qml rename to examples/qml/cppextensions/referenceexamples/attached/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp b/examples/qml/cppextensions/referenceexamples/attached/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/main.cpp rename to examples/qml/cppextensions/referenceexamples/attached/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/attached/person.cpp b/examples/qml/cppextensions/referenceexamples/attached/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/person.cpp rename to examples/qml/cppextensions/referenceexamples/attached/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/attached/person.h b/examples/qml/cppextensions/referenceexamples/attached/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/attached/person.h rename to examples/qml/cppextensions/referenceexamples/attached/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/binding/binding.pro b/examples/qml/cppextensions/referenceexamples/binding/binding.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/binding.pro rename to examples/qml/cppextensions/referenceexamples/binding/binding.pro diff --git a/examples/declarative/cppextensions/referenceexamples/binding/binding.qrc b/examples/qml/cppextensions/referenceexamples/binding/binding.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/binding.qrc rename to examples/qml/cppextensions/referenceexamples/binding/binding.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/binding/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/binding/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/binding/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/binding/example.qml b/examples/qml/cppextensions/referenceexamples/binding/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/example.qml rename to examples/qml/cppextensions/referenceexamples/binding/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/binding/happybirthdaysong.cpp b/examples/qml/cppextensions/referenceexamples/binding/happybirthdaysong.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/happybirthdaysong.cpp rename to examples/qml/cppextensions/referenceexamples/binding/happybirthdaysong.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/binding/happybirthdaysong.h b/examples/qml/cppextensions/referenceexamples/binding/happybirthdaysong.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/happybirthdaysong.h rename to examples/qml/cppextensions/referenceexamples/binding/happybirthdaysong.h diff --git a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp b/examples/qml/cppextensions/referenceexamples/binding/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/main.cpp rename to examples/qml/cppextensions/referenceexamples/binding/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/binding/person.cpp b/examples/qml/cppextensions/referenceexamples/binding/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/person.cpp rename to examples/qml/cppextensions/referenceexamples/binding/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/binding/person.h b/examples/qml/cppextensions/referenceexamples/binding/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/binding/person.h rename to examples/qml/cppextensions/referenceexamples/binding/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro b/examples/qml/cppextensions/referenceexamples/coercion/coercion.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro rename to examples/qml/cppextensions/referenceexamples/coercion/coercion.pro diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/coercion.qrc b/examples/qml/cppextensions/referenceexamples/coercion/coercion.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/coercion.qrc rename to examples/qml/cppextensions/referenceexamples/coercion/coercion.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/example.qml b/examples/qml/cppextensions/referenceexamples/coercion/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/example.qml rename to examples/qml/cppextensions/referenceexamples/coercion/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp b/examples/qml/cppextensions/referenceexamples/coercion/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/main.cpp rename to examples/qml/cppextensions/referenceexamples/coercion/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/person.cpp b/examples/qml/cppextensions/referenceexamples/coercion/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/person.cpp rename to examples/qml/cppextensions/referenceexamples/coercion/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/person.h b/examples/qml/cppextensions/referenceexamples/coercion/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/coercion/person.h rename to examples/qml/cppextensions/referenceexamples/coercion/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/default/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/default/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/default/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/default/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/default/default.pro b/examples/qml/cppextensions/referenceexamples/default/default.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/default.pro rename to examples/qml/cppextensions/referenceexamples/default/default.pro diff --git a/examples/declarative/cppextensions/referenceexamples/default/default.qrc b/examples/qml/cppextensions/referenceexamples/default/default.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/default.qrc rename to examples/qml/cppextensions/referenceexamples/default/default.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/default/example.qml b/examples/qml/cppextensions/referenceexamples/default/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/example.qml rename to examples/qml/cppextensions/referenceexamples/default/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/default/main.cpp b/examples/qml/cppextensions/referenceexamples/default/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/main.cpp rename to examples/qml/cppextensions/referenceexamples/default/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/default/person.cpp b/examples/qml/cppextensions/referenceexamples/default/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/person.cpp rename to examples/qml/cppextensions/referenceexamples/default/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/default/person.h b/examples/qml/cppextensions/referenceexamples/default/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/default/person.h rename to examples/qml/cppextensions/referenceexamples/default/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/extended/example.qml b/examples/qml/cppextensions/referenceexamples/extended/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/example.qml rename to examples/qml/cppextensions/referenceexamples/extended/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/extended/extended.pro b/examples/qml/cppextensions/referenceexamples/extended/extended.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/extended.pro rename to examples/qml/cppextensions/referenceexamples/extended/extended.pro diff --git a/examples/declarative/cppextensions/referenceexamples/extended/extended.qrc b/examples/qml/cppextensions/referenceexamples/extended/extended.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/extended.qrc rename to examples/qml/cppextensions/referenceexamples/extended/extended.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/extended/lineedit.cpp b/examples/qml/cppextensions/referenceexamples/extended/lineedit.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/lineedit.cpp rename to examples/qml/cppextensions/referenceexamples/extended/lineedit.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/extended/lineedit.h b/examples/qml/cppextensions/referenceexamples/extended/lineedit.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/lineedit.h rename to examples/qml/cppextensions/referenceexamples/extended/lineedit.h diff --git a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp b/examples/qml/cppextensions/referenceexamples/extended/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/extended/main.cpp rename to examples/qml/cppextensions/referenceexamples/extended/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/example.qml b/examples/qml/cppextensions/referenceexamples/grouped/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/example.qml rename to examples/qml/cppextensions/referenceexamples/grouped/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro b/examples/qml/cppextensions/referenceexamples/grouped/grouped.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro rename to examples/qml/cppextensions/referenceexamples/grouped/grouped.pro diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/grouped.qrc b/examples/qml/cppextensions/referenceexamples/grouped/grouped.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/grouped.qrc rename to examples/qml/cppextensions/referenceexamples/grouped/grouped.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp b/examples/qml/cppextensions/referenceexamples/grouped/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/main.cpp rename to examples/qml/cppextensions/referenceexamples/grouped/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/person.cpp b/examples/qml/cppextensions/referenceexamples/grouped/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/person.cpp rename to examples/qml/cppextensions/referenceexamples/grouped/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/person.h b/examples/qml/cppextensions/referenceexamples/grouped/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/grouped/person.h rename to examples/qml/cppextensions/referenceexamples/grouped/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/methods/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/methods/example.qml b/examples/qml/cppextensions/referenceexamples/methods/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/example.qml rename to examples/qml/cppextensions/referenceexamples/methods/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/methods/main.cpp b/examples/qml/cppextensions/referenceexamples/methods/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/main.cpp rename to examples/qml/cppextensions/referenceexamples/methods/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/methods/methods.pro b/examples/qml/cppextensions/referenceexamples/methods/methods.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/methods.pro rename to examples/qml/cppextensions/referenceexamples/methods/methods.pro diff --git a/examples/declarative/cppextensions/referenceexamples/methods/methods.qrc b/examples/qml/cppextensions/referenceexamples/methods/methods.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/methods.qrc rename to examples/qml/cppextensions/referenceexamples/methods/methods.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/methods/person.cpp b/examples/qml/cppextensions/referenceexamples/methods/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/person.cpp rename to examples/qml/cppextensions/referenceexamples/methods/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/methods/person.h b/examples/qml/cppextensions/referenceexamples/methods/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/methods/person.h rename to examples/qml/cppextensions/referenceexamples/methods/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/properties/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/properties/example.qml b/examples/qml/cppextensions/referenceexamples/properties/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/example.qml rename to examples/qml/cppextensions/referenceexamples/properties/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp b/examples/qml/cppextensions/referenceexamples/properties/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/main.cpp rename to examples/qml/cppextensions/referenceexamples/properties/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/properties/person.cpp b/examples/qml/cppextensions/referenceexamples/properties/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/person.cpp rename to examples/qml/cppextensions/referenceexamples/properties/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/properties/person.h b/examples/qml/cppextensions/referenceexamples/properties/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/person.h rename to examples/qml/cppextensions/referenceexamples/properties/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/properties/properties.pro b/examples/qml/cppextensions/referenceexamples/properties/properties.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/properties.pro rename to examples/qml/cppextensions/referenceexamples/properties/properties.pro diff --git a/examples/declarative/cppextensions/referenceexamples/properties/properties.qrc b/examples/qml/cppextensions/referenceexamples/properties/properties.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/properties/properties.qrc rename to examples/qml/cppextensions/referenceexamples/properties/properties.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/referenceexamples.pro b/examples/qml/cppextensions/referenceexamples/referenceexamples.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/referenceexamples.pro rename to examples/qml/cppextensions/referenceexamples/referenceexamples.pro diff --git a/examples/declarative/cppextensions/referenceexamples/referenceexamples.qmlproject b/examples/qml/cppextensions/referenceexamples/referenceexamples.qmlproject similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/referenceexamples.qmlproject rename to examples/qml/cppextensions/referenceexamples/referenceexamples.qmlproject diff --git a/examples/declarative/cppextensions/referenceexamples/signal/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/signal/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/signal/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/signal/example.qml b/examples/qml/cppextensions/referenceexamples/signal/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/example.qml rename to examples/qml/cppextensions/referenceexamples/signal/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp b/examples/qml/cppextensions/referenceexamples/signal/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/main.cpp rename to examples/qml/cppextensions/referenceexamples/signal/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/signal/person.cpp b/examples/qml/cppextensions/referenceexamples/signal/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/person.cpp rename to examples/qml/cppextensions/referenceexamples/signal/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/signal/person.h b/examples/qml/cppextensions/referenceexamples/signal/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/person.h rename to examples/qml/cppextensions/referenceexamples/signal/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/signal/signal.pro b/examples/qml/cppextensions/referenceexamples/signal/signal.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/signal.pro rename to examples/qml/cppextensions/referenceexamples/signal/signal.pro diff --git a/examples/declarative/cppextensions/referenceexamples/signal/signal.qrc b/examples/qml/cppextensions/referenceexamples/signal/signal.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/signal/signal.qrc rename to examples/qml/cppextensions/referenceexamples/signal/signal.qrc diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/birthdayparty.cpp rename to examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/birthdayparty.h b/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/birthdayparty.h rename to examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.h diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/example.qml b/examples/qml/cppextensions/referenceexamples/valuesource/example.qml similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/example.qml rename to examples/qml/cppextensions/referenceexamples/valuesource/example.qml diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.cpp b/examples/qml/cppextensions/referenceexamples/valuesource/happybirthdaysong.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.cpp rename to examples/qml/cppextensions/referenceexamples/valuesource/happybirthdaysong.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.h b/examples/qml/cppextensions/referenceexamples/valuesource/happybirthdaysong.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/happybirthdaysong.h rename to examples/qml/cppextensions/referenceexamples/valuesource/happybirthdaysong.h diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp b/examples/qml/cppextensions/referenceexamples/valuesource/main.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp rename to examples/qml/cppextensions/referenceexamples/valuesource/main.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/person.cpp b/examples/qml/cppextensions/referenceexamples/valuesource/person.cpp similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/person.cpp rename to examples/qml/cppextensions/referenceexamples/valuesource/person.cpp diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/person.h b/examples/qml/cppextensions/referenceexamples/valuesource/person.h similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/person.h rename to examples/qml/cppextensions/referenceexamples/valuesource/person.h diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro b/examples/qml/cppextensions/referenceexamples/valuesource/valuesource.pro similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro rename to examples/qml/cppextensions/referenceexamples/valuesource/valuesource.pro diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.qrc b/examples/qml/cppextensions/referenceexamples/valuesource/valuesource.qrc similarity index 100% rename from examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.qrc rename to examples/qml/cppextensions/referenceexamples/valuesource/valuesource.qrc diff --git a/examples/declarative/i18n/i18n.qml b/examples/qml/i18n/i18n.qml similarity index 100% rename from examples/declarative/i18n/i18n.qml rename to examples/qml/i18n/i18n.qml diff --git a/examples/declarative/i18n/i18n/base.ts b/examples/qml/i18n/i18n/base.ts similarity index 100% rename from examples/declarative/i18n/i18n/base.ts rename to examples/qml/i18n/i18n/base.ts diff --git a/examples/declarative/i18n/i18n/qml_en_AU.ts b/examples/qml/i18n/i18n/qml_en_AU.ts similarity index 100% rename from examples/declarative/i18n/i18n/qml_en_AU.ts rename to examples/qml/i18n/i18n/qml_en_AU.ts diff --git a/examples/declarative/i18n/i18n/qml_fr.ts b/examples/qml/i18n/i18n/qml_fr.ts similarity index 100% rename from examples/declarative/i18n/i18n/qml_fr.ts rename to examples/qml/i18n/i18n/qml_fr.ts diff --git a/examples/declarative/locale/locale.qml b/examples/qml/locale/locale.qml similarity index 100% rename from examples/declarative/locale/locale.qml rename to examples/qml/locale/locale.qml diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro new file mode 100644 index 0000000000..967108504e --- /dev/null +++ b/examples/qml/qml.pro @@ -0,0 +1 @@ +TEMPLATE = subdirs diff --git a/examples/declarative/script/script.pro b/examples/qml/script/script.pro similarity index 100% rename from examples/declarative/script/script.pro rename to examples/qml/script/script.pro diff --git a/examples/declarative/script/shell/main.cpp b/examples/qml/script/shell/main.cpp similarity index 100% rename from examples/declarative/script/shell/main.cpp rename to examples/qml/script/shell/main.cpp diff --git a/examples/declarative/script/shell/shell.pro b/examples/qml/script/shell/shell.pro similarity index 100% rename from examples/declarative/script/shell/shell.pro rename to examples/qml/script/shell/shell.pro diff --git a/examples/declarative/xml/xmlhttprequest/data.xml b/examples/qml/xmlhttprequest/data.xml similarity index 100% rename from examples/declarative/xml/xmlhttprequest/data.xml rename to examples/qml/xmlhttprequest/data.xml diff --git a/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml b/examples/qml/xmlhttprequest/xmlhttprequest-example.qml similarity index 100% rename from examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml rename to examples/qml/xmlhttprequest/xmlhttprequest-example.qml diff --git a/examples/qtquick/accessibility/accessibility.pro b/examples/qtquick/accessibility/accessibility.pro new file mode 100644 index 0000000000..20d68e0c5c --- /dev/null +++ b/examples/qtquick/accessibility/accessibility.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += quick declarative +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility +qml.files = accessibility.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility +INSTALLS += target qml + diff --git a/examples/declarative/accessibility/accessibility.qml b/examples/qtquick/accessibility/accessibility.qml similarity index 91% rename from examples/declarative/accessibility/accessibility.qml rename to examples/qtquick/accessibility/accessibility.qml index 6fdcd38ac6..ff115ab4b3 100644 --- a/examples/declarative/accessibility/accessibility.qml +++ b/examples/qtquick/accessibility/accessibility.qml @@ -40,13 +40,19 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Window 2.0 -import "widgets" +import "content" + +/*! + \title QtQuick Examples - Accessibility + \example qtquick/accessibility + \brief This example has accessible buttons. + +*/ Rectangle { id: window - width: 360; height: 300 + width: 320; height: 480 color: "white" Column { @@ -70,7 +76,6 @@ Rectangle { Accessible.role: Accessible.StaticText Accessible.name: text text: "Subject:" - width: 50 } Rectangle { id: subjectBorder @@ -79,7 +84,7 @@ Rectangle { border.width: 1 border.color: "black" height: subjectEdit.height - width: 304 + width: 240 TextInput { id: subjectEdit text: "Vacation plans" @@ -92,8 +97,8 @@ Rectangle { property alias text : textEdit.text border.width: 1 border.color: "black" - width: parent.width - height: textEdit.height + width: parent.width - 2 + height: parent.height - (textBorder.y + column.spacing) TextEdit { id: textEdit text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nbest wishes, your friend Luke" diff --git a/examples/declarative/tutorials/tutorials.qmlproject b/examples/qtquick/accessibility/accessibility.qmlproject similarity index 80% rename from examples/declarative/tutorials/tutorials.qmlproject rename to examples/qtquick/accessibility/accessibility.qmlproject index 2bb4016996..04a3190914 100644 --- a/examples/declarative/tutorials/tutorials.qmlproject +++ b/examples/qtquick/accessibility/accessibility.qmlproject @@ -1,6 +1,8 @@ -import QmlProject 1.0 +import QmlProject 1.1 Project { + mainFile: "accessibility.qml" + /* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { directory: "." diff --git a/examples/declarative/accessibility/widgets/Button.qml b/examples/qtquick/accessibility/content/Button.qml similarity index 98% rename from examples/declarative/accessibility/widgets/Button.qml rename to examples/qtquick/accessibility/content/Button.qml index 4a076fa428..33cee8036c 100644 --- a/examples/declarative/accessibility/widgets/Button.qml +++ b/examples/qtquick/accessibility/content/Button.qml @@ -44,6 +44,7 @@ import QtQuick 2.0 Rectangle { id: button + property bool checked: false property alias text : buttonText.text Accessible.name: text Accessible.description: "This button does " + text diff --git a/examples/qtquick/accessibility/main.cpp b/examples/qtquick/accessibility/main.cpp new file mode 100644 index 0000000000..89e23b477b --- /dev/null +++ b/examples/qtquick/accessibility/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(accessibility) diff --git a/examples/qtquick/animation/animation.pro b/examples/qtquick/animation/animation.pro new file mode 100644 index 0000000000..7e4cf9ef66 --- /dev/null +++ b/examples/qtquick/animation/animation.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += quick declarative +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation +qml.files = animation.qml basics behaviors easing pathanimation pathinterpolator states +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation +INSTALLS += target qml + diff --git a/examples/declarative/animation/animation.qml b/examples/qtquick/animation/animation.qml similarity index 69% rename from examples/declarative/animation/animation.qml rename to examples/qtquick/animation/animation.qml index 7c5829e790..62a85a9cfa 100644 --- a/examples/declarative/animation/animation.qml +++ b/examples/qtquick/animation/animation.qml @@ -39,19 +39,47 @@ ****************************************************************************/ import QtQuick 2.0 -import "../shared" +import "../../shared" as Examples + +/*! + \title QtQuick Examples - Animation + \example qtquick/animation + \brief This is a collection of QML Animation examples. + \image qml-animations-example.png + + This is a collection of small QML examples relating to animation. Each example is + a small QML file emphasizing a particular element or feature. + + ColorAnimation demonstrates using a color animation to fade a sky from day to night. + + PropertyAnimation demonstrates using a number animation to bounce a circle up and down. + + Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click. + + Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it. + + Easing Curves shows off all the easing curves available in Qt Quick animations. + + States demonstrates how the properties of an item can vary between states. + + Transitions takes the States example and animates the property changes. + + PathAnimation animates an image along a beizer curve using a PathAnimation. + + PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead. +*/ Item { height: 480 width: 320 - LauncherList { + Examples.LauncherList { id: ll anchors.fill: parent Component.onCompleted: { addExample("ColorAnimation", "Interpolates between colors", Qt.resolvedUrl("basics/color-animation.qml")); addExample("PropertyAnimation", "Interpolates between numbers", Qt.resolvedUrl("basics/property-animation.qml")); addExample("Behaviors", "Animates procedural movement", Qt.resolvedUrl("behaviors/behavior-example.qml")); - addExample("WigglyText", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml")); + addExample("Wiggly Text", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml")); addExample("Easing Curves", "Compare available easing curves", Qt.resolvedUrl("easing/easing.qml")); addExample("States", "Simple states", Qt.resolvedUrl("states/states.qml")); addExample("Transitions", "Simple states with animated transitions", Qt.resolvedUrl("states/transitions.qml")); diff --git a/examples/declarative/animation/animation.qmlproject b/examples/qtquick/animation/animation.qmlproject similarity index 100% rename from examples/declarative/animation/animation.qmlproject rename to examples/qtquick/animation/animation.qmlproject diff --git a/examples/declarative/animation/basics/color-animation.qml b/examples/qtquick/animation/basics/color-animation.qml similarity index 99% rename from examples/declarative/animation/basics/color-animation.qml rename to examples/qtquick/animation/basics/color-animation.qml index a54091d7dd..f1bf40c40b 100644 --- a/examples/declarative/animation/basics/color-animation.qml +++ b/examples/qtquick/animation/basics/color-animation.qml @@ -43,7 +43,7 @@ import QtQuick.Particles 2.0 Item { id: window - width: 640; height: 480 + width: 320; height: 480 // Let's draw the sky... Rectangle { diff --git a/examples/declarative/modelviews/parallax/content/pics/face-smile.png b/examples/qtquick/animation/basics/images/face-smile.png similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/face-smile.png rename to examples/qtquick/animation/basics/images/face-smile.png diff --git a/examples/declarative/animation/basics/images/moon.png b/examples/qtquick/animation/basics/images/moon.png similarity index 100% rename from examples/declarative/animation/basics/images/moon.png rename to examples/qtquick/animation/basics/images/moon.png diff --git a/examples/declarative/animation/basics/images/shadow.png b/examples/qtquick/animation/basics/images/shadow.png similarity index 100% rename from examples/declarative/animation/basics/images/shadow.png rename to examples/qtquick/animation/basics/images/shadow.png diff --git a/examples/declarative/toys/dynamicscene/content/images/star.png b/examples/qtquick/animation/basics/images/star.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/star.png rename to examples/qtquick/animation/basics/images/star.png diff --git a/examples/declarative/toys/dynamicscene/content/images/sun.png b/examples/qtquick/animation/basics/images/sun.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/sun.png rename to examples/qtquick/animation/basics/images/sun.png diff --git a/examples/declarative/animation/basics/property-animation.qml b/examples/qtquick/animation/basics/property-animation.qml similarity index 100% rename from examples/declarative/animation/basics/property-animation.qml rename to examples/qtquick/animation/basics/property-animation.qml diff --git a/examples/declarative/animation/behaviors/SideRect.qml b/examples/qtquick/animation/behaviors/SideRect.qml similarity index 100% rename from examples/declarative/animation/behaviors/SideRect.qml rename to examples/qtquick/animation/behaviors/SideRect.qml diff --git a/examples/declarative/animation/behaviors/behavior-example.qml b/examples/qtquick/animation/behaviors/behavior-example.qml similarity index 99% rename from examples/declarative/animation/behaviors/behavior-example.qml rename to examples/qtquick/animation/behaviors/behavior-example.qml index 89fc9992b6..a88d7c8c7b 100644 --- a/examples/declarative/animation/behaviors/behavior-example.qml +++ b/examples/qtquick/animation/behaviors/behavior-example.qml @@ -41,7 +41,7 @@ import QtQuick 2.0 Rectangle { - width: 600; height: 400 + width: 320; height: 480 color: "#343434" Rectangle { diff --git a/examples/declarative/animation/behaviors/wigglytext.qml b/examples/qtquick/animation/behaviors/wigglytext.qml similarity index 97% rename from examples/declarative/animation/behaviors/wigglytext.qml rename to examples/qtquick/animation/behaviors/wigglytext.qml index e2ed472088..4bb94da100 100644 --- a/examples/declarative/animation/behaviors/wigglytext.qml +++ b/examples/qtquick/animation/behaviors/wigglytext.qml @@ -43,10 +43,10 @@ import QtQuick 2.0 Rectangle { id: container - property string text: "Drag this text..." + property string text: "Drag me!" property bool animated: true - width: 640; height: 480; color: "#474747"; focus: true + width: 320; height: 480; color: "#474747"; focus: true Keys.onPressed: { if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace) @@ -86,7 +86,7 @@ Rectangle { id: letter property variant follow - x: follow ? follow.x + follow.width : container.width / 3 + x: follow ? follow.x + follow.width : container.width / 6 y: follow ? follow.y : container.height / 2 font.pixelSize: 40; font.bold: true diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/qtquick/animation/easing/content/QuitButton.qml similarity index 100% rename from examples/declarative/toys/clocks/content/QuitButton.qml rename to examples/qtquick/animation/easing/content/QuitButton.qml diff --git a/examples/declarative/toys/clocks/content/quit.png b/examples/qtquick/animation/easing/content/quit.png similarity index 100% rename from examples/declarative/toys/clocks/content/quit.png rename to examples/qtquick/animation/easing/content/quit.png diff --git a/examples/declarative/animation/easing/easing.qml b/examples/qtquick/animation/easing/easing.qml similarity index 93% rename from examples/declarative/animation/easing/easing.qml rename to examples/qtquick/animation/easing/easing.qml index 207b653d6e..8977029fb3 100644 --- a/examples/declarative/animation/easing/easing.qml +++ b/examples/qtquick/animation/easing/easing.qml @@ -43,7 +43,7 @@ import "content" Rectangle { id: window - width: 600; height: 460; color: "#232323" + width: 320; height: 480; color: "#232323" property var easingCurve: [ 0.2, 0.2, 0.13, 0.65, 0.2, 0.8, 0.624, 0.98, 0.93, 0.95, 1, 1 ] @@ -141,22 +141,9 @@ Rectangle { Flickable { anchors.fill: parent - contentHeight: layout.height+50 - Rectangle { - id: titlePane - color: "#444444" - height: 35 - anchors { top: parent.top; left: parent.left; right: parent.right } - QuitButton { - id: quitButton - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 10 - } - } + contentHeight: layout.height Column { id: layout - anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right } Repeater { model: easingTypes; delegate: delegate } } } diff --git a/examples/qtquick/animation/main.cpp b/examples/qtquick/animation/main.cpp new file mode 100644 index 0000000000..799dfd7725 --- /dev/null +++ b/examples/qtquick/animation/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(animation) diff --git a/examples/declarative/animation/pathanimation/pathanimation.qml b/examples/qtquick/animation/pathanimation/pathanimation.qml similarity index 76% rename from examples/declarative/animation/pathanimation/pathanimation.qml rename to examples/qtquick/animation/pathanimation/pathanimation.qml index 4d0a31bdf8..f995218c6c 100644 --- a/examples/declarative/animation/pathanimation/pathanimation.qml +++ b/examples/qtquick/animation/pathanimation/pathanimation.qml @@ -42,8 +42,8 @@ import QtQuick 2.0 Rectangle { id: window - width: 400 - height: 400 + width: 320 + height: 480 Canvas { id: canvas @@ -51,6 +51,7 @@ Rectangle { smooth: true onPaint: { + var context = canvas.getContext("2d") context.clearRect(0, 0, width, height) context.strokeStyle = "black" context.path = pathAnim.path @@ -58,27 +59,33 @@ Rectangle { } } - PathAnimation { - id: pathAnim + SequentialAnimation { + running: true + loops: -1 - duration: 2000 - easing.type: Easing.InQuad + PauseAnimation { duration: 1000 } + PathAnimation { + id: pathAnim - target: box - orientation: PathAnimation.RightFirst - anchorPoint: Qt.point(box.width/2, box.height/2) - path: Path { - startX: 50; startY: 50 + duration: 2000 + easing.type: Easing.InQuad - PathCubic { - x: window.width - 50 - y: window.height - 50 + target: box + orientation: PathAnimation.RightFirst + anchorPoint: Qt.point(box.width/2, box.height/2) + path: Path { + startX: 50; startY: 50 - control1X: x; control1Y: 50 - control2X: 50; control2Y: y - } + PathCubic { + x: window.width - 50 + y: window.height - 50 + + control1X: x; control1Y: 50 + control2X: 50; control2Y: y + } - onChanged: canvas.requestPaint() + onChanged: canvas.requestPaint() + } } } @@ -95,14 +102,4 @@ Rectangle { text: "Box" } } - - MouseArea { - anchors.fill: parent - onClicked: pathAnim.restart() - } - - Text { - text: "Click anywhere to animate along the path" - anchors.horizontalCenter: parent.horizontalCenter - } } diff --git a/examples/declarative/animation/pathinterpolator/pathinterpolator.qml b/examples/qtquick/animation/pathinterpolator/pathinterpolator.qml similarity index 87% rename from examples/declarative/animation/pathinterpolator/pathinterpolator.qml rename to examples/qtquick/animation/pathinterpolator/pathinterpolator.qml index 67a34ce582..5a137c732d 100644 --- a/examples/declarative/animation/pathinterpolator/pathinterpolator.qml +++ b/examples/qtquick/animation/pathinterpolator/pathinterpolator.qml @@ -42,8 +42,8 @@ import QtQuick 2.0 Rectangle { id: window - width: 400 - height: 400 + width: 320 + height: 480 Canvas { id: canvas @@ -51,6 +51,7 @@ Rectangle { smooth: true onPaint: { + var context = canvas.getContext("2d") context.clearRect(0, 0, width, height) context.strokeStyle = "black" context.path = motionPath.path @@ -75,12 +76,17 @@ Rectangle { onChanged: canvas.requestPaint() } - NumberAnimation on progress { - id: progressAnim - running: false - from: 0; to: 1 - duration: 2000 - easing.type: Easing.InQuad + SequentialAnimation on progress { + running: true + loops: -1 + PauseAnimation { duration: 1000 } + NumberAnimation { + id: progressAnim + running: false + from: 0; to: 1 + duration: 2000 + easing.type: Easing.InQuad + } } } @@ -103,13 +109,4 @@ Rectangle { } } - MouseArea { - anchors.fill: parent - onClicked: progressAnim.restart() - } - - Text { - text: "Click anywhere to animate along the path" - anchors.horizontalCenter: parent.horizontalCenter - } } diff --git a/examples/declarative/animation/states/qt-logo.png b/examples/qtquick/animation/states/qt-logo.png similarity index 100% rename from examples/declarative/animation/states/qt-logo.png rename to examples/qtquick/animation/states/qt-logo.png diff --git a/examples/declarative/animation/states/states.qml b/examples/qtquick/animation/states/states.qml similarity index 100% rename from examples/declarative/animation/states/states.qml rename to examples/qtquick/animation/states/states.qml diff --git a/examples/declarative/animation/states/transitions.qml b/examples/qtquick/animation/states/transitions.qml similarity index 100% rename from examples/declarative/animation/states/transitions.qml rename to examples/qtquick/animation/states/transitions.qml diff --git a/examples/declarative/canvas/bezierCurve/bezierCurve.qml b/examples/qtquick/canvas/bezierCurve/bezierCurve.qml similarity index 100% rename from examples/declarative/canvas/bezierCurve/bezierCurve.qml rename to examples/qtquick/canvas/bezierCurve/bezierCurve.qml diff --git a/examples/declarative/canvas/clip/clip.qml b/examples/qtquick/canvas/clip/clip.qml similarity index 100% rename from examples/declarative/canvas/clip/clip.qml rename to examples/qtquick/canvas/clip/clip.qml diff --git a/examples/declarative/canvas/contents/Button.qml b/examples/qtquick/canvas/contents/Button.qml similarity index 100% rename from examples/declarative/canvas/contents/Button.qml rename to examples/qtquick/canvas/contents/Button.qml diff --git a/examples/declarative/canvas/contents/ScrollBar.qml b/examples/qtquick/canvas/contents/ScrollBar.qml similarity index 100% rename from examples/declarative/canvas/contents/ScrollBar.qml rename to examples/qtquick/canvas/contents/ScrollBar.qml diff --git a/examples/declarative/canvas/contents/Slider.qml b/examples/qtquick/canvas/contents/Slider.qml similarity index 100% rename from examples/declarative/canvas/contents/Slider.qml rename to examples/qtquick/canvas/contents/Slider.qml diff --git a/examples/declarative/canvas/contents/Stocks.qml b/examples/qtquick/canvas/contents/Stocks.qml similarity index 100% rename from examples/declarative/canvas/contents/Stocks.qml rename to examples/qtquick/canvas/contents/Stocks.qml diff --git a/examples/declarative/canvas/contents/TitleBar.qml b/examples/qtquick/canvas/contents/TitleBar.qml similarity index 100% rename from examples/declarative/canvas/contents/TitleBar.qml rename to examples/qtquick/canvas/contents/TitleBar.qml diff --git a/examples/declarative/canvas/contents/ToolBar.qml b/examples/qtquick/canvas/contents/ToolBar.qml similarity index 100% rename from examples/declarative/canvas/contents/ToolBar.qml rename to examples/qtquick/canvas/contents/ToolBar.qml diff --git a/examples/declarative/canvas/contents/images/button-pressed.png b/examples/qtquick/canvas/contents/images/button-pressed.png similarity index 100% rename from examples/declarative/canvas/contents/images/button-pressed.png rename to examples/qtquick/canvas/contents/images/button-pressed.png diff --git a/examples/declarative/canvas/contents/images/button.png b/examples/qtquick/canvas/contents/images/button.png similarity index 100% rename from examples/declarative/canvas/contents/images/button.png rename to examples/qtquick/canvas/contents/images/button.png diff --git a/examples/declarative/canvas/contents/images/default.svg b/examples/qtquick/canvas/contents/images/default.svg similarity index 100% rename from examples/declarative/canvas/contents/images/default.svg rename to examples/qtquick/canvas/contents/images/default.svg diff --git a/examples/declarative/twitter/TwitterCore/images/gloss.png b/examples/qtquick/canvas/contents/images/gloss.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/gloss.png rename to examples/qtquick/canvas/contents/images/gloss.png diff --git a/examples/declarative/twitter/TwitterCore/images/lineedit.png b/examples/qtquick/canvas/contents/images/lineedit.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/lineedit.png rename to examples/qtquick/canvas/contents/images/lineedit.png diff --git a/examples/declarative/twitter/TwitterCore/images/lineedit.sci b/examples/qtquick/canvas/contents/images/lineedit.sci similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/lineedit.sci rename to examples/qtquick/canvas/contents/images/lineedit.sci diff --git a/examples/declarative/twitter/TwitterCore/images/quit.png b/examples/qtquick/canvas/contents/images/quit.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/quit.png rename to examples/qtquick/canvas/contents/images/quit.png diff --git a/examples/declarative/twitter/TwitterCore/images/stripes.png b/examples/qtquick/canvas/contents/images/stripes.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/stripes.png rename to examples/qtquick/canvas/contents/images/stripes.png diff --git a/examples/declarative/twitter/TwitterCore/images/titlebar.png b/examples/qtquick/canvas/contents/images/titlebar.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/titlebar.png rename to examples/qtquick/canvas/contents/images/titlebar.png diff --git a/examples/declarative/twitter/TwitterCore/images/titlebar.sci b/examples/qtquick/canvas/contents/images/titlebar.sci similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/titlebar.sci rename to examples/qtquick/canvas/contents/images/titlebar.sci diff --git a/examples/declarative/twitter/TwitterCore/images/toolbutton.png b/examples/qtquick/canvas/contents/images/toolbutton.png old mode 100644 new mode 100755 similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/toolbutton.png rename to examples/qtquick/canvas/contents/images/toolbutton.png diff --git a/examples/declarative/twitter/TwitterCore/images/toolbutton.sci b/examples/qtquick/canvas/contents/images/toolbutton.sci similarity index 100% rename from examples/declarative/twitter/TwitterCore/images/toolbutton.sci rename to examples/qtquick/canvas/contents/images/toolbutton.sci diff --git a/examples/declarative/canvas/contents/qt-logo.png b/examples/qtquick/canvas/contents/qt-logo.png similarity index 100% rename from examples/declarative/canvas/contents/qt-logo.png rename to examples/qtquick/canvas/contents/qt-logo.png diff --git a/examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/qtquick/canvas/quadraticCurveTo/quadraticCurveTo.qml similarity index 100% rename from examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml rename to examples/qtquick/canvas/quadraticCurveTo/quadraticCurveTo.qml diff --git a/examples/declarative/canvas/roundedrect/roundedrect.qml b/examples/qtquick/canvas/roundedrect/roundedrect.qml similarity index 100% rename from examples/declarative/canvas/roundedrect/roundedrect.qml rename to examples/qtquick/canvas/roundedrect/roundedrect.qml diff --git a/examples/declarative/canvas/smile/smile.qml b/examples/qtquick/canvas/smile/smile.qml similarity index 100% rename from examples/declarative/canvas/smile/smile.qml rename to examples/qtquick/canvas/smile/smile.qml diff --git a/examples/declarative/canvas/squircle/squircle.png b/examples/qtquick/canvas/squircle/squircle.png similarity index 100% rename from examples/declarative/canvas/squircle/squircle.png rename to examples/qtquick/canvas/squircle/squircle.png diff --git a/examples/declarative/canvas/squircle/squircle.qml b/examples/qtquick/canvas/squircle/squircle.qml similarity index 100% rename from examples/declarative/canvas/squircle/squircle.qml rename to examples/qtquick/canvas/squircle/squircle.qml diff --git a/examples/declarative/canvas/stockchart/README b/examples/qtquick/canvas/stockchart/README similarity index 100% rename from examples/declarative/canvas/stockchart/README rename to examples/qtquick/canvas/stockchart/README diff --git a/examples/declarative/canvas/stockchart/com/nokia/StockChartExample/qmldir b/examples/qtquick/canvas/stockchart/com/nokia/StockChartExample/qmldir similarity index 100% rename from examples/declarative/canvas/stockchart/com/nokia/StockChartExample/qmldir rename to examples/qtquick/canvas/stockchart/com/nokia/StockChartExample/qmldir diff --git a/examples/declarative/canvas/stockchart/model.cpp b/examples/qtquick/canvas/stockchart/model.cpp similarity index 100% rename from examples/declarative/canvas/stockchart/model.cpp rename to examples/qtquick/canvas/stockchart/model.cpp diff --git a/examples/declarative/canvas/stockchart/model.h b/examples/qtquick/canvas/stockchart/model.h similarity index 100% rename from examples/declarative/canvas/stockchart/model.h rename to examples/qtquick/canvas/stockchart/model.h diff --git a/examples/declarative/canvas/stockchart/plugin.cpp b/examples/qtquick/canvas/stockchart/plugin.cpp similarity index 100% rename from examples/declarative/canvas/stockchart/plugin.cpp rename to examples/qtquick/canvas/stockchart/plugin.cpp diff --git a/examples/declarative/canvas/stockchart/stock.qml b/examples/qtquick/canvas/stockchart/stock.qml similarity index 100% rename from examples/declarative/canvas/stockchart/stock.qml rename to examples/qtquick/canvas/stockchart/stock.qml diff --git a/examples/declarative/canvas/stockchart/stockchart.pro b/examples/qtquick/canvas/stockchart/stockchart.pro similarity index 100% rename from examples/declarative/canvas/stockchart/stockchart.pro rename to examples/qtquick/canvas/stockchart/stockchart.pro diff --git a/examples/declarative/canvas/tiger/tiger.js b/examples/qtquick/canvas/tiger/tiger.js similarity index 100% rename from examples/declarative/canvas/tiger/tiger.js rename to examples/qtquick/canvas/tiger/tiger.js diff --git a/examples/declarative/canvas/tiger/tiger.qml b/examples/qtquick/canvas/tiger/tiger.qml similarity index 100% rename from examples/declarative/canvas/tiger/tiger.qml rename to examples/qtquick/canvas/tiger/tiger.qml diff --git a/examples/declarative/canvas/twitterfriends/TwitterUser.qml b/examples/qtquick/canvas/twitterfriends/TwitterUser.qml similarity index 100% rename from examples/declarative/canvas/twitterfriends/TwitterUser.qml rename to examples/qtquick/canvas/twitterfriends/TwitterUser.qml diff --git a/examples/declarative/canvas/twitterfriends/cache.js b/examples/qtquick/canvas/twitterfriends/cache.js similarity index 100% rename from examples/declarative/canvas/twitterfriends/cache.js rename to examples/qtquick/canvas/twitterfriends/cache.js diff --git a/examples/declarative/canvas/twitterfriends/twitter.qml b/examples/qtquick/canvas/twitterfriends/twitter.qml similarity index 100% rename from examples/declarative/canvas/twitterfriends/twitter.qml rename to examples/qtquick/canvas/twitterfriends/twitter.qml diff --git a/examples/declarative/draganddrop/dragtarget.qmlproject b/examples/qtquick/draganddrop/dragtarget.qmlproject similarity index 100% rename from examples/declarative/draganddrop/dragtarget.qmlproject rename to examples/qtquick/draganddrop/dragtarget.qmlproject diff --git a/examples/declarative/draganddrop/tiles/DragTile.qml b/examples/qtquick/draganddrop/tiles/DragTile.qml similarity index 100% rename from examples/declarative/draganddrop/tiles/DragTile.qml rename to examples/qtquick/draganddrop/tiles/DragTile.qml diff --git a/examples/declarative/draganddrop/tiles/DropTile.qml b/examples/qtquick/draganddrop/tiles/DropTile.qml similarity index 100% rename from examples/declarative/draganddrop/tiles/DropTile.qml rename to examples/qtquick/draganddrop/tiles/DropTile.qml diff --git a/examples/declarative/draganddrop/tiles/tiles.qml b/examples/qtquick/draganddrop/tiles/tiles.qml similarity index 100% rename from examples/declarative/draganddrop/tiles/tiles.qml rename to examples/qtquick/draganddrop/tiles/tiles.qml diff --git a/examples/declarative/draganddrop/views/gridview.qml b/examples/qtquick/draganddrop/views/gridview.qml similarity index 100% rename from examples/declarative/draganddrop/views/gridview.qml rename to examples/qtquick/draganddrop/views/gridview.qml diff --git a/examples/qtquick/imageelements/borderimage.qml b/examples/qtquick/imageelements/borderimage.qml new file mode 100644 index 0000000000..7e132494db --- /dev/null +++ b/examples/qtquick/imageelements/borderimage.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "content" + +Rectangle { + id: page + width: 320 + height: 480 + + Flickable { + anchors.fill: parent + contentWidth: 1030 + contentHeight: 540 + Grid { + anchors.centerIn: parent; spacing: 20 + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + } + } +} diff --git a/examples/declarative/imageelements/content/BearSheet.png b/examples/qtquick/imageelements/content/BearSheet.png similarity index 100% rename from examples/declarative/imageelements/content/BearSheet.png rename to examples/qtquick/imageelements/content/BearSheet.png diff --git a/examples/declarative/imageelements/content/ImageCell.qml b/examples/qtquick/imageelements/content/ImageCell.qml similarity index 100% rename from examples/declarative/imageelements/content/ImageCell.qml rename to examples/qtquick/imageelements/content/ImageCell.qml diff --git a/examples/declarative/imageelements/content/MyBorderImage.qml b/examples/qtquick/imageelements/content/MyBorderImage.qml similarity index 100% rename from examples/declarative/imageelements/content/MyBorderImage.qml rename to examples/qtquick/imageelements/content/MyBorderImage.qml diff --git a/examples/declarative/imageelements/content/ShadowRectangle.qml b/examples/qtquick/imageelements/content/ShadowRectangle.qml similarity index 100% rename from examples/declarative/imageelements/content/ShadowRectangle.qml rename to examples/qtquick/imageelements/content/ShadowRectangle.qml diff --git a/examples/declarative/imageelements/content/bw.png b/examples/qtquick/imageelements/content/bw.png similarity index 100% rename from examples/declarative/imageelements/content/bw.png rename to examples/qtquick/imageelements/content/bw.png diff --git a/examples/declarative/imageelements/content/colors-round.sci b/examples/qtquick/imageelements/content/colors-round.sci similarity index 100% rename from examples/declarative/imageelements/content/colors-round.sci rename to examples/qtquick/imageelements/content/colors-round.sci diff --git a/examples/declarative/imageelements/content/colors-stretch.sci b/examples/qtquick/imageelements/content/colors-stretch.sci similarity index 100% rename from examples/declarative/imageelements/content/colors-stretch.sci rename to examples/qtquick/imageelements/content/colors-stretch.sci diff --git a/examples/declarative/imageelements/content/colors.png b/examples/qtquick/imageelements/content/colors.png similarity index 100% rename from examples/declarative/imageelements/content/colors.png rename to examples/qtquick/imageelements/content/colors.png diff --git a/examples/declarative/imageelements/content/qt-logo.png b/examples/qtquick/imageelements/content/qt-logo.png similarity index 100% rename from examples/declarative/imageelements/content/qt-logo.png rename to examples/qtquick/imageelements/content/qt-logo.png diff --git a/examples/declarative/imageelements/content/shadow.png b/examples/qtquick/imageelements/content/shadow.png similarity index 100% rename from examples/declarative/imageelements/content/shadow.png rename to examples/qtquick/imageelements/content/shadow.png diff --git a/examples/declarative/imageelements/content/speaker.png b/examples/qtquick/imageelements/content/speaker.png similarity index 100% rename from examples/declarative/imageelements/content/speaker.png rename to examples/qtquick/imageelements/content/speaker.png diff --git a/examples/declarative/imageelements/borderimage.qml b/examples/qtquick/imageelements/image.qml similarity index 53% rename from examples/declarative/imageelements/borderimage.qml rename to examples/qtquick/imageelements/image.qml index 3dd5d1d9bb..159558995d 100644 --- a/examples/declarative/imageelements/borderimage.qml +++ b/examples/qtquick/imageelements/image.qml @@ -42,56 +42,31 @@ import QtQuick 2.0 import "content" Rectangle { - id: page - width: 1030; height: 540 + width: 320 + height: 480 + Flickable { + anchors.fill: parent + contentWidth: 490 + contentHeight: 285 - Grid { - anchors.centerIn: parent; spacing: 20 + Grid { + property int cellWidth: (width - (spacing * (columns - 1))) / columns + property int cellHeight: (height - (spacing * (rows - 1))) / rows - MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - } - - MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat - } + anchors.fill: parent + anchors.margins: 30 - MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat - } - - MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round - } + columns: 3 + rows: 2 + spacing: 30 - MyBorderImage { - minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - } - - MyBorderImage { - minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat - } - - MyBorderImage { - minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat - } + ImageCell { mode: Image.Stretch; caption: "Stretch" } + ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } + ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } - MyBorderImage { - minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + ImageCell { mode: Image.Tile; caption: "Tile" } + ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } + ImageCell { mode: Image.TileVertically; caption: "TileVertically" } } } } diff --git a/examples/declarative/imageelements/imageelements.qml b/examples/qtquick/imageelements/imageelements.qml similarity index 99% rename from examples/declarative/imageelements/imageelements.qml rename to examples/qtquick/imageelements/imageelements.qml index 2ef5154968..f4075ec4c3 100644 --- a/examples/declarative/imageelements/imageelements.qml +++ b/examples/qtquick/imageelements/imageelements.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../shared" +import "../../shared" Item { height: 480 diff --git a/examples/declarative/imageelements/imageelements.qmlproject b/examples/qtquick/imageelements/imageelements.qmlproject similarity index 100% rename from examples/declarative/imageelements/imageelements.qmlproject rename to examples/qtquick/imageelements/imageelements.qmlproject diff --git a/examples/declarative/imageelements/shadows.qml b/examples/qtquick/imageelements/shadows.qml similarity index 100% rename from examples/declarative/imageelements/shadows.qml rename to examples/qtquick/imageelements/shadows.qml diff --git a/examples/declarative/imageelements/simplesprite.qml b/examples/qtquick/imageelements/simplesprite.qml similarity index 100% rename from examples/declarative/imageelements/simplesprite.qml rename to examples/qtquick/imageelements/simplesprite.qml diff --git a/examples/declarative/imageelements/spriteimage.qml b/examples/qtquick/imageelements/spriteimage.qml similarity index 100% rename from examples/declarative/imageelements/spriteimage.qml rename to examples/qtquick/imageelements/spriteimage.qml diff --git a/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml b/examples/qtquick/keyinteraction/focus/Core/ContextMenu.qml similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/ContextMenu.qml rename to examples/qtquick/keyinteraction/focus/Core/ContextMenu.qml diff --git a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml b/examples/qtquick/keyinteraction/focus/Core/GridMenu.qml similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/GridMenu.qml rename to examples/qtquick/keyinteraction/focus/Core/GridMenu.qml diff --git a/examples/declarative/keyinteraction/focus/Core/ListMenu.qml b/examples/qtquick/keyinteraction/focus/Core/ListMenu.qml similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/ListMenu.qml rename to examples/qtquick/keyinteraction/focus/Core/ListMenu.qml diff --git a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/qtquick/keyinteraction/focus/Core/ListViewDelegate.qml similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml rename to examples/qtquick/keyinteraction/focus/Core/ListViewDelegate.qml diff --git a/examples/declarative/keyinteraction/focus/Core/images/arrow.png b/examples/qtquick/keyinteraction/focus/Core/images/arrow.png similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/images/arrow.png rename to examples/qtquick/keyinteraction/focus/Core/images/arrow.png diff --git a/examples/declarative/keyinteraction/focus/Core/images/qt-logo.png b/examples/qtquick/keyinteraction/focus/Core/images/qt-logo.png similarity index 100% rename from examples/declarative/keyinteraction/focus/Core/images/qt-logo.png rename to examples/qtquick/keyinteraction/focus/Core/images/qt-logo.png diff --git a/examples/declarative/keyinteraction/focus/focus.qml b/examples/qtquick/keyinteraction/focus/focus.qml similarity index 100% rename from examples/declarative/keyinteraction/focus/focus.qml rename to examples/qtquick/keyinteraction/focus/focus.qml diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/qtquick/modelviews/abstractitemmodel/abstractitemmodel.pro similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro rename to examples/qtquick/modelviews/abstractitemmodel/abstractitemmodel.pro diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc b/examples/qtquick/modelviews/abstractitemmodel/abstractitemmodel.qrc similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.qrc rename to examples/qtquick/modelviews/abstractitemmodel/abstractitemmodel.qrc diff --git a/examples/declarative/modelviews/abstractitemmodel/main.cpp b/examples/qtquick/modelviews/abstractitemmodel/main.cpp similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/main.cpp rename to examples/qtquick/modelviews/abstractitemmodel/main.cpp diff --git a/examples/declarative/modelviews/abstractitemmodel/model.cpp b/examples/qtquick/modelviews/abstractitemmodel/model.cpp similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/model.cpp rename to examples/qtquick/modelviews/abstractitemmodel/model.cpp diff --git a/examples/declarative/modelviews/abstractitemmodel/model.h b/examples/qtquick/modelviews/abstractitemmodel/model.h similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/model.h rename to examples/qtquick/modelviews/abstractitemmodel/model.h diff --git a/examples/declarative/modelviews/abstractitemmodel/view.qml b/examples/qtquick/modelviews/abstractitemmodel/view.qml similarity index 100% rename from examples/declarative/modelviews/abstractitemmodel/view.qml rename to examples/qtquick/modelviews/abstractitemmodel/view.qml diff --git a/examples/declarative/modelviews/gridview/gridview-example.qml b/examples/qtquick/modelviews/gridview/gridview-example.qml similarity index 100% rename from examples/declarative/modelviews/gridview/gridview-example.qml rename to examples/qtquick/modelviews/gridview/gridview-example.qml diff --git a/examples/declarative/modelviews/gridview/pics/AddressBook_48.png b/examples/qtquick/modelviews/gridview/pics/AddressBook_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/AddressBook_48.png rename to examples/qtquick/modelviews/gridview/pics/AddressBook_48.png diff --git a/examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png b/examples/qtquick/modelviews/gridview/pics/AudioPlayer_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png rename to examples/qtquick/modelviews/gridview/pics/AudioPlayer_48.png diff --git a/examples/declarative/modelviews/gridview/pics/Camera_48.png b/examples/qtquick/modelviews/gridview/pics/Camera_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/Camera_48.png rename to examples/qtquick/modelviews/gridview/pics/Camera_48.png diff --git a/examples/declarative/modelviews/gridview/pics/DateBook_48.png b/examples/qtquick/modelviews/gridview/pics/DateBook_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/DateBook_48.png rename to examples/qtquick/modelviews/gridview/pics/DateBook_48.png diff --git a/examples/declarative/modelviews/gridview/pics/EMail_48.png b/examples/qtquick/modelviews/gridview/pics/EMail_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/EMail_48.png rename to examples/qtquick/modelviews/gridview/pics/EMail_48.png diff --git a/examples/declarative/modelviews/gridview/pics/TodoList_48.png b/examples/qtquick/modelviews/gridview/pics/TodoList_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/TodoList_48.png rename to examples/qtquick/modelviews/gridview/pics/TodoList_48.png diff --git a/examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png b/examples/qtquick/modelviews/gridview/pics/VideoPlayer_48.png similarity index 100% rename from examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png rename to examples/qtquick/modelviews/gridview/pics/VideoPlayer_48.png diff --git a/examples/declarative/modelviews/listview/content/PetsModel.qml b/examples/qtquick/modelviews/listview/content/PetsModel.qml similarity index 100% rename from examples/declarative/modelviews/listview/content/PetsModel.qml rename to examples/qtquick/modelviews/listview/content/PetsModel.qml diff --git a/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml b/examples/qtquick/modelviews/listview/content/PressAndHoldButton.qml similarity index 100% rename from examples/declarative/modelviews/listview/content/PressAndHoldButton.qml rename to examples/qtquick/modelviews/listview/content/PressAndHoldButton.qml diff --git a/examples/declarative/modelviews/listview/content/RecipesModel.qml b/examples/qtquick/modelviews/listview/content/RecipesModel.qml similarity index 100% rename from examples/declarative/modelviews/listview/content/RecipesModel.qml rename to examples/qtquick/modelviews/listview/content/RecipesModel.qml diff --git a/examples/declarative/modelviews/listview/content/TextButton.qml b/examples/qtquick/modelviews/listview/content/TextButton.qml similarity index 100% rename from examples/declarative/modelviews/listview/content/TextButton.qml rename to examples/qtquick/modelviews/listview/content/TextButton.qml diff --git a/examples/declarative/modelviews/listview/content/ToggleButton.qml b/examples/qtquick/modelviews/listview/content/ToggleButton.qml similarity index 100% rename from examples/declarative/modelviews/listview/content/ToggleButton.qml rename to examples/qtquick/modelviews/listview/content/ToggleButton.qml diff --git a/examples/declarative/modelviews/listview/content/pics/arrow-down.png b/examples/qtquick/modelviews/listview/content/pics/arrow-down.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/arrow-down.png rename to examples/qtquick/modelviews/listview/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/content/pics/arrow-up.png b/examples/qtquick/modelviews/listview/content/pics/arrow-up.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/arrow-up.png rename to examples/qtquick/modelviews/listview/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg b/examples/qtquick/modelviews/listview/content/pics/fruit-salad.jpg similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg rename to examples/qtquick/modelviews/listview/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/content/pics/hamburger.jpg b/examples/qtquick/modelviews/listview/content/pics/hamburger.jpg similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/hamburger.jpg rename to examples/qtquick/modelviews/listview/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/content/pics/lemonade.jpg b/examples/qtquick/modelviews/listview/content/pics/lemonade.jpg similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/lemonade.jpg rename to examples/qtquick/modelviews/listview/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/content/pics/list-delete.png b/examples/qtquick/modelviews/listview/content/pics/list-delete.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/list-delete.png rename to examples/qtquick/modelviews/listview/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/content/pics/minus-sign.png b/examples/qtquick/modelviews/listview/content/pics/minus-sign.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/minus-sign.png rename to examples/qtquick/modelviews/listview/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/content/pics/moreDown.png b/examples/qtquick/modelviews/listview/content/pics/moreDown.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/moreDown.png rename to examples/qtquick/modelviews/listview/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/content/pics/moreUp.png b/examples/qtquick/modelviews/listview/content/pics/moreUp.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/moreUp.png rename to examples/qtquick/modelviews/listview/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/content/pics/pancakes.jpg b/examples/qtquick/modelviews/listview/content/pics/pancakes.jpg similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/pancakes.jpg rename to examples/qtquick/modelviews/listview/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/content/pics/plus-sign.png b/examples/qtquick/modelviews/listview/content/pics/plus-sign.png similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/plus-sign.png rename to examples/qtquick/modelviews/listview/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg b/examples/qtquick/modelviews/listview/content/pics/vegetable-soup.jpg similarity index 100% rename from examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg rename to examples/qtquick/modelviews/listview/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist.qml b/examples/qtquick/modelviews/listview/dynamiclist.qml similarity index 100% rename from examples/declarative/modelviews/listview/dynamiclist.qml rename to examples/qtquick/modelviews/listview/dynamiclist.qml diff --git a/examples/declarative/modelviews/listview/expandingdelegates.qml b/examples/qtquick/modelviews/listview/expandingdelegates.qml similarity index 100% rename from examples/declarative/modelviews/listview/expandingdelegates.qml rename to examples/qtquick/modelviews/listview/expandingdelegates.qml diff --git a/examples/declarative/modelviews/listview/highlight.qml b/examples/qtquick/modelviews/listview/highlight.qml similarity index 100% rename from examples/declarative/modelviews/listview/highlight.qml rename to examples/qtquick/modelviews/listview/highlight.qml diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/qtquick/modelviews/listview/highlightranges.qml similarity index 100% rename from examples/declarative/modelviews/listview/highlightranges.qml rename to examples/qtquick/modelviews/listview/highlightranges.qml diff --git a/examples/declarative/modelviews/listview/sections.qml b/examples/qtquick/modelviews/listview/sections.qml similarity index 100% rename from examples/declarative/modelviews/listview/sections.qml rename to examples/qtquick/modelviews/listview/sections.qml diff --git a/examples/declarative/modelviews/modelviews.pro b/examples/qtquick/modelviews/modelviews.pro similarity index 100% rename from examples/declarative/modelviews/modelviews.pro rename to examples/qtquick/modelviews/modelviews.pro diff --git a/examples/declarative/modelviews/modelviews.qml b/examples/qtquick/modelviews/modelviews.qml similarity index 99% rename from examples/declarative/modelviews/modelviews.qml rename to examples/qtquick/modelviews/modelviews.qml index 86b10ca4ba..f11608bcc7 100644 --- a/examples/declarative/modelviews/modelviews.qml +++ b/examples/qtquick/modelviews/modelviews.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../shared" +import "../../shared" Item { height: 480 diff --git a/examples/declarative/modelviews/modelviews.qmlproject b/examples/qtquick/modelviews/modelviews.qmlproject similarity index 100% rename from examples/declarative/modelviews/modelviews.qmlproject rename to examples/qtquick/modelviews/modelviews.qmlproject diff --git a/examples/declarative/modelviews/objectlistmodel/dataobject.cpp b/examples/qtquick/modelviews/objectlistmodel/dataobject.cpp similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/dataobject.cpp rename to examples/qtquick/modelviews/objectlistmodel/dataobject.cpp diff --git a/examples/declarative/modelviews/objectlistmodel/dataobject.h b/examples/qtquick/modelviews/objectlistmodel/dataobject.h similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/dataobject.h rename to examples/qtquick/modelviews/objectlistmodel/dataobject.h diff --git a/examples/declarative/modelviews/objectlistmodel/main.cpp b/examples/qtquick/modelviews/objectlistmodel/main.cpp similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/main.cpp rename to examples/qtquick/modelviews/objectlistmodel/main.cpp diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro b/examples/qtquick/modelviews/objectlistmodel/objectlistmodel.pro similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro rename to examples/qtquick/modelviews/objectlistmodel/objectlistmodel.pro diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject b/examples/qtquick/modelviews/objectlistmodel/objectlistmodel.qmlproject similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/objectlistmodel.qmlproject rename to examples/qtquick/modelviews/objectlistmodel/objectlistmodel.qmlproject diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.qrc b/examples/qtquick/modelviews/objectlistmodel/objectlistmodel.qrc similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/objectlistmodel.qrc rename to examples/qtquick/modelviews/objectlistmodel/objectlistmodel.qrc diff --git a/examples/declarative/modelviews/objectlistmodel/view.qml b/examples/qtquick/modelviews/objectlistmodel/view.qml similarity index 100% rename from examples/declarative/modelviews/objectlistmodel/view.qml rename to examples/qtquick/modelviews/objectlistmodel/view.qml diff --git a/examples/declarative/particles/itemparticle/content/Delegate.qml b/examples/qtquick/modelviews/package/Delegate.qml similarity index 100% rename from examples/declarative/particles/itemparticle/content/Delegate.qml rename to examples/qtquick/modelviews/package/Delegate.qml diff --git a/examples/declarative/modelviews/package/view.qml b/examples/qtquick/modelviews/package/view.qml similarity index 96% rename from examples/declarative/modelviews/package/view.qml rename to examples/qtquick/modelviews/package/view.qml index 5b2fd9481c..7ba6664ae2 100644 --- a/examples/declarative/modelviews/package/view.qml +++ b/examples/qtquick/modelviews/package/view.qml @@ -73,4 +73,8 @@ Rectangle { model: visualModel.parts.grid } //![0] + Text { + anchors.bottom: parent.bottom + text: "Tap a delegate to move between views" + } } diff --git a/examples/qtquick/modelviews/parallax/content/Clock.qml b/examples/qtquick/modelviews/parallax/content/Clock.qml new file mode 100644 index 0000000000..7f0e8cba83 --- /dev/null +++ b/examples/qtquick/modelviews/parallax/content/Clock.qml @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id : clock + width: { + if (ListView.view && ListView.view.width >= 200) + return ListView.view.width / Math.floor(ListView.view.width / 200.0); + else + return 200; + } + + height: { + if (ListView.view && ListView.view.height >= 240) + return ListView.view.height; + else + return 240; + } + + property alias city: cityLabel.text + property int hours + property int minutes + property int seconds + property real shift + property bool night: false + property bool internationalTime: true //Unset for local time + + function timeChanged() { + var date = new Date; + hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() + night = ( hours < 7 || hours > 19 ) + minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() + seconds = date.getUTCSeconds(); + } + + Timer { + interval: 100; running: true; repeat: true; + onTriggered: clock.timeChanged() + } + + Item { + anchors.centerIn: parent + width: 200; height: 240 + + Image { id: background; source: "clock.png"; visible: clock.night == false } + Image { source: "clock-night.png"; visible: clock.night == true } + + + Image { + x: 92.5; y: 27 + source: "hour.png" + smooth: true + transform: Rotation { + id: hourRotation + origin.x: 7.5; origin.y: 73; + angle: (clock.hours * 30) + (clock.minutes * 0.5) + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + x: 93.5; y: 17 + source: "minute.png" + smooth: true + transform: Rotation { + id: minuteRotation + origin.x: 6.5; origin.y: 83; + angle: clock.minutes * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + x: 97.5; y: 20 + source: "second.png" + smooth: true + transform: Rotation { + id: secondRotation + origin.x: 2.5; origin.y: 80; + angle: clock.seconds * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + anchors.centerIn: background; source: "center.png" + } + + Text { + id: cityLabel + y: 210; anchors.horizontalCenter: parent.horizontalCenter + color: "white" + font.family: "Helvetica" + font.bold: true; font.pixelSize: 16 + style: Text.Raised; styleColor: "black" + } + } +} diff --git a/examples/declarative/modelviews/parallax/content/ParallaxView.qml b/examples/qtquick/modelviews/parallax/content/ParallaxView.qml similarity index 100% rename from examples/declarative/modelviews/parallax/content/ParallaxView.qml rename to examples/qtquick/modelviews/parallax/content/ParallaxView.qml diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/qtquick/modelviews/parallax/content/QuitButton.qml similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/QuitButton.qml rename to examples/qtquick/modelviews/parallax/content/QuitButton.qml diff --git a/examples/declarative/modelviews/parallax/content/Smiley.qml b/examples/qtquick/modelviews/parallax/content/Smiley.qml similarity index 100% rename from examples/declarative/modelviews/parallax/content/Smiley.qml rename to examples/qtquick/modelviews/parallax/content/Smiley.qml diff --git a/examples/qtquick/modelviews/parallax/content/background.png b/examples/qtquick/modelviews/parallax/content/background.png new file mode 100644 index 0000000000000000000000000000000000000000..a885950862ff9d709c70209d44d8af063939ae95 GIT binary patch literal 46895 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 LNkvXXu0mjflDQJ; literal 0 HcmV?d00001 diff --git a/examples/qtquick/modelviews/parallax/content/center.png b/examples/qtquick/modelviews/parallax/content/center.png new file mode 100644 index 0000000000000000000000000000000000000000..7fbd802a44e4242cb2ce11fd78efa0e2e9123591 GIT binary patch literal 765 zcmVwm?cmZyN`*KT0&&bzT5WB7@L(auxOrlE<9L|IL z&i8)L&uf>4S*T)OE8F->35(24d5sX5GeKScQ1}Zk0{U)AOeg56F@@r z9&i_k$@vIi#IHYN1sVpTz-?fBeSQ6DCX;#L`@V5q_xHlW!biXb&PAI*M>7u%0F42O z&CSilY&QEQkw`q(Y+9|>+rz`dd@7ZCCyf6B4GRvyQa(U#F>=uz;8CGacvY|0gJD{& zR*!%=;GskpvRQC?*oNeXsg;$Lg75nb(|9~ScW`jV&hDzY)D;F81#ZpE%q)7I$4wLnZ)|KVO0gq?V>GZMsffhm@h95(I@ZZ# z@|p5Cm%2j9NTbnchQr~}K4*QUR;xAXnTaa{0<=q|(&w9`!7|R}a-RSX+iE?)KF|i5 zdwY9dZUWrtbf{D+rE0Z$O1Fn?9|syZpgTcsu~% z2a54IaFR}^*UIJc*Fkx8UH5EjYin(1XXi+K>f-M$<%5e|vAb&Q;)&8-GE=~VTrQWI zpPx@oPftIdoSeL0E|vh*lr=Z!!jm-Q2}+N`W?w>U9_n|b&dh-G77}8A*@a$++Si(L{Cv$O@m%xtVMFJ vUl6^??F-^D;CUJdtS*47?_QuH>?{8O-DBHcK9x2C00000NkvXXu0mjfY~)gG literal 0 HcmV?d00001 diff --git a/examples/qtquick/modelviews/parallax/content/clock-night.png b/examples/qtquick/modelviews/parallax/content/clock-night.png new file mode 100644 index 0000000000000000000000000000000000000000..cc7151a397e16b6d6e2bbe6b1a59d43d09d76a89 GIT binary patch literal 23359 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 literal 0 HcmV?d00001 diff --git a/examples/qtquick/modelviews/parallax/content/clock.png b/examples/qtquick/modelviews/parallax/content/clock.png new file mode 100644 index 0000000000000000000000000000000000000000..462edacc0eaae9f2789ba6ae2c92ed533bba7207 GIT binary patch literal 20653 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�$@7S8U3ymd7s7tyOHWAvUm z!t8j;y?C2<2}e`&NBs zk|RSR9_R4Kg=Z_uc_R(0ACjxF<KbE$Lo&3+4H z^-oQ4`H5?8exV)c>u1Dr0kTvFTg+)a8?8bsZwpqqX4r2oz8QT40DQmj`P6*QrBm>V7YV%01x_JADEx%^ zYr);e3s%p$=CZLzuClr$rRa0A`ju}-P<7iI{`Q`4)24ZEZqVnxG9SyXV&z_!Wd`%z zcVvG&ybwli^(yJ@>A{_Ob>)%J!=DGKNXOy1Jtb*^m!xa}Mzho4i2eXqq#bjk9FMd^ z8V^ntW~3cz#40NrK_b|AKh5Pl@X5^Qj`XWG zg1NcPnfY(~#SJg#&X_g6_1DAEkoGm=6g)pmB&Gv`&Ugwe?Xb-v3K2s;3O&vdUn>)6 zNbhzTNrphVr~;_n>$V{lZjvIRlU&TIiaBFql|r3%7EpzD`Zl=;nN&^^4*{)Byzpbgy7Ztu1Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXc9 z05S=eKQo^I00HqyL_t(o!|j;6j?+LChQH(WKrRH9n~*5B+Xf+}qoCp?QbhDr+aW4C zdL)WeG|*73Qt}2#5GYa#8lHeyT5%Jx6^|Vs3TCpi3#*N^(5!rAP(?i zpbcDdi`#BafhF)0_yH_{<^G;j-Z65HSAi?QwQje2qu=lE8e?QQ9DbTiCZB$!PRzWG#b6g^IYfixlNKp zlO)mkd~WkR*XeZn9N2LsMIPI@O}e#MEZ(MRdQ(+f!4V-MX{XaUXti1ofGWn%B2ph!ja_4( zllQqksv7%D*vIGV-L8MJ_1E)%V^D@!@0!USLDI&%-Tf!(+)zhuk*v@?gELHWx3HVl3-#ZiS4OG{=?eVR(k3}SQ z4HfIgcM*xLwNJwSkc5pTA8#HNca1U6fcp;rT~QQIAHFmn!*#y^s*t+D3$g`_00000 LNkvXXu0mjfjzPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXc9 z05TtA>xRw%00HqyL_t(o!{wO0j?+L8fWO%|770J$s8EVS0#RN|$77_WqdO@D#YwzF zQsph6q@&?ABGEeN5LNhz?tJXf%o=NP@WtU|M~t+J=8lH8w8rzgYVaAXtQF)NbbYoOc(p3G*mm#fw4({j1|oMqYhd_F$|o&k?c z$4P0>0C<>X+1vGceG&pR8jU`V$Kw~kIq(Jeo)AfzrjMnt82bJGIM#9eDMGar2~Dbc z%cPR{zmaMssiJHlu@`A?^Q0;eRi?UYgu2B*)FwBg`kN!&oKJD|>hjcx)N9wLMxs9`<{e7>)D_3?Qbu$pY$hFJ3sqOT zr3pU0HwA!=s=hNTe7MaiqGvBO&o5r3X?iIl&sFt9p69OvA?W@B51fzRJAdej00000 LNkvXXu0mjfJuMrm literal 0 HcmV?d00001 diff --git a/examples/declarative/modelviews/parallax/content/pics/background.jpg b/examples/qtquick/modelviews/parallax/content/pics/background.jpg similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/background.jpg rename to examples/qtquick/modelviews/parallax/content/pics/background.jpg diff --git a/examples/declarative/shadereffects/content/face-smile.png b/examples/qtquick/modelviews/parallax/content/pics/face-smile.png similarity index 100% rename from examples/declarative/shadereffects/content/face-smile.png rename to examples/qtquick/modelviews/parallax/content/pics/face-smile.png diff --git a/examples/declarative/modelviews/parallax/content/pics/home-page.png b/examples/qtquick/modelviews/parallax/content/pics/home-page.png similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/home-page.png rename to examples/qtquick/modelviews/parallax/content/pics/home-page.png diff --git a/examples/declarative/modelviews/parallax/content/pics/home-page.svg b/examples/qtquick/modelviews/parallax/content/pics/home-page.svg similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/home-page.svg rename to examples/qtquick/modelviews/parallax/content/pics/home-page.svg diff --git a/examples/declarative/modelviews/parallax/content/pics/shadow.png b/examples/qtquick/modelviews/parallax/content/pics/shadow.png similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/shadow.png rename to examples/qtquick/modelviews/parallax/content/pics/shadow.png diff --git a/examples/declarative/modelviews/parallax/content/pics/yast-joystick.png b/examples/qtquick/modelviews/parallax/content/pics/yast-joystick.png similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/yast-joystick.png rename to examples/qtquick/modelviews/parallax/content/pics/yast-joystick.png diff --git a/examples/declarative/modelviews/parallax/content/pics/yast-wol.png b/examples/qtquick/modelviews/parallax/content/pics/yast-wol.png similarity index 100% rename from examples/declarative/modelviews/parallax/content/pics/yast-wol.png rename to examples/qtquick/modelviews/parallax/content/pics/yast-wol.png diff --git a/examples/declarative/ui-components/dialcontrol/content/quit.png b/examples/qtquick/modelviews/parallax/content/quit.png similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/quit.png rename to examples/qtquick/modelviews/parallax/content/quit.png diff --git a/examples/qtquick/modelviews/parallax/content/second.png b/examples/qtquick/modelviews/parallax/content/second.png new file mode 100644 index 0000000000000000000000000000000000000000..4aa9fb5e8ee10bceed60233801f6cafbbc601362 GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^tUw&f!3HE7ALAcI9 z%{-)-#I>01eJJ1I*m*ivo;z>;fApF7?nmi?*OJbCk6Ba6-}}@5-m_hw^uNY#bn7wL uw$wt4`T4tTa)qAq@q#bR-xN5-FuuQc`KERIYhIw!89ZJ6T-G@yGywn$272fK literal 0 HcmV?d00001 diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/qtquick/modelviews/parallax/parallax.qml similarity index 97% rename from examples/declarative/modelviews/parallax/parallax.qml rename to examples/qtquick/modelviews/parallax/parallax.qml index 6981095a80..30578e510e 100644 --- a/examples/declarative/modelviews/parallax/parallax.qml +++ b/examples/qtquick/modelviews/parallax/parallax.qml @@ -39,7 +39,6 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../toys/clocks/content" // for loading the Clock element import "content" Rectangle { diff --git a/examples/declarative/modelviews/pathview/pathview-example.qml b/examples/qtquick/modelviews/pathview/pathview-example.qml similarity index 100% rename from examples/declarative/modelviews/pathview/pathview-example.qml rename to examples/qtquick/modelviews/pathview/pathview-example.qml diff --git a/examples/declarative/modelviews/pathview/pics/AddressBook_48.png b/examples/qtquick/modelviews/pathview/pics/AddressBook_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/AddressBook_48.png rename to examples/qtquick/modelviews/pathview/pics/AddressBook_48.png diff --git a/examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png b/examples/qtquick/modelviews/pathview/pics/AudioPlayer_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png rename to examples/qtquick/modelviews/pathview/pics/AudioPlayer_48.png diff --git a/examples/declarative/modelviews/pathview/pics/Camera_48.png b/examples/qtquick/modelviews/pathview/pics/Camera_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/Camera_48.png rename to examples/qtquick/modelviews/pathview/pics/Camera_48.png diff --git a/examples/declarative/modelviews/pathview/pics/DateBook_48.png b/examples/qtquick/modelviews/pathview/pics/DateBook_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/DateBook_48.png rename to examples/qtquick/modelviews/pathview/pics/DateBook_48.png diff --git a/examples/declarative/modelviews/pathview/pics/EMail_48.png b/examples/qtquick/modelviews/pathview/pics/EMail_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/EMail_48.png rename to examples/qtquick/modelviews/pathview/pics/EMail_48.png diff --git a/examples/declarative/modelviews/pathview/pics/TodoList_48.png b/examples/qtquick/modelviews/pathview/pics/TodoList_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/TodoList_48.png rename to examples/qtquick/modelviews/pathview/pics/TodoList_48.png diff --git a/examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png b/examples/qtquick/modelviews/pathview/pics/VideoPlayer_48.png similarity index 100% rename from examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png rename to examples/qtquick/modelviews/pathview/pics/VideoPlayer_48.png diff --git a/examples/declarative/modelviews/stringlistmodel/main.cpp b/examples/qtquick/modelviews/stringlistmodel/main.cpp similarity index 100% rename from examples/declarative/modelviews/stringlistmodel/main.cpp rename to examples/qtquick/modelviews/stringlistmodel/main.cpp diff --git a/examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro b/examples/qtquick/modelviews/stringlistmodel/stringlistmodel.pro similarity index 100% rename from examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro rename to examples/qtquick/modelviews/stringlistmodel/stringlistmodel.pro diff --git a/examples/declarative/modelviews/stringlistmodel/stringlistmodel.qrc b/examples/qtquick/modelviews/stringlistmodel/stringlistmodel.qrc similarity index 100% rename from examples/declarative/modelviews/stringlistmodel/stringlistmodel.qrc rename to examples/qtquick/modelviews/stringlistmodel/stringlistmodel.qrc diff --git a/examples/declarative/modelviews/stringlistmodel/view.qml b/examples/qtquick/modelviews/stringlistmodel/view.qml similarity index 100% rename from examples/declarative/modelviews/stringlistmodel/view.qml rename to examples/qtquick/modelviews/stringlistmodel/view.qml diff --git a/examples/declarative/modelviews/visualdatamodel/dragselection.qml b/examples/qtquick/modelviews/visualdatamodel/dragselection.qml similarity index 100% rename from examples/declarative/modelviews/visualdatamodel/dragselection.qml rename to examples/qtquick/modelviews/visualdatamodel/dragselection.qml diff --git a/examples/declarative/modelviews/visualdatamodel/slideshow.qml b/examples/qtquick/modelviews/visualdatamodel/slideshow.qml similarity index 100% rename from examples/declarative/modelviews/visualdatamodel/slideshow.qml rename to examples/qtquick/modelviews/visualdatamodel/slideshow.qml diff --git a/examples/declarative/modelviews/visualdatamodel/sortedmodel.qml b/examples/qtquick/modelviews/visualdatamodel/sortedmodel.qml similarity index 100% rename from examples/declarative/modelviews/visualdatamodel/sortedmodel.qml rename to examples/qtquick/modelviews/visualdatamodel/sortedmodel.qml diff --git a/examples/declarative/modelviews/visualdatamodel/visualdatamodel.qmlproject b/examples/qtquick/modelviews/visualdatamodel/visualdatamodel.qmlproject similarity index 100% rename from examples/declarative/modelviews/visualdatamodel/visualdatamodel.qmlproject rename to examples/qtquick/modelviews/visualdatamodel/visualdatamodel.qmlproject diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml b/examples/qtquick/modelviews/visualitemmodel/visualitemmodel.qml similarity index 98% rename from examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml rename to examples/qtquick/modelviews/visualitemmodel/visualitemmodel.qml index 3425150d9a..2e012adec6 100644 --- a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml +++ b/examples/qtquick/modelviews/visualitemmodel/visualitemmodel.qml @@ -44,9 +44,10 @@ import QtQuick 2.0 Rectangle { + id: root color: "lightgray" - width: 240 - height: 320 + width: 320 + height: 480 property bool printDestruction: false VisualItemModel { @@ -87,7 +88,7 @@ Rectangle { } Rectangle { - width: 240; height: 30 + width: root.width; height: 30 anchors { top: view.bottom; bottom: parent.bottom } color: "gray" diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml b/examples/qtquick/mousearea/mousearea-example.qml similarity index 100% rename from examples/declarative/touchinteraction/mousearea/mousearea-example.qml rename to examples/qtquick/mousearea/mousearea-example.qml diff --git a/examples/declarative/openglunderqml/main.cpp b/examples/qtquick/openglunderqml/main.cpp similarity index 100% rename from examples/declarative/openglunderqml/main.cpp rename to examples/qtquick/openglunderqml/main.cpp diff --git a/examples/declarative/openglunderqml/main.qml b/examples/qtquick/openglunderqml/main.qml similarity index 100% rename from examples/declarative/openglunderqml/main.qml rename to examples/qtquick/openglunderqml/main.qml diff --git a/examples/declarative/openglunderqml/openglunderqml.pro b/examples/qtquick/openglunderqml/openglunderqml.pro similarity index 100% rename from examples/declarative/openglunderqml/openglunderqml.pro rename to examples/qtquick/openglunderqml/openglunderqml.pro diff --git a/examples/declarative/openglunderqml/squircle.cpp b/examples/qtquick/openglunderqml/squircle.cpp similarity index 100% rename from examples/declarative/openglunderqml/squircle.cpp rename to examples/qtquick/openglunderqml/squircle.cpp diff --git a/examples/declarative/openglunderqml/squircle.h b/examples/qtquick/openglunderqml/squircle.h similarity index 100% rename from examples/declarative/openglunderqml/squircle.h rename to examples/qtquick/openglunderqml/squircle.h diff --git a/examples/declarative/painteditem/painteditem.pro b/examples/qtquick/painteditem/painteditem.pro similarity index 100% rename from examples/declarative/painteditem/painteditem.pro rename to examples/qtquick/painteditem/painteditem.pro diff --git a/examples/declarative/painteditem/smile/main.cpp b/examples/qtquick/painteditem/smile/main.cpp similarity index 100% rename from examples/declarative/painteditem/smile/main.cpp rename to examples/qtquick/painteditem/smile/main.cpp diff --git a/examples/declarative/painteditem/smile/smile.pro b/examples/qtquick/painteditem/smile/smile.pro similarity index 100% rename from examples/declarative/painteditem/smile/smile.pro rename to examples/qtquick/painteditem/smile/smile.pro diff --git a/examples/declarative/painteditem/smile/smile.qml b/examples/qtquick/painteditem/smile/smile.qml similarity index 100% rename from examples/declarative/painteditem/smile/smile.qml rename to examples/qtquick/painteditem/smile/smile.qml diff --git a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h b/examples/qtquick/painteditem/textballoons/TextBalloonPlugin/plugin.h similarity index 100% rename from examples/declarative/painteditem/textballoons/TextBalloonPlugin/plugin.h rename to examples/qtquick/painteditem/textballoons/TextBalloonPlugin/plugin.h diff --git a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/qmldir b/examples/qtquick/painteditem/textballoons/TextBalloonPlugin/qmldir similarity index 100% rename from examples/declarative/painteditem/textballoons/TextBalloonPlugin/qmldir rename to examples/qtquick/painteditem/textballoons/TextBalloonPlugin/qmldir diff --git a/examples/declarative/painteditem/textballoons/textballoon.cpp b/examples/qtquick/painteditem/textballoons/textballoon.cpp similarity index 100% rename from examples/declarative/painteditem/textballoons/textballoon.cpp rename to examples/qtquick/painteditem/textballoons/textballoon.cpp diff --git a/examples/declarative/painteditem/textballoons/textballoon.h b/examples/qtquick/painteditem/textballoons/textballoon.h similarity index 100% rename from examples/declarative/painteditem/textballoons/textballoon.h rename to examples/qtquick/painteditem/textballoons/textballoon.h diff --git a/examples/declarative/painteditem/textballoons/textballoons.pro b/examples/qtquick/painteditem/textballoons/textballoons.pro similarity index 100% rename from examples/declarative/painteditem/textballoons/textballoons.pro rename to examples/qtquick/painteditem/textballoons/textballoons.pro diff --git a/examples/declarative/painteditem/textballoons/textballoons.qml b/examples/qtquick/painteditem/textballoons/textballoons.qml similarity index 100% rename from examples/declarative/painteditem/textballoons/textballoons.qml rename to examples/qtquick/painteditem/textballoons/textballoons.qml diff --git a/examples/declarative/positioners/content/Button.qml b/examples/qtquick/positioners/content/Button.qml similarity index 100% rename from examples/declarative/positioners/content/Button.qml rename to examples/qtquick/positioners/content/Button.qml diff --git a/examples/declarative/positioners/content/add.png b/examples/qtquick/positioners/content/add.png similarity index 100% rename from examples/declarative/positioners/content/add.png rename to examples/qtquick/positioners/content/add.png diff --git a/examples/declarative/positioners/content/del.png b/examples/qtquick/positioners/content/del.png similarity index 100% rename from examples/declarative/positioners/content/del.png rename to examples/qtquick/positioners/content/del.png diff --git a/examples/declarative/positioners/positioners-attachedproperties.qml b/examples/qtquick/positioners/positioners-attachedproperties.qml similarity index 100% rename from examples/declarative/positioners/positioners-attachedproperties.qml rename to examples/qtquick/positioners/positioners-attachedproperties.qml diff --git a/examples/declarative/positioners/positioners.qml b/examples/qtquick/positioners/positioners.qml similarity index 98% rename from examples/declarative/positioners/positioners.qml rename to examples/qtquick/positioners/positioners.qml index d9d16649ff..6627ad7dd4 100644 --- a/examples/declarative/positioners/positioners.qml +++ b/examples/qtquick/positioners/positioners.qml @@ -43,7 +43,10 @@ import "content" Rectangle { id: page - width: 420; height: 420 + width: 320; height: 480 + Flickable { + anchors.fill: parent + contentWidth: 420; contentHeight: 420 Column { id: layout1 @@ -261,4 +264,5 @@ Rectangle { Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } } + } } diff --git a/examples/qtquick/qtquick.pro b/examples/qtquick/qtquick.pro new file mode 100644 index 0000000000..2ffc377f32 --- /dev/null +++ b/examples/qtquick/qtquick.pro @@ -0,0 +1,17 @@ +TEMPLATE = subdirs +SUBDIRS = accessibility \ + animation + #canvas \ + #draganddrop \ + #imageelements \ + #keyinteraction \ + #modelviews \ + #mousearea \ + #openglunderqml \ + #painteditem \ + #positioners \ + #righttoleft \ + #shadereffects \ + #text \ + #threading \ + #touchinteraction diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/qtquick/righttoleft/layoutdirection/layoutdirection.qml similarity index 100% rename from examples/declarative/righttoleft/layoutdirection/layoutdirection.qml rename to examples/qtquick/righttoleft/layoutdirection/layoutdirection.qml diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qmlproject b/examples/qtquick/righttoleft/layoutdirection/layoutdirection.qmlproject similarity index 100% rename from examples/declarative/righttoleft/layoutdirection/layoutdirection.qmlproject rename to examples/qtquick/righttoleft/layoutdirection/layoutdirection.qmlproject diff --git a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml b/examples/qtquick/righttoleft/layoutmirroring/layoutmirroring.qml similarity index 100% rename from examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qml rename to examples/qtquick/righttoleft/layoutmirroring/layoutmirroring.qml diff --git a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qmlproject b/examples/qtquick/righttoleft/layoutmirroring/layoutmirroring.qmlproject similarity index 100% rename from examples/declarative/righttoleft/layoutmirroring/layoutmirroring.qmlproject rename to examples/qtquick/righttoleft/layoutmirroring/layoutmirroring.qmlproject diff --git a/examples/declarative/righttoleft/textalignment/textalignment.qml b/examples/qtquick/righttoleft/textalignment/textalignment.qml similarity index 100% rename from examples/declarative/righttoleft/textalignment/textalignment.qml rename to examples/qtquick/righttoleft/textalignment/textalignment.qml diff --git a/examples/declarative/righttoleft/textalignment/textalignment.qmlproject b/examples/qtquick/righttoleft/textalignment/textalignment.qmlproject similarity index 100% rename from examples/declarative/righttoleft/textalignment/textalignment.qmlproject rename to examples/qtquick/righttoleft/textalignment/textalignment.qmlproject diff --git a/examples/declarative/shadereffects/content/Slider.qml b/examples/qtquick/shadereffects/content/Slider.qml similarity index 100% rename from examples/declarative/shadereffects/content/Slider.qml rename to examples/qtquick/shadereffects/content/Slider.qml diff --git a/examples/declarative/toys/dynamicscene/content/images/face-smile.png b/examples/qtquick/shadereffects/content/face-smile.png similarity index 100% rename from examples/declarative/toys/dynamicscene/content/images/face-smile.png rename to examples/qtquick/shadereffects/content/face-smile.png diff --git a/examples/declarative/shadereffects/content/qt-logo.png b/examples/qtquick/shadereffects/content/qt-logo.png similarity index 100% rename from examples/declarative/shadereffects/content/qt-logo.png rename to examples/qtquick/shadereffects/content/qt-logo.png diff --git a/examples/qtquick/shadereffects/shadereffects.qml b/examples/qtquick/shadereffects/shadereffects.qml new file mode 100644 index 0000000000..70bcf1352a --- /dev/null +++ b/examples/qtquick/shadereffects/shadereffects.qml @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "content" + +Image { + width: 320 + height: 480 +/*! + \title QML Examples - Shader Effects + \example declarative/shadereffects + \image qml-shadereffects-example.png + \brief This is a shader effects example + + This example demonstrates a couple of visual effects that you can perform + with shaders in QtQuick 2.0 +*/ + source: "../snake/content/pics/background.png" + + Flickable { + anchors.fill: parent + contentWidth: 640 + contentHeight: 360 + + ShaderEffectSource { + id: theSource + sourceItem: theItem + smooth: true + } + + function saturate(x) { + return Math.min(Math.max(x, 0), 1) + } + + function sliderToColor(x) { + return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)), + saturate(Math.min(6 * x, 4 - 6 * x)), + saturate(Math.min(6 * x - 2, 6 - 6 * x))) + } + + Grid { + anchors.centerIn: parent + columns: 3 + + Item { + id: theItem + width: 180 + height: 180 + ListView { + anchors.centerIn: parent + width: 160 + height: 140 + clip: true + snapMode: ListView.SnapOneItem + model: VisualItemModel { + Text { + width: 160 + height: 140 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: 120 + font.family: "Times" + color: "blue" + text: "Qt" + } + Image { + width: 160 + height: 140 + source: "content/qt-logo.png" + smooth: true + } + Image { + width: 160 + height: 140 + source: "content/face-smile.png" + smooth: true + } + } + } + } + ShaderEffect { + width: 180 + height: 180 + property variant source: theSource + property real amplitude: 0.04 * wobbleSlider.value + property real frequency: 20 + property real time: 0 + NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } + fragmentShader: + "uniform lowp float qt_Opacity;" + + "uniform highp float amplitude;" + + "uniform highp float frequency;" + + "uniform highp float time;" + + "uniform sampler2D source;" + + "varying highp vec2 qt_TexCoord0;" + + "void main() {" + + " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + + " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + + "}" + Slider { + id: wobbleSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffect { + width: 180 + height: 180 + property variant source: theSource + property variant shadow: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffect { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(0.0, 1.0 / height) + property variant source: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffect { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(1.0 / width, 0.0) + property variant source: theSource + fragmentShader: " + uniform lowp float qt_Opacity; + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; + }" + } + } + fragmentShader: " + uniform lowp float qt_Opacity; + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; + }" + } + } + property real angle: 0 + property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle)) + NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } + property variant delta: Qt.size(offset.x / width, offset.y / height) + property real darkness: shadowSlider.value + fragmentShader: " + uniform lowp float qt_Opacity; + uniform highp vec2 offset; + uniform sampler2D source; + uniform sampler2D shadow; + uniform highp float darkness; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 fg = texture2D(source, qt_TexCoord0); + lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); + gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity; + }" + Slider { + id: shadowSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffect { + width: 180 + height: 180 + property variant source: theSource + property variant delta: Qt.size(0.5 / width, 0.5 / height) + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + uniform highp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta); + lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y)); + lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y)); + lowp vec4 br = texture2D(source, qt_TexCoord0 + delta); + lowp vec4 gx = (tl + bl) - (tr + br); + lowp vec4 gy = (tl + tr) - (bl + br); + gl_FragColor.xyz = vec3(0.); + gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity; + }" + } + ShaderEffect { + width: 180 + height: 180 + property variant source: theSource + property color tint: sliderToColor(colorizeSlider.value) + fragmentShader: " + uniform sampler2D source; + uniform lowp vec4 tint; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 c = texture2D(source, qt_TexCoord0); + lowp float lo = min(min(c.x, c.y), c.z); + lowp float hi = max(max(c.x, c.y), c.z); + gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w); + }" + Slider { + id: colorizeSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffect { + width: 180 + height: 180 + mesh: Qt.size(10, 10) + property variant source: theSource + property real bend: 0 + property real minimize: 0 + property real side: genieSlider.value + SequentialAnimation on bend { + loops: Animation.Infinite + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1600 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + } + SequentialAnimation on minimize { + loops: Animation.Infinite + PauseAnimation { duration: 300 } + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1300 } + } + vertexShader: " + uniform highp mat4 qt_Matrix; + uniform highp float bend; + uniform highp float minimize; + uniform highp float side; + uniform highp float width; + uniform highp float height; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main() { + qt_TexCoord0 = qt_MultiTexCoord0; + highp vec4 pos = qt_Vertex; + pos.y = mix(qt_Vertex.y, height, minimize); + highp float t = pos.y / height; + t = (3. - 2. * t) * t * t; + pos.x = mix(qt_Vertex.x, side * width, t * bend); + gl_Position = qt_Matrix * pos; + }" + Slider { + id: genieSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + } + } +} diff --git a/examples/declarative/text/fonts/availableFonts.qml b/examples/qtquick/text/fonts/availableFonts.qml similarity index 100% rename from examples/declarative/text/fonts/availableFonts.qml rename to examples/qtquick/text/fonts/availableFonts.qml diff --git a/examples/declarative/text/fonts/banner.qml b/examples/qtquick/text/fonts/banner.qml similarity index 100% rename from examples/declarative/text/fonts/banner.qml rename to examples/qtquick/text/fonts/banner.qml diff --git a/examples/declarative/text/fonts/content/fonts/tarzeau_ocr_a.ttf b/examples/qtquick/text/fonts/content/fonts/tarzeau_ocr_a.ttf similarity index 100% rename from examples/declarative/text/fonts/content/fonts/tarzeau_ocr_a.ttf rename to examples/qtquick/text/fonts/content/fonts/tarzeau_ocr_a.ttf diff --git a/examples/declarative/text/fonts/fonts.qml b/examples/qtquick/text/fonts/fonts.qml similarity index 100% rename from examples/declarative/text/fonts/fonts.qml rename to examples/qtquick/text/fonts/fonts.qml diff --git a/examples/declarative/text/fonts/hello.qml b/examples/qtquick/text/fonts/hello.qml similarity index 100% rename from examples/declarative/text/fonts/hello.qml rename to examples/qtquick/text/fonts/hello.qml diff --git a/examples/declarative/text/imgtag/TextWithImage.qml b/examples/qtquick/text/imgtag/TextWithImage.qml similarity index 100% rename from examples/declarative/text/imgtag/TextWithImage.qml rename to examples/qtquick/text/imgtag/TextWithImage.qml diff --git a/examples/declarative/text/imgtag/images/face-sad.png b/examples/qtquick/text/imgtag/images/face-sad.png similarity index 100% rename from examples/declarative/text/imgtag/images/face-sad.png rename to examples/qtquick/text/imgtag/images/face-sad.png diff --git a/examples/declarative/text/imgtag/images/face-smile-big.png b/examples/qtquick/text/imgtag/images/face-smile-big.png similarity index 100% rename from examples/declarative/text/imgtag/images/face-smile-big.png rename to examples/qtquick/text/imgtag/images/face-smile-big.png diff --git a/examples/declarative/text/imgtag/images/face-smile.png b/examples/qtquick/text/imgtag/images/face-smile.png similarity index 100% rename from examples/declarative/text/imgtag/images/face-smile.png rename to examples/qtquick/text/imgtag/images/face-smile.png diff --git a/examples/declarative/text/imgtag/images/heart200.png b/examples/qtquick/text/imgtag/images/heart200.png similarity index 100% rename from examples/declarative/text/imgtag/images/heart200.png rename to examples/qtquick/text/imgtag/images/heart200.png diff --git a/examples/declarative/text/imgtag/images/qtlogo.png b/examples/qtquick/text/imgtag/images/qtlogo.png similarity index 100% rename from examples/declarative/text/imgtag/images/qtlogo.png rename to examples/qtquick/text/imgtag/images/qtlogo.png diff --git a/examples/declarative/text/imgtag/images/starfish_2.png b/examples/qtquick/text/imgtag/images/starfish_2.png similarity index 100% rename from examples/declarative/text/imgtag/images/starfish_2.png rename to examples/qtquick/text/imgtag/images/starfish_2.png diff --git a/examples/declarative/text/imgtag/imgtag.qml b/examples/qtquick/text/imgtag/imgtag.qml similarity index 100% rename from examples/declarative/text/imgtag/imgtag.qml rename to examples/qtquick/text/imgtag/imgtag.qml diff --git a/examples/declarative/text/styledtext-layout.qml b/examples/qtquick/text/styledtext-layout.qml similarity index 100% rename from examples/declarative/text/styledtext-layout.qml rename to examples/qtquick/text/styledtext-layout.qml diff --git a/examples/declarative/text/text.qml b/examples/qtquick/text/text.qml similarity index 99% rename from examples/declarative/text/text.qml rename to examples/qtquick/text/text.qml index 14a88d2e91..9bfd290059 100644 --- a/examples/declarative/text/text.qml +++ b/examples/qtquick/text/text.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../shared" +import "../../shared" Item { height: 480 diff --git a/examples/declarative/text/text.qmlproject b/examples/qtquick/text/text.qmlproject similarity index 100% rename from examples/declarative/text/text.qmlproject rename to examples/qtquick/text/text.qmlproject diff --git a/examples/declarative/text/textselection/pics/endHandle.png b/examples/qtquick/text/textselection/pics/endHandle.png similarity index 100% rename from examples/declarative/text/textselection/pics/endHandle.png rename to examples/qtquick/text/textselection/pics/endHandle.png diff --git a/examples/declarative/text/textselection/pics/endHandle.sci b/examples/qtquick/text/textselection/pics/endHandle.sci similarity index 100% rename from examples/declarative/text/textselection/pics/endHandle.sci rename to examples/qtquick/text/textselection/pics/endHandle.sci diff --git a/examples/declarative/text/textselection/pics/startHandle.png b/examples/qtquick/text/textselection/pics/startHandle.png similarity index 100% rename from examples/declarative/text/textselection/pics/startHandle.png rename to examples/qtquick/text/textselection/pics/startHandle.png diff --git a/examples/declarative/text/textselection/pics/startHandle.sci b/examples/qtquick/text/textselection/pics/startHandle.sci similarity index 100% rename from examples/declarative/text/textselection/pics/startHandle.sci rename to examples/qtquick/text/textselection/pics/startHandle.sci diff --git a/examples/declarative/text/textselection/textselection.qml b/examples/qtquick/text/textselection/textselection.qml similarity index 100% rename from examples/declarative/text/textselection/textselection.qml rename to examples/qtquick/text/textselection/textselection.qml diff --git a/examples/declarative/threading/threadedlistmodel/dataloader.js b/examples/qtquick/threading/threadedlistmodel/dataloader.js similarity index 100% rename from examples/declarative/threading/threadedlistmodel/dataloader.js rename to examples/qtquick/threading/threadedlistmodel/dataloader.js diff --git a/examples/declarative/threading/threadedlistmodel/threadedlistmodel.qmlproject b/examples/qtquick/threading/threadedlistmodel/threadedlistmodel.qmlproject similarity index 100% rename from examples/declarative/threading/threadedlistmodel/threadedlistmodel.qmlproject rename to examples/qtquick/threading/threadedlistmodel/threadedlistmodel.qmlproject diff --git a/examples/declarative/threading/threadedlistmodel/timedisplay.qml b/examples/qtquick/threading/threadedlistmodel/timedisplay.qml similarity index 100% rename from examples/declarative/threading/threadedlistmodel/timedisplay.qml rename to examples/qtquick/threading/threadedlistmodel/timedisplay.qml diff --git a/examples/declarative/threading/workerscript/workerscript.js b/examples/qtquick/threading/workerscript/workerscript.js similarity index 100% rename from examples/declarative/threading/workerscript/workerscript.js rename to examples/qtquick/threading/workerscript/workerscript.js diff --git a/examples/declarative/threading/workerscript/workerscript.qml b/examples/qtquick/threading/workerscript/workerscript.qml similarity index 100% rename from examples/declarative/threading/workerscript/workerscript.qml rename to examples/qtquick/threading/workerscript/workerscript.qml diff --git a/examples/declarative/threading/workerscript/workerscript.qmlproject b/examples/qtquick/threading/workerscript/workerscript.qmlproject similarity index 100% rename from examples/declarative/threading/workerscript/workerscript.qmlproject rename to examples/qtquick/threading/workerscript/workerscript.qmlproject diff --git a/examples/declarative/touchinteraction/multipointtouch/bearwhack.qml b/examples/qtquick/touchinteraction/multipointtouch/bearwhack.qml similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/bearwhack.qml rename to examples/qtquick/touchinteraction/multipointtouch/bearwhack.qml diff --git a/examples/declarative/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml b/examples/qtquick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml rename to examples/qtquick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml diff --git a/examples/declarative/touchinteraction/multipointtouch/content/Bear0.png b/examples/qtquick/touchinteraction/multipointtouch/content/Bear0.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/Bear0.png rename to examples/qtquick/touchinteraction/multipointtouch/content/Bear0.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/Bear1.png b/examples/qtquick/touchinteraction/multipointtouch/content/Bear1.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/Bear1.png rename to examples/qtquick/touchinteraction/multipointtouch/content/Bear1.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/Bear2.png b/examples/qtquick/touchinteraction/multipointtouch/content/Bear2.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/Bear2.png rename to examples/qtquick/touchinteraction/multipointtouch/content/Bear2.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/Bear3.png b/examples/qtquick/touchinteraction/multipointtouch/content/Bear3.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/Bear3.png rename to examples/qtquick/touchinteraction/multipointtouch/content/Bear3.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/BearB.png b/examples/qtquick/touchinteraction/multipointtouch/content/BearB.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/BearB.png rename to examples/qtquick/touchinteraction/multipointtouch/content/BearB.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml b/examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml rename to examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml diff --git a/examples/declarative/touchinteraction/multipointtouch/content/ParticleFlame.qml b/examples/qtquick/touchinteraction/multipointtouch/content/ParticleFlame.qml similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/ParticleFlame.qml rename to examples/qtquick/touchinteraction/multipointtouch/content/ParticleFlame.qml diff --git a/examples/declarative/touchinteraction/multipointtouch/content/blur-circle.png b/examples/qtquick/touchinteraction/multipointtouch/content/blur-circle.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/blur-circle.png rename to examples/qtquick/touchinteraction/multipointtouch/content/blur-circle.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/blur-circle3.png b/examples/qtquick/touchinteraction/multipointtouch/content/blur-circle3.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/blur-circle3.png rename to examples/qtquick/touchinteraction/multipointtouch/content/blur-circle3.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/heart-blur.png b/examples/qtquick/touchinteraction/multipointtouch/content/heart-blur.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/heart-blur.png rename to examples/qtquick/touchinteraction/multipointtouch/content/heart-blur.png diff --git a/examples/declarative/touchinteraction/multipointtouch/content/title.png b/examples/qtquick/touchinteraction/multipointtouch/content/title.png similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/content/title.png rename to examples/qtquick/touchinteraction/multipointtouch/content/title.png diff --git a/examples/declarative/touchinteraction/multipointtouch/multiflame.qml b/examples/qtquick/touchinteraction/multipointtouch/multiflame.qml similarity index 100% rename from examples/declarative/touchinteraction/multipointtouch/multiflame.qml rename to examples/qtquick/touchinteraction/multipointtouch/multiflame.qml diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/qtquick/touchinteraction/pincharea/flickresize.qml similarity index 100% rename from examples/declarative/touchinteraction/pincharea/flickresize.qml rename to examples/qtquick/touchinteraction/pincharea/flickresize.qml diff --git a/examples/declarative/touchinteraction/pincharea/qt-logo.jpg b/examples/qtquick/touchinteraction/pincharea/qt-logo.jpg similarity index 100% rename from examples/declarative/touchinteraction/pincharea/qt-logo.jpg rename to examples/qtquick/touchinteraction/pincharea/qt-logo.jpg diff --git a/examples/declarative/touchinteraction/touchinteraction.qml b/examples/qtquick/touchinteraction/touchinteraction.qml similarity index 94% rename from examples/declarative/touchinteraction/touchinteraction.qml rename to examples/qtquick/touchinteraction/touchinteraction.qml index ac0c8bfc55..b4a930c495 100644 --- a/examples/declarative/touchinteraction/touchinteraction.qml +++ b/examples/qtquick/touchinteraction/touchinteraction.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../shared" +import "../../shared" Item { height: 480 @@ -48,7 +48,6 @@ Item { id: ll anchors.fill: parent Component.onCompleted: { - addExample("MouseArea", "Using the basic touch input element", Qt.resolvedUrl("mousearea/mousearea-example.qml")); addExample("Multipoint Flames", "Create multiple flames with multiple fingers", Qt.resolvedUrl("multipointtouch/multiflame.qml")); addExample("Bear-Whack", "Use multiple touches to knock all the bears down", Qt.resolvedUrl("multipointtouch/bearwhack.qml")); addExample("Flick Resize", "Manipulate images using pinch gestures", Qt.resolvedUrl("pincharea/flickresize.qml")); diff --git a/examples/declarative/touchinteraction/touchinteraction.qmlproject b/examples/qtquick/touchinteraction/touchinteraction.qmlproject similarity index 100% rename from examples/declarative/touchinteraction/touchinteraction.qmlproject rename to examples/qtquick/touchinteraction/touchinteraction.qmlproject diff --git a/examples/declarative/shared/Button.qml b/examples/shared/Button.qml similarity index 100% rename from examples/declarative/shared/Button.qml rename to examples/shared/Button.qml diff --git a/examples/declarative/shared/LauncherList.qml b/examples/shared/LauncherList.qml similarity index 97% rename from examples/declarative/shared/LauncherList.qml rename to examples/shared/LauncherList.qml index 782fcc7ddd..492290dc3e 100644 --- a/examples/declarative/shared/LauncherList.qml +++ b/examples/shared/LauncherList.qml @@ -89,11 +89,12 @@ ListView { //Eats mouse events } Image { - source: "back.png" + source: "images/back.png" anchors.verticalCenter: parent.verticalCenter x: 4 MouseArea { anchors.fill: parent + anchors.margins: -10 onClicked: ei.exampleUrl = ""; } } diff --git a/examples/declarative/shared/README b/examples/shared/README similarity index 100% rename from examples/declarative/shared/README rename to examples/shared/README diff --git a/examples/declarative/shared/SimpleLauncherDelegate.qml b/examples/shared/SimpleLauncherDelegate.qml similarity index 100% rename from examples/declarative/shared/SimpleLauncherDelegate.qml rename to examples/shared/SimpleLauncherDelegate.qml diff --git a/examples/declarative/shared/back.png b/examples/shared/images/back.png similarity index 100% rename from examples/declarative/shared/back.png rename to examples/shared/images/back.png diff --git a/examples/shared/qmldir b/examples/shared/qmldir new file mode 100644 index 0000000000..2f1e56aefb --- /dev/null +++ b/examples/shared/qmldir @@ -0,0 +1,3 @@ +Button 2.0 Button.qml +LauncherList 2.0 LauncherList.qml +SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml diff --git a/examples/shared/shared.h b/examples/shared/shared.h new file mode 100644 index 0000000000..e6d0130ec8 --- /dev/null +++ b/examples/shared/shared.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ +{\ + QGuiApplication app(argc,argv);\ + QQuickView view;\ + view.setSource(QUrl::fromLocalFile(#NAME ".qml"));\ + view.show();\ + return app.exec();\ +} diff --git a/examples/shared/shared.pro b/examples/shared/shared.pro new file mode 100644 index 0000000000..d6ce120f41 --- /dev/null +++ b/examples/shared/shared.pro @@ -0,0 +1,9 @@ +#just install the files, all QML for now +TEMPLATE = aux + +qml.files = images \ + LauncherList.qml \ + SimpleLauncherDelegate.qml \ + Button.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/shared +INSTALLS = qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview1/PetsModel.qml rename to examples/tutorials/dynamicview/dynamicview1/PetsModel.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview1/dynamicview.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview1/dynamicview.qml rename to examples/tutorials/dynamicview/dynamicview1/dynamicview.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview2/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview2/PetsModel.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview2/PetsModel.qml rename to examples/tutorials/dynamicview/dynamicview2/PetsModel.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview2/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview2/dynamicview.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview2/dynamicview.qml rename to examples/tutorials/dynamicview/dynamicview2/dynamicview.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview3/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview3/PetsModel.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview3/PetsModel.qml rename to examples/tutorials/dynamicview/dynamicview3/PetsModel.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview3/dynamicview.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview3/dynamicview.qml rename to examples/tutorials/dynamicview/dynamicview3/dynamicview.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview4/ListSelector.qml b/examples/tutorials/dynamicview/dynamicview4/ListSelector.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview4/ListSelector.qml rename to examples/tutorials/dynamicview/dynamicview4/ListSelector.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview4/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview4/PetsModel.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview4/PetsModel.qml rename to examples/tutorials/dynamicview/dynamicview4/PetsModel.qml diff --git a/examples/declarative/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview4/dynamicview.qml similarity index 100% rename from examples/declarative/tutorials/dynamicview/dynamicview4/dynamicview.qml rename to examples/tutorials/dynamicview/dynamicview4/dynamicview.qml diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/tutorials/extending/chapter1-basics/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter1-basics/app.qml rename to examples/tutorials/extending/chapter1-basics/app.qml diff --git a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/tutorials/extending/chapter1-basics/chapter1-basics.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro rename to examples/tutorials/extending/chapter1-basics/chapter1-basics.pro diff --git a/examples/declarative/tutorials/extending/chapter1-basics/main.cpp b/examples/tutorials/extending/chapter1-basics/main.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter1-basics/main.cpp rename to examples/tutorials/extending/chapter1-basics/main.cpp diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp b/examples/tutorials/extending/chapter1-basics/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp rename to examples/tutorials/extending/chapter1-basics/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.h b/examples/tutorials/extending/chapter1-basics/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter1-basics/piechart.h rename to examples/tutorials/extending/chapter1-basics/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/tutorials/extending/chapter2-methods/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter2-methods/app.qml rename to examples/tutorials/extending/chapter2-methods/app.qml diff --git a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/tutorials/extending/chapter2-methods/chapter2-methods.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro rename to examples/tutorials/extending/chapter2-methods/chapter2-methods.pro diff --git a/examples/declarative/tutorials/extending/chapter2-methods/main.cpp b/examples/tutorials/extending/chapter2-methods/main.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter2-methods/main.cpp rename to examples/tutorials/extending/chapter2-methods/main.cpp diff --git a/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp b/examples/tutorials/extending/chapter2-methods/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp rename to examples/tutorials/extending/chapter2-methods/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter2-methods/piechart.h b/examples/tutorials/extending/chapter2-methods/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter2-methods/piechart.h rename to examples/tutorials/extending/chapter2-methods/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/tutorials/extending/chapter3-bindings/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter3-bindings/app.qml rename to examples/tutorials/extending/chapter3-bindings/app.qml diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro rename to examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp b/examples/tutorials/extending/chapter3-bindings/main.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter3-bindings/main.cpp rename to examples/tutorials/extending/chapter3-bindings/main.cpp diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/tutorials/extending/chapter3-bindings/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp rename to examples/tutorials/extending/chapter3-bindings/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h b/examples/tutorials/extending/chapter3-bindings/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter3-bindings/piechart.h rename to examples/tutorials/extending/chapter3-bindings/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/tutorials/extending/chapter4-customPropertyTypes/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml rename to examples/tutorials/extending/chapter4-customPropertyTypes/app.qml diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro rename to examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp rename to examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp rename to examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h rename to examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp rename to examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h rename to examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml b/examples/tutorials/extending/chapter5-listproperties/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/app.qml rename to examples/tutorials/extending/chapter5-listproperties/app.qml diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro rename to examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp b/examples/tutorials/extending/chapter5-listproperties/main.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp rename to examples/tutorials/extending/chapter5-listproperties/main.cpp diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/tutorials/extending/chapter5-listproperties/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp rename to examples/tutorials/extending/chapter5-listproperties/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h b/examples/tutorials/extending/chapter5-listproperties/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h rename to examples/tutorials/extending/chapter5-listproperties/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp rename to examples/tutorials/extending/chapter5-listproperties/pieslice.cpp diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/tutorials/extending/chapter5-listproperties/pieslice.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h rename to examples/tutorials/extending/chapter5-listproperties/pieslice.h diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir b/examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir rename to examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml b/examples/tutorials/extending/chapter6-plugins/app.qml similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/app.qml rename to examples/tutorials/extending/chapter6-plugins/app.qml diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro rename to examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.cpp rename to examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/tutorials/extending/chapter6-plugins/chartsplugin.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.h rename to examples/tutorials/extending/chapter6-plugins/chartsplugin.h diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/tutorials/extending/chapter6-plugins/piechart.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp rename to examples/tutorials/extending/chapter6-plugins/piechart.cpp diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h b/examples/tutorials/extending/chapter6-plugins/piechart.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/piechart.h rename to examples/tutorials/extending/chapter6-plugins/piechart.h diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/tutorials/extending/chapter6-plugins/pieslice.cpp similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp rename to examples/tutorials/extending/chapter6-plugins/pieslice.cpp diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h b/examples/tutorials/extending/chapter6-plugins/pieslice.h similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h rename to examples/tutorials/extending/chapter6-plugins/pieslice.h diff --git a/examples/declarative/tutorials/extending/extending.pro b/examples/tutorials/extending/extending.pro similarity index 100% rename from examples/declarative/tutorials/extending/extending.pro rename to examples/tutorials/extending/extending.pro diff --git a/examples/declarative/tutorials/helloworld/Cell.qml b/examples/tutorials/helloworld/Cell.qml similarity index 100% rename from examples/declarative/tutorials/helloworld/Cell.qml rename to examples/tutorials/helloworld/Cell.qml diff --git a/examples/declarative/tutorials/helloworld/tutorial1.qml b/examples/tutorials/helloworld/tutorial1.qml similarity index 100% rename from examples/declarative/tutorials/helloworld/tutorial1.qml rename to examples/tutorials/helloworld/tutorial1.qml diff --git a/examples/declarative/tutorials/helloworld/tutorial2.qml b/examples/tutorials/helloworld/tutorial2.qml similarity index 100% rename from examples/declarative/tutorials/helloworld/tutorial2.qml rename to examples/tutorials/helloworld/tutorial2.qml diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/tutorials/helloworld/tutorial3.qml similarity index 100% rename from examples/declarative/tutorials/helloworld/tutorial3.qml rename to examples/tutorials/helloworld/tutorial3.qml diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/tutorials/samegame/samegame1/Block.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame1/Block.qml rename to examples/tutorials/samegame/samegame1/Block.qml diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/tutorials/samegame/samegame1/Button.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame1/Button.qml rename to examples/tutorials/samegame/samegame1/Button.qml diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/tutorials/samegame/samegame1/samegame.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame1/samegame.qml rename to examples/tutorials/samegame/samegame1/samegame.qml diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame1.qmlproject b/examples/tutorials/samegame/samegame1/samegame1.qmlproject similarity index 100% rename from examples/declarative/tutorials/samegame/samegame1/samegame1.qmlproject rename to examples/tutorials/samegame/samegame1/samegame1.qmlproject diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/tutorials/samegame/samegame2/Block.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame2/Block.qml rename to examples/tutorials/samegame/samegame2/Block.qml diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/tutorials/samegame/samegame2/Button.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame2/Button.qml rename to examples/tutorials/samegame/samegame2/Button.qml diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/tutorials/samegame/samegame2/samegame.js similarity index 100% rename from examples/declarative/tutorials/samegame/samegame2/samegame.js rename to examples/tutorials/samegame/samegame2/samegame.js diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/tutorials/samegame/samegame2/samegame.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame2/samegame.qml rename to examples/tutorials/samegame/samegame2/samegame.qml diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame2.qmlproject b/examples/tutorials/samegame/samegame2/samegame2.qmlproject similarity index 100% rename from examples/declarative/tutorials/samegame/samegame2/samegame2.qmlproject rename to examples/tutorials/samegame/samegame2/samegame2.qmlproject diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/tutorials/samegame/samegame3/Block.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/Block.qml rename to examples/tutorials/samegame/samegame3/Block.qml diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/tutorials/samegame/samegame3/Button.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/Button.qml rename to examples/tutorials/samegame/samegame3/Button.qml diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/tutorials/samegame/samegame3/Dialog.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/Dialog.qml rename to examples/tutorials/samegame/samegame3/Dialog.qml diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/tutorials/samegame/samegame3/samegame.js similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/samegame.js rename to examples/tutorials/samegame/samegame3/samegame.js diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/tutorials/samegame/samegame3/samegame.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/samegame.qml rename to examples/tutorials/samegame/samegame3/samegame.qml diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame3.qmlproject b/examples/tutorials/samegame/samegame3/samegame3.qmlproject similarity index 100% rename from examples/declarative/tutorials/samegame/samegame3/samegame3.qmlproject rename to examples/tutorials/samegame/samegame3/samegame3.qmlproject diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/tutorials/samegame/samegame4/content/BoomBlock.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml rename to examples/tutorials/samegame/samegame4/content/BoomBlock.qml diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/tutorials/samegame/samegame4/content/Button.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/content/Button.qml rename to examples/tutorials/samegame/samegame4/content/Button.qml diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/tutorials/samegame/samegame4/content/Dialog.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml rename to examples/tutorials/samegame/samegame4/content/Dialog.qml diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/tutorials/samegame/samegame4/content/samegame.js similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/content/samegame.js rename to examples/tutorials/samegame/samegame4/content/samegame.js diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/README b/examples/tutorials/samegame/samegame4/highscores/README similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/highscores/README rename to examples/tutorials/samegame/samegame4/highscores/README diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/tutorials/samegame/samegame4/highscores/score_data.xml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/highscores/score_data.xml rename to examples/tutorials/samegame/samegame4/highscores/score_data.xml diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/tutorials/samegame/samegame4/highscores/score_style.xsl similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/highscores/score_style.xsl rename to examples/tutorials/samegame/samegame4/highscores/score_style.xsl diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php b/examples/tutorials/samegame/samegame4/highscores/scores.php similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/highscores/scores.php rename to examples/tutorials/samegame/samegame4/highscores/scores.php diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/tutorials/samegame/samegame4/samegame.qml similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/samegame.qml rename to examples/tutorials/samegame/samegame4/samegame.qml diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame4.qmlproject b/examples/tutorials/samegame/samegame4/samegame4.qmlproject similarity index 100% rename from examples/declarative/tutorials/samegame/samegame4/samegame4.qmlproject rename to examples/tutorials/samegame/samegame4/samegame4.qmlproject diff --git a/examples/declarative/tutorials/samegame/shared/pics/background.jpg b/examples/tutorials/samegame/shared/pics/background.jpg similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/background.jpg rename to examples/tutorials/samegame/shared/pics/background.jpg diff --git a/examples/declarative/tutorials/samegame/shared/pics/blueStar.png b/examples/tutorials/samegame/shared/pics/blueStar.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/blueStar.png rename to examples/tutorials/samegame/shared/pics/blueStar.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/blueStone.png b/examples/tutorials/samegame/shared/pics/blueStone.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/blueStone.png rename to examples/tutorials/samegame/shared/pics/blueStone.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/greenStar.png b/examples/tutorials/samegame/shared/pics/greenStar.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/greenStar.png rename to examples/tutorials/samegame/shared/pics/greenStar.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/greenStone.png b/examples/tutorials/samegame/shared/pics/greenStone.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/greenStone.png rename to examples/tutorials/samegame/shared/pics/greenStone.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/redStar.png b/examples/tutorials/samegame/shared/pics/redStar.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/redStar.png rename to examples/tutorials/samegame/shared/pics/redStar.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/redStone.png b/examples/tutorials/samegame/shared/pics/redStone.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/redStone.png rename to examples/tutorials/samegame/shared/pics/redStone.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/star.png b/examples/tutorials/samegame/shared/pics/star.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/star.png rename to examples/tutorials/samegame/shared/pics/star.png diff --git a/examples/declarative/tutorials/samegame/shared/pics/yellowStone.png b/examples/tutorials/samegame/shared/pics/yellowStone.png similarity index 100% rename from examples/declarative/tutorials/samegame/shared/pics/yellowStone.png rename to examples/tutorials/samegame/shared/pics/yellowStone.png diff --git a/examples/declarative/ui-components/dialcontrol/content/Dial.qml b/examples/tutorials/ui-components/dialcontrol/content/Dial.qml similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/Dial.qml rename to examples/tutorials/ui-components/dialcontrol/content/Dial.qml diff --git a/examples/declarative/imageelements/image.qml b/examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml similarity index 73% rename from examples/declarative/imageelements/image.qml rename to examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml index 4ca26c1630..702b892d23 100644 --- a/examples/declarative/imageelements/image.qml +++ b/examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml @@ -39,29 +39,14 @@ ****************************************************************************/ import QtQuick 2.0 -import "content" - -Rectangle { - width: 490 - height: 285 - - Grid { - property int cellWidth: (width - (spacing * (columns - 1))) / columns - property int cellHeight: (height - (spacing * (rows - 1))) / rows - +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse anchors.fill: parent - anchors.margins: 30 - - columns: 3 - rows: 2 - spacing: 30 - - ImageCell { mode: Image.Stretch; caption: "Stretch" } - ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } - ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } - - ImageCell { mode: Image.Tile; caption: "Tile" } - ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } - ImageCell { mode: Image.TileVertically; caption: "TileVertically" } + anchors.margins: -10 + onClicked: Qt.quit() } } diff --git a/examples/declarative/ui-components/dialcontrol/content/background.png b/examples/tutorials/ui-components/dialcontrol/content/background.png similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/background.png rename to examples/tutorials/ui-components/dialcontrol/content/background.png diff --git a/examples/declarative/ui-components/dialcontrol/content/needle.png b/examples/tutorials/ui-components/dialcontrol/content/needle.png similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/needle.png rename to examples/tutorials/ui-components/dialcontrol/content/needle.png diff --git a/examples/declarative/ui-components/dialcontrol/content/needle_shadow.png b/examples/tutorials/ui-components/dialcontrol/content/needle_shadow.png similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/needle_shadow.png rename to examples/tutorials/ui-components/dialcontrol/content/needle_shadow.png diff --git a/examples/declarative/ui-components/dialcontrol/content/overlay.png b/examples/tutorials/ui-components/dialcontrol/content/overlay.png similarity index 100% rename from examples/declarative/ui-components/dialcontrol/content/overlay.png rename to examples/tutorials/ui-components/dialcontrol/content/overlay.png diff --git a/examples/tutorials/ui-components/dialcontrol/content/quit.png b/examples/tutorials/ui-components/dialcontrol/content/quit.png new file mode 100644 index 0000000000000000000000000000000000000000..b822057d4e6a6ac5ed2b7d20fb27d5368b0e831b GIT binary patch literal 583 zcmV-N0=WH&P)iLVjkLUbqUBm)|aiE*K3 zcJA~s1Q&7dB@h+jHEskYS%e6>@m-Yfs4;jc7hOGcW~w{mf!>^|^Q)qYI!%m`7$cH` zr2CS3Wp1xe(q&0^tGO!nNK%yaN7CX5*sP>qsb;Cn2X_y^1E5C{0eI-{H>e4BzXYrT z?UcIh?n?kIN%w$TnYzC~&&*Z^u#3PmU_4WECjcwJm&{-Qmfih&1)FKWz5#DrF-F{d z0@wf!*X(o=aNv0j_8piqvk$EpW4ZdVgdWNi!~~DkVAE!{1<(f*Iti@Tpt;zEL2*v~ zFtg9V8Q|*(*bksv#fElR+39g$6F69d?EoD!+Z-GS!*c;RLjLf}7zd8#28KX)?*gy( z00Z#Y-4_}`cb`t!z6Pv}G2n^2U&(^*J_Wo6_GgNBC@vv~K6Ur`U0}l2YOrmf3!Dbj zfX+ejmOH?k2JF04~q4ZzJB>?d%c!~o3f6VRb}hJ(=tW&^O0R?T7S zgH>ksu?Bq!Tq~R90ZH#tv)q<+c7z6dQj({d7n0ijj$J|5B%S+@U%)9z%Ow_L3 Vh5vkKWu5>4002ovPDHLkV1nYy`N{wQ literal 0 HcmV?d00001 diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/tutorials/ui-components/dialcontrol/dialcontrol.qml similarity index 100% rename from examples/declarative/ui-components/dialcontrol/dialcontrol.qml rename to examples/tutorials/ui-components/dialcontrol/dialcontrol.qml diff --git a/examples/declarative/ui-components/flipable/content/5_heart.png b/examples/tutorials/ui-components/flipable/content/5_heart.png similarity index 100% rename from examples/declarative/ui-components/flipable/content/5_heart.png rename to examples/tutorials/ui-components/flipable/content/5_heart.png diff --git a/examples/declarative/ui-components/flipable/content/9_club.png b/examples/tutorials/ui-components/flipable/content/9_club.png similarity index 100% rename from examples/declarative/ui-components/flipable/content/9_club.png rename to examples/tutorials/ui-components/flipable/content/9_club.png diff --git a/examples/declarative/ui-components/flipable/content/Card.qml b/examples/tutorials/ui-components/flipable/content/Card.qml similarity index 100% rename from examples/declarative/ui-components/flipable/content/Card.qml rename to examples/tutorials/ui-components/flipable/content/Card.qml diff --git a/examples/declarative/ui-components/flipable/content/back.png b/examples/tutorials/ui-components/flipable/content/back.png similarity index 100% rename from examples/declarative/ui-components/flipable/content/back.png rename to examples/tutorials/ui-components/flipable/content/back.png diff --git a/examples/declarative/ui-components/flipable/flipable.qml b/examples/tutorials/ui-components/flipable/flipable.qml similarity index 100% rename from examples/declarative/ui-components/flipable/flipable.qml rename to examples/tutorials/ui-components/flipable/flipable.qml diff --git a/examples/declarative/ui-components/progressbar/content/ProgressBar.qml b/examples/tutorials/ui-components/progressbar/content/ProgressBar.qml similarity index 100% rename from examples/declarative/ui-components/progressbar/content/ProgressBar.qml rename to examples/tutorials/ui-components/progressbar/content/ProgressBar.qml diff --git a/examples/declarative/ui-components/progressbar/content/background.png b/examples/tutorials/ui-components/progressbar/content/background.png similarity index 100% rename from examples/declarative/ui-components/progressbar/content/background.png rename to examples/tutorials/ui-components/progressbar/content/background.png diff --git a/examples/declarative/ui-components/progressbar/main.qml b/examples/tutorials/ui-components/progressbar/main.qml similarity index 100% rename from examples/declarative/ui-components/progressbar/main.qml rename to examples/tutorials/ui-components/progressbar/main.qml diff --git a/examples/declarative/ui-components/scrollbar/ScrollBar.qml b/examples/tutorials/ui-components/scrollbar/ScrollBar.qml similarity index 100% rename from examples/declarative/ui-components/scrollbar/ScrollBar.qml rename to examples/tutorials/ui-components/scrollbar/ScrollBar.qml diff --git a/examples/declarative/ui-components/scrollbar/main.qml b/examples/tutorials/ui-components/scrollbar/main.qml similarity index 100% rename from examples/declarative/ui-components/scrollbar/main.qml rename to examples/tutorials/ui-components/scrollbar/main.qml diff --git a/examples/declarative/ui-components/scrollbar/pics/niagara_falls.jpg b/examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpg similarity index 100% rename from examples/declarative/ui-components/scrollbar/pics/niagara_falls.jpg rename to examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpg diff --git a/examples/declarative/ui-components/scrollbar/scrollbar.qmlproject b/examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject similarity index 100% rename from examples/declarative/ui-components/scrollbar/scrollbar.qmlproject rename to examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/tutorials/ui-components/searchbox/SearchBox.qml similarity index 100% rename from examples/declarative/ui-components/searchbox/SearchBox.qml rename to examples/tutorials/ui-components/searchbox/SearchBox.qml diff --git a/examples/declarative/ui-components/searchbox/images/clear.png b/examples/tutorials/ui-components/searchbox/images/clear.png similarity index 100% rename from examples/declarative/ui-components/searchbox/images/clear.png rename to examples/tutorials/ui-components/searchbox/images/clear.png diff --git a/examples/declarative/ui-components/searchbox/images/lineedit-bg-focus.png b/examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.png similarity index 100% rename from examples/declarative/ui-components/searchbox/images/lineedit-bg-focus.png rename to examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.png diff --git a/examples/declarative/ui-components/searchbox/images/lineedit-bg.png b/examples/tutorials/ui-components/searchbox/images/lineedit-bg.png similarity index 100% rename from examples/declarative/ui-components/searchbox/images/lineedit-bg.png rename to examples/tutorials/ui-components/searchbox/images/lineedit-bg.png diff --git a/examples/declarative/ui-components/searchbox/main.qml b/examples/tutorials/ui-components/searchbox/main.qml similarity index 100% rename from examples/declarative/ui-components/searchbox/main.qml rename to examples/tutorials/ui-components/searchbox/main.qml diff --git a/examples/declarative/ui-components/searchbox/searchbox.qmlproject b/examples/tutorials/ui-components/searchbox/searchbox.qmlproject similarity index 100% rename from examples/declarative/ui-components/searchbox/searchbox.qmlproject rename to examples/tutorials/ui-components/searchbox/searchbox.qmlproject diff --git a/examples/declarative/ui-components/slideswitch/content/Switch.qml b/examples/tutorials/ui-components/slideswitch/content/Switch.qml similarity index 100% rename from examples/declarative/ui-components/slideswitch/content/Switch.qml rename to examples/tutorials/ui-components/slideswitch/content/Switch.qml diff --git a/examples/declarative/ui-components/slideswitch/content/background.png b/examples/tutorials/ui-components/slideswitch/content/background.png similarity index 100% rename from examples/declarative/ui-components/slideswitch/content/background.png rename to examples/tutorials/ui-components/slideswitch/content/background.png diff --git a/examples/declarative/ui-components/slideswitch/content/background.svg b/examples/tutorials/ui-components/slideswitch/content/background.svg similarity index 100% rename from examples/declarative/ui-components/slideswitch/content/background.svg rename to examples/tutorials/ui-components/slideswitch/content/background.svg diff --git a/examples/declarative/ui-components/slideswitch/content/knob.png b/examples/tutorials/ui-components/slideswitch/content/knob.png similarity index 100% rename from examples/declarative/ui-components/slideswitch/content/knob.png rename to examples/tutorials/ui-components/slideswitch/content/knob.png diff --git a/examples/declarative/ui-components/slideswitch/content/knob.svg b/examples/tutorials/ui-components/slideswitch/content/knob.svg similarity index 100% rename from examples/declarative/ui-components/slideswitch/content/knob.svg rename to examples/tutorials/ui-components/slideswitch/content/knob.svg diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.qml b/examples/tutorials/ui-components/slideswitch/slideswitch.qml similarity index 100% rename from examples/declarative/ui-components/slideswitch/slideswitch.qml rename to examples/tutorials/ui-components/slideswitch/slideswitch.qml diff --git a/examples/declarative/ui-components/spinner/content/Spinner.qml b/examples/tutorials/ui-components/spinner/content/Spinner.qml similarity index 100% rename from examples/declarative/ui-components/spinner/content/Spinner.qml rename to examples/tutorials/ui-components/spinner/content/Spinner.qml diff --git a/examples/declarative/ui-components/spinner/content/spinner-bg.png b/examples/tutorials/ui-components/spinner/content/spinner-bg.png similarity index 100% rename from examples/declarative/ui-components/spinner/content/spinner-bg.png rename to examples/tutorials/ui-components/spinner/content/spinner-bg.png diff --git a/examples/declarative/ui-components/spinner/content/spinner-select.png b/examples/tutorials/ui-components/spinner/content/spinner-select.png similarity index 100% rename from examples/declarative/ui-components/spinner/content/spinner-select.png rename to examples/tutorials/ui-components/spinner/content/spinner-select.png diff --git a/examples/declarative/ui-components/spinner/main.qml b/examples/tutorials/ui-components/spinner/main.qml similarity index 100% rename from examples/declarative/ui-components/spinner/main.qml rename to examples/tutorials/ui-components/spinner/main.qml diff --git a/examples/declarative/ui-components/spinner/spinner.qmlproject b/examples/tutorials/ui-components/spinner/spinner.qmlproject similarity index 100% rename from examples/declarative/ui-components/spinner/spinner.qmlproject rename to examples/tutorials/ui-components/spinner/spinner.qmlproject diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/tutorials/ui-components/tabwidget/TabWidget.qml similarity index 100% rename from examples/declarative/ui-components/tabwidget/TabWidget.qml rename to examples/tutorials/ui-components/tabwidget/TabWidget.qml diff --git a/examples/declarative/ui-components/tabwidget/main.qml b/examples/tutorials/ui-components/tabwidget/main.qml similarity index 100% rename from examples/declarative/ui-components/tabwidget/main.qml rename to examples/tutorials/ui-components/tabwidget/main.qml diff --git a/examples/declarative/ui-components/tabwidget/tab.png b/examples/tutorials/ui-components/tabwidget/tab.png similarity index 100% rename from examples/declarative/ui-components/tabwidget/tab.png rename to examples/tutorials/ui-components/tabwidget/tab.png diff --git a/examples/declarative/ui-components/tabwidget/tabwidget.qmlproject b/examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject similarity index 100% rename from examples/declarative/ui-components/tabwidget/tabwidget.qmlproject rename to examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject diff --git a/examples/declarative/window/Window.qml b/examples/window/Window.qml similarity index 100% rename from examples/declarative/window/Window.qml rename to examples/window/Window.qml diff --git a/examples/declarative/window/screen/screenInfo.qml b/examples/window/screen/screenInfo.qml similarity index 100% rename from examples/declarative/window/screen/screenInfo.qml rename to examples/window/screen/screenInfo.qml diff --git a/examples/declarative/window/standalone.qml b/examples/window/standalone.qml similarity index 100% rename from examples/declarative/window/standalone.qml rename to examples/window/standalone.qml diff --git a/examples/declarative/window/window.cpp b/examples/window/window.cpp similarity index 100% rename from examples/declarative/window/window.cpp rename to examples/window/window.cpp diff --git a/examples/declarative/window/window.pro b/examples/window/window.pro similarity index 100% rename from examples/declarative/window/window.pro rename to examples/window/window.pro diff --git a/tests/auto/qtquick2/examples/tst_examples.cpp b/tests/auto/qtquick2/examples/tst_examples.cpp index 0e420f7277..ce8f214efd 100644 --- a/tests/auto/qtquick2/examples/tst_examples.cpp +++ b/tests/auto/qtquick2/examples/tst_examples.cpp @@ -89,32 +89,25 @@ tst_examples::tst_examples() excludedFiles << "doc/src/snippets/declarative/listmodel.qml"; //Just a ListModel, no root QQuickItem // Add directories you want excluded here - excludedDirs << "examples/declarative/text/fonts"; // QTBUG-21415 + excludedDirs << "examples/shared"; //Not an example + excludedDirs << "examples/qtquick/text/fonts"; // QTBUG-21415 excludedDirs << "doc/src/snippets/declarative/path"; //No root QQuickItem - // Not run in QQuickView - excludedDirs << "examples/declarative/qtquick1"; - // These snippets are not expected to run on their own. excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex"; excludedDirs << "doc/src/snippets/declarative/qtbinding"; excludedDirs << "doc/src/snippets/declarative/imports"; - excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex"; - excludedDirs << "doc/src/snippets/qtquick1/qtbinding"; - excludedDirs << "doc/src/snippets/qtquick1/imports"; #ifdef QT_NO_WEBKIT - excludedDirs << "examples/declarative/modelviews/webview"; - excludedDirs << "examples/declarative/webbrowser"; + excludedDirs << "examples/qtquick/modelviews/webview"; + excludedDirs << "examples/demos/webbrowser"; excludedDirs << "doc/src/snippets/declarative/webview"; - excludedDirs << "doc/src/snippets/qtquick1/webview"; #endif #ifdef QT_NO_XMLPATTERNS - excludedDirs << "examples/declarative/xml/xmldata"; - excludedDirs << "examples/declarative/twitter"; - excludedDirs << "examples/declarative/flickr"; - excludedDirs << "examples/declarative/photoviewer"; + excludedDirs << "examples/demos/twitter"; + excludedDirs << "examples/demos/flickr"; + excludedDirs << "examples/demos/photoviewer"; #endif } @@ -230,12 +223,10 @@ void tst_examples::sgexamples_data() { QTest::addColumn("file"); - QString examples = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; - QString tutorials = QLatin1String(SRCDIR) + "/../../../../examples/tutorials/"; //Only declarative tutorials since modularization + QString examples = QLatin1String(SRCDIR) + "/../../../../examples/"; QStringList files; files << findQmlFiles(QDir(examples)); - files << findQmlFiles(QDir(tutorials)); foreach (const QString &file, files) QTest::newRow(qPrintable(file)) << file; From 5cc9b79675c9d1e17e0153ca2ddf42771a09cfe3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 24 Feb 2012 07:28:54 +0100 Subject: [PATCH 17/82] Revert resource releasing logic inside window managers. This was based on the assumption that exposure and visibility would take similar code paths, but this is not the case and the fallout of this change (like not releasing resources at all) is not worth it. This reverts ef6318ae38322b5a4a0619b581924290f114fa74 and most of 5f0013ee76605b9c7ceab168702b57e797b698e0 Change-Id: Ib2e29972502a8ec956cd6bd294a2a2bb50d8e76e Reviewed-by: Alan Alpert --- src/quick/items/qquickwindowmanager.cpp | 154 ++++++------------------ src/quick/items/qquickwindowmanager_p.h | 2 + 2 files changed, 39 insertions(+), 117 deletions(-) diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index b999e6f85d..16b6d92e22 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -48,8 +48,8 @@ #include #include -#include #include +#include #include @@ -145,6 +145,10 @@ DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP); //#define THREAD_DEBUG +QQuickWindowManager::~QQuickWindowManager() +{ +} + class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQuickWindowManager { Q_OBJECT @@ -165,7 +169,6 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui , shouldExit(false) , hasExited(false) , isDeferredUpdatePosted(false) - , runToReleaseResources(false) , canvasToGrab(0) { sg->moveToThread(this); @@ -176,13 +179,10 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui connect(animationDriver, SIGNAL(stopped()), this, SLOT(animationStopped())); } - ~QQuickRenderThreadSingleContextWindowManager() - { - releaseResources(); - } - QSGContext *sceneGraphContext() const { return sg; } + void releaseResources() { } + void show(QQuickCanvas *canvas); void hide(QQuickCanvas *canvas); @@ -201,8 +201,6 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui void sync(bool guiAlreadyLocked); void initialize(); - void releaseResources(); - void releaseResourcesInThread(); bool *allowMainThreadProcessing() { return &allowMainThreadProcessingFlag; } @@ -258,7 +256,6 @@ public slots: uint shouldExit : 1; uint hasExited : 1; uint isDeferredUpdatePosted : 1; - uint runToReleaseResources : 1; QQuickCanvas *canvasToGrab; QImage grabContent; @@ -291,17 +288,12 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager { public: QQuickTrivialWindowManager(); - ~QQuickTrivialWindowManager() - { - releaseResources(); - } void show(QQuickCanvas *canvas); void hide(QQuickCanvas *canvas); void canvasDestroyed(QQuickCanvas *canvas); - void releaseResources(); void initializeGL(); void renderCanvas(QQuickCanvas *canvas); void paint(QQuickCanvas *canvas); @@ -310,10 +302,11 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager void maybeUpdate(QQuickCanvas *canvas); + void releaseResources() { } + bool *allowMainThreadProcessing(); QSGContext *sceneGraphContext() const; - QQuickCanvas *masterCanvas() const; bool event(QEvent *); @@ -564,18 +557,10 @@ void QQuickRenderThreadSingleContextWindowManager::run() #ifdef THREAD_DEBUG printf("QML Rendering Thread Started\n"); #endif - lock(); - - if (runToReleaseResources) { - releaseResourcesInThread(); - runToReleaseResources = false; - unlock(); - return; - } - - if (!gl) - initialize(); + lock(); + Q_ASSERT(!gl); + initialize(); // Wake GUI as it is waiting for the GL context to have appeared, as // an indication that the render thread is now running. wake(); @@ -772,6 +757,12 @@ void QQuickRenderThreadSingleContextWindowManager::run() m_removed_windows << m_rendered_windows.keys(); handleRemovedWindows(); + sg->invalidate(); + + gl->doneCurrent(); + delete gl; + gl = 0; + #ifdef THREAD_DEBUG printf(" RenderThread: render loop exited... Good Night!\n"); #endif @@ -790,59 +781,6 @@ void QQuickRenderThreadSingleContextWindowManager::run() #endif } -void QQuickRenderThreadSingleContextWindowManager::releaseResourcesInThread() -{ -#ifdef THREAD_DEBUG - printf(" RenderThread: releasing resources...\n"); -#endif - QQuickCanvas *canvas = masterCanvas(); - QWindow *tmpSurface = 0; - - if (canvas) { - gl->makeCurrent(canvas); - } else { - tmpSurface = new QWindow(); - tmpSurface->setSurfaceType(QSurface::OpenGLSurface); - tmpSurface->resize(4, 4); - tmpSurface->create(); - gl->makeCurrent(tmpSurface); - } - - sg->invalidate(); - gl->doneCurrent(); - delete gl; - gl = 0; - - if (tmpSurface) - delete tmpSurface; - - wake(); -} - -void QQuickRenderThreadSingleContextWindowManager::releaseResources() -{ -#ifdef THREAD_DEBUG - printf("GUI: releasing resources\n"); -#endif - - lockInGui(); - if (!isRunning() && gl) { - runToReleaseResources = true; - start(); - - while (isRunning()) { - wait(); - } - } -#ifdef THREAD_DEBUG - else { - printf("GUI: render thread running not releasing resources...\n"); - } -#endif - unlockInGui(); - -} - bool QQuickRenderThreadSingleContextWindowManager::event(QEvent *e) { Q_ASSERT(QThread::currentThread() == qApp->thread()); @@ -1074,6 +1012,7 @@ void QQuickRenderThreadSingleContextWindowManager::startRendering() animationTimer = -1; } + } @@ -1216,46 +1155,17 @@ void QQuickTrivialWindowManager::hide(QQuickCanvas *canvas) m_windows.remove(canvas); QQuickCanvasPrivate *cd = QQuickCanvasPrivate::get(canvas); cd->cleanupNodesOnShutdown(); -} - -void QQuickTrivialWindowManager::canvasDestroyed(QQuickCanvas *canvas) -{ - hide(canvas); -} - -void QQuickTrivialWindowManager::releaseResources() -{ - if (m_windows.size() == 0 && gl) { - QQuickCanvas *canvas = masterCanvas(); - QWindow *tmpSurface = 0; - - if (canvas) { - gl->makeCurrent(canvas); - } else { - tmpSurface = new QWindow(); - tmpSurface->setSurfaceType(QSurface::OpenGLSurface); - tmpSurface->resize(4, 4); - tmpSurface->create(); - gl->makeCurrent(tmpSurface); - } + if (m_windows.size() == 0) { sg->invalidate(); delete gl; gl = 0; - - delete tmpSurface; } } -QQuickCanvas *QQuickTrivialWindowManager::masterCanvas() const +void QQuickTrivialWindowManager::canvasDestroyed(QQuickCanvas *canvas) { - // Find a "proper surface" to bind... - for (QHash::const_iterator it = m_windows.constBegin(); - it != m_windows.constEnd(); ++it) { - if (it.key()->visible()) - return it.key(); - } - return 0; + hide(canvas); } void QQuickTrivialWindowManager::renderCanvas(QQuickCanvas *canvas) @@ -1265,20 +1175,30 @@ void QQuickTrivialWindowManager::renderCanvas(QQuickCanvas *canvas) CanvasData &data = const_cast(m_windows[canvas]); - QQuickCanvas *window = canvas->visible() ? canvas : masterCanvas(); + QQuickCanvas *masterCanvas = 0; + if (!canvas->visible()) { + // Find a "proper surface" to bind... + for (QHash::const_iterator it = m_windows.constBegin(); + it != m_windows.constEnd() && !masterCanvas; ++it) { + if (it.key()->visible()) + masterCanvas = it.key(); + } + } else { + masterCanvas = canvas; + } - if (!window) + if (!masterCanvas) return; if (!gl) { gl = new QOpenGLContext(); - gl->setFormat(window->requestedFormat()); + gl->setFormat(masterCanvas->requestedFormat()); gl->create(); - if (!gl->makeCurrent(window)) + if (!gl->makeCurrent(masterCanvas)) qWarning("QQuickCanvas: makeCurrent() failed..."); sg->initialize(gl); } else { - gl->makeCurrent(window); + gl->makeCurrent(masterCanvas); } bool alsoSwap = data.updatePending; diff --git a/src/quick/items/qquickwindowmanager_p.h b/src/quick/items/qquickwindowmanager_p.h index 014b38132e..86312655b3 100644 --- a/src/quick/items/qquickwindowmanager_p.h +++ b/src/quick/items/qquickwindowmanager_p.h @@ -52,6 +52,8 @@ class QSGContext; class QQuickWindowManager { public: + virtual ~QQuickWindowManager(); + virtual void show(QQuickCanvas *canvas) = 0; virtual void hide(QQuickCanvas *canvas) = 0; From 17790b069d5ce4ec4ca31f7ff1f00b268ddc0e29 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 24 Feb 2012 12:23:51 +0100 Subject: [PATCH 18/82] The plugin is cleaned up by the plugin loader so don't double-delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8bac5b6e1960cbc38575c76f02aa6c6c90700331 Reviewed-by: Samuel Rødal --- src/quick/scenegraph/qsgcontextplugin.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 026afb2d56..6382d42462 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -71,7 +71,6 @@ struct QSGAdaptionPluginData ~QSGAdaptionPluginData() { - delete factory; } bool tried; @@ -102,15 +101,15 @@ QSGAdaptionPluginData *contextFactory() if (!device.isEmpty()) { plugin->factory = qobject_cast(loader()->instance(device)); plugin->deviceName = device; - } #ifndef QT_NO_DEBUG - if (!device.isEmpty()) { - qWarning("Could not create scene graph context for device '%s'" - " - check that plugins are installed correctly in %s", - qPrintable(device), - qPrintable(QLibraryInfo::location(QLibraryInfo::PluginsPath))); - } + if (!plugin->factory) { + qWarning("Could not create scene graph context for device '%s'" + " - check that plugins are installed correctly in %s", + qPrintable(device), + qPrintable(QLibraryInfo::location(QLibraryInfo::PluginsPath))); + } #endif + } #endif // QT_NO_LIBRARY || QT_NO_SETTINGS } From a8929f5d300b73d6dacdc47e85401f3b9f6a1bf8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 24 Feb 2012 13:22:31 +0000 Subject: [PATCH 19/82] Update license headers Change-Id: Id47c6b26ee2ac2b3d30c464adaa55b7a7c3e4442 Reviewed-by: Kent Hansen --- src/declarative/qml/v8/qjsconverter_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qjsengine.h | 38 +++++++++++++----- src/declarative/qml/v8/qjsengine_p.h | 40 ++++++++++++++----- src/declarative/qml/v8/qjsvalue.h | 38 +++++++++++++----- src/declarative/qml/v8/qjsvalue_impl_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qjsvalue_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qjsvalueiterator.h | 40 ++++++++++++++----- .../qml/v8/qjsvalueiterator_impl_p.h | 36 ++++++++++++----- src/declarative/qml/v8/qjsvalueiterator_p.h | 36 ++++++++++++----- src/declarative/qml/v8/qscript_impl_p.h | 40 ++++++++++++++----- src/declarative/qml/v8/qscriptisolate_p.h | 38 +++++++++++++----- .../qml/v8/qscriptoriginalglobalobject_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qscriptshareddata_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qscripttools_p.h | 38 +++++++++++++----- src/declarative/qml/v8/qv8engine_impl_p.h | 36 ++++++++++++----- 15 files changed, 420 insertions(+), 150 deletions(-) diff --git a/src/declarative/qml/v8/qjsconverter_p.h b/src/declarative/qml/v8/qjsconverter_p.h index 29fef3c700..12ec9350e4 100644 --- a/src/declarative/qml/v8/qjsconverter_p.h +++ b/src/declarative/qml/v8/qjsconverter_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsengine.h b/src/declarative/qml/v8/qjsengine.h index 94c4dffde4..884435f4e2 100644 --- a/src/declarative/qml/v8/qjsengine.h +++ b/src/declarative/qml/v8/qjsengine.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsengine_p.h b/src/declarative/qml/v8/qjsengine_p.h index ecd5f7cc86..fb66e94499 100644 --- a/src/declarative/qml/v8/qjsengine_p.h +++ b/src/declarative/qml/v8/qjsengine_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h index 07fe3dcfac..5d915db9af 100644 --- a/src/declarative/qml/v8/qjsvalue.h +++ b/src/declarative/qml/v8/qjsvalue.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h index cd33859c50..0b0cd0759a 100644 --- a/src/declarative/qml/v8/qjsvalue_impl_p.h +++ b/src/declarative/qml/v8/qjsvalue_impl_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h index 3eccba64bd..3275f47b85 100644 --- a/src/declarative/qml/v8/qjsvalue_p.h +++ b/src/declarative/qml/v8/qjsvalue_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalueiterator.h b/src/declarative/qml/v8/qjsvalueiterator.h index 5f5446430e..5e2c3d4561 100644 --- a/src/declarative/qml/v8/qjsvalueiterator.h +++ b/src/declarative/qml/v8/qjsvalueiterator.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h index 40814b1969..9a265e8d48 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_impl_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_impl_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qjsvalueiterator_p.h b/src/declarative/qml/v8/qjsvalueiterator_p.h index d1869506e9..1bfa5cb165 100644 --- a/src/declarative/qml/v8/qjsvalueiterator_p.h +++ b/src/declarative/qml/v8/qjsvalueiterator_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qscript_impl_p.h b/src/declarative/qml/v8/qscript_impl_p.h index fdbf2f0097..1868fbc0de 100644 --- a/src/declarative/qml/v8/qscript_impl_p.h +++ b/src/declarative/qml/v8/qscript_impl_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qscriptisolate_p.h b/src/declarative/qml/v8/qscriptisolate_p.h index 4afa74756f..9adce9f8ab 100644 --- a/src/declarative/qml/v8/qscriptisolate_p.h +++ b/src/declarative/qml/v8/qscriptisolate_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h index 12321cc71a..9a656a4ca1 100644 --- a/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h +++ b/src/declarative/qml/v8/qscriptoriginalglobalobject_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qscriptshareddata_p.h b/src/declarative/qml/v8/qscriptshareddata_p.h index df95b26206..4dd56798f1 100644 --- a/src/declarative/qml/v8/qscriptshareddata_p.h +++ b/src/declarative/qml/v8/qscriptshareddata_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qscripttools_p.h b/src/declarative/qml/v8/qscripttools_p.h index fcea205f61..5b142d3900 100644 --- a/src/declarative/qml/v8/qscripttools_p.h +++ b/src/declarative/qml/v8/qscripttools_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/declarative/qml/v8/qv8engine_impl_p.h b/src/declarative/qml/v8/qv8engine_impl_p.h index 349589680a..ea8a0b1076 100644 --- a/src/declarative/qml/v8/qv8engine_impl_p.h +++ b/src/declarative/qml/v8/qv8engine_impl_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** From 4a170793828a7cc6ee29443d6b312551b29363a3 Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Wed, 15 Feb 2012 08:31:48 +0800 Subject: [PATCH 20/82] Build fix when use '-no-stl' option error C3861: 'toupper': identifier not found error C2065: 'RAND_MAX' : undeclared identifier error C3861: 'rand': identifier not found error C2065: 'RAND_MAX' : undeclared identifier error C3861: 'rand': identifier not found Change-Id: Iaa0daf516c3d9f90d9119f958d79187ee2bb959c Reviewed-by: Lars Knoll --- src/declarative/qml/qdeclarativepropertycache.cpp | 2 ++ src/quick/particles/qquickangledirection.cpp | 1 + src/quick/particles/qquickellipseextruder.cpp | 1 + src/quick/particles/qquicklineextruder.cpp | 1 + src/quick/particles/qquickparticleextruder.cpp | 1 + src/quick/particles/qquickpointdirection.cpp | 1 + src/quick/particles/qquickrectangleextruder.cpp | 1 + 7 files changed, 8 insertions(+) diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index c8bfd98363..2d7644a7a8 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -50,6 +50,8 @@ #include +#include // for toupper + Q_DECLARE_METATYPE(QJSValue) Q_DECLARE_METATYPE(QDeclarativeV8Handle); diff --git a/src/quick/particles/qquickangledirection.cpp b/src/quick/particles/qquickangledirection.cpp index 48fc5a8273..726b6fa404 100644 --- a/src/quick/particles/qquickangledirection.cpp +++ b/src/quick/particles/qquickangledirection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickangledirection_p.h" +#include #include QT_BEGIN_NAMESPACE const qreal CONV = 0.017453292519943295; diff --git a/src/quick/particles/qquickellipseextruder.cpp b/src/quick/particles/qquickellipseextruder.cpp index 3b80810773..63ce5786c5 100644 --- a/src/quick/particles/qquickellipseextruder.cpp +++ b/src/quick/particles/qquickellipseextruder.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickellipseextruder_p.h" +#include #include QT_BEGIN_NAMESPACE /*! diff --git a/src/quick/particles/qquicklineextruder.cpp b/src/quick/particles/qquicklineextruder.cpp index c98ce8d76b..b034c5293c 100644 --- a/src/quick/particles/qquicklineextruder.cpp +++ b/src/quick/particles/qquicklineextruder.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include "qquicklineextruder_p.h" +#include #include /*! diff --git a/src/quick/particles/qquickparticleextruder.cpp b/src/quick/particles/qquickparticleextruder.cpp index f5605ef4d4..fc985b0c8e 100644 --- a/src/quick/particles/qquickparticleextruder.cpp +++ b/src/quick/particles/qquickparticleextruder.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickparticleextruder_p.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/quick/particles/qquickpointdirection.cpp b/src/quick/particles/qquickpointdirection.cpp index 79c3365f86..6184170aae 100644 --- a/src/quick/particles/qquickpointdirection.cpp +++ b/src/quick/particles/qquickpointdirection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickpointdirection_p.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/quick/particles/qquickrectangleextruder.cpp b/src/quick/particles/qquickrectangleextruder.cpp index 777d0f66f0..4127956e65 100644 --- a/src/quick/particles/qquickrectangleextruder.cpp +++ b/src/quick/particles/qquickrectangleextruder.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickrectangleextruder_p.h" +#include QT_BEGIN_NAMESPACE From 316ede158401c0e939cae817388a67b3303ac59d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 24 Feb 2012 09:46:35 +1000 Subject: [PATCH 21/82] Get script benchmark compiling and running. Change-Id: Ifc433f6c430d430bfb8b2d8b47a84ad2688e4cb2 Reviewed-by: Chris Adams --- .../script/data/signal_heavyArgsAccess.qml | 51 ++++ .../script/data/signal_heavyIdAccess.qml | 54 ++++ .../benchmarks/declarative/script/script.pro | 3 +- .../declarative/script/tst_script.cpp | 261 +++++++++++------- 4 files changed, 262 insertions(+), 107 deletions(-) create mode 100644 tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml create mode 100644 tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml diff --git a/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml b/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml new file mode 100644 index 0000000000..a9675c333b --- /dev/null +++ b/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt.test 1.0 + +TestObject { + onMySignalWithArgs: { + var a = 0; + for (var i = 0; i < 10000; ++i) + a += n; + return a; + } +} diff --git a/tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml b/tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml new file mode 100644 index 0000000000..e426ee5116 --- /dev/null +++ b/tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt.test 1.0 + +TestObject { + id: obj + property real inc: 3 + + onMySignalWithArgs: { + var a = 0; + for (var i = 0; i < 10000; ++i) + a += obj.inc; + return a; + } +} diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 310d17d3c9..6b454beed5 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -1,10 +1,11 @@ CONFIG += testcase TEMPLATE = app TARGET = tst_script -QT += declarative testlib macx:CONFIG -= app_bundle CONFIG += release SOURCES += tst_script.cpp +QT += core-private gui-private v8-private declarative-private quick-private testlib + DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index 0e5d782134..77a0d36d3a 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -43,10 +43,9 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include class tst_script : public QObject { @@ -58,10 +57,13 @@ private slots: void initTestCase(); void property_js(); - void property_getter(); void property_getter_js(); - void property_getter_qobject(); - void property_getter_qmetaproperty(); +#if 0 + //no native functions for now + void property_getter(); + void property_getter_qobject(); + void property_getter_qmetaproperty(); +#endif void property_qobject(); void property_qmlobject(); @@ -69,12 +71,18 @@ private slots: void setproperty_qmlobject(); void function_js(); +#if 0 + //no native functions for now void function_cpp(); +#endif void function_qobject(); void function_qmlobject(); void function_args_js(); +#if 0 + //no native functions for now void function_args_cpp(); +#endif void function_args_qobject(); void function_args_qmlobject(); @@ -82,6 +90,8 @@ private slots: void signal_qml(); void signal_args(); void signal_unusedArgs(); + void signal_heavyArgsAccess(); + void signal_heavyIdAccess(); void slot_simple(); void slot_simple_js(); @@ -144,7 +154,7 @@ TestObject::TestObject(QObject *parent) { } -int TestObject::x() +int TestObject::x() { return m_x++; } @@ -166,14 +176,14 @@ void tst_script::initTestCase() void tst_script::property_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("x"), 10); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -181,23 +191,24 @@ void tst_script::property_js() } } -static QScriptValue property_getter_method(QScriptContext *, QScriptEngine *engine) +#if 0 +static QJSValue property_getter_method(QScriptContext *, QJSEngine *engine) { static int x = 0; - return QScriptValue(engine,x++); + return QJSValue(engine,x++); } void tst_script::property_getter() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -206,44 +217,44 @@ void tst_script::property_getter() } static TestObject *property_getter_qobject_object = 0; -static QScriptValue property_getter_qobject_method(QScriptContext *, QScriptEngine *) +static QJSValue property_getter_qobject_method(QScriptContext *, QJSEngine *) { static int idx = -1; - if (idx == -1) + if (idx == -1) idx = TestObject::staticMetaObject.indexOfProperty("x"); int value = 0; void *args[] = { &value, 0 }; QMetaObject::metacall(property_getter_qobject_object, QMetaObject::ReadProperty, idx, args); - return QScriptValue(value); + return QJSValue(value); } -static QScriptValue property_getter_qmetaproperty_method(QScriptContext *, QScriptEngine *) +static QJSValue property_getter_qmetaproperty_method(QScriptContext *, QJSEngine *) { static int idx = -1; - if (idx == -1) + if (idx == -1) idx = TestObject::staticMetaObject.indexOfProperty("x"); int value = 0; value = property_getter_qobject_object->metaObject()->property(idx).read(property_getter_qobject_object).toInt(); - return QScriptValue(value); + return QJSValue(value); } void tst_script::property_getter_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; property_getter_qobject_object = &to; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -254,17 +265,17 @@ void tst_script::property_getter_qobject() void tst_script::property_getter_qmetaproperty() { - QScriptEngine engine; + QJSEngine engine; TestObject to; property_getter_qobject_object = &to; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -272,17 +283,17 @@ void tst_script::property_getter_qmetaproperty() } property_getter_qobject_object = 0; } - +#endif void tst_script::property_getter_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call(); + QJSEngine engine; + + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call(); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -292,14 +303,14 @@ void tst_script::property_getter_js() void tst_script::property_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -311,14 +322,15 @@ void tst_script::property_qmlobject() { QDeclarativeEngine qmlengine; - QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; + QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); - - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(PROPERTY_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -335,14 +347,14 @@ void tst_script::property_qmlobject() void tst_script::setproperty_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("x"), 0); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -354,14 +366,16 @@ void tst_script::setproperty_qmlobject() { QDeclarativeEngine qmlengine; - QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(SETPROPERTY_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(SETPROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -380,13 +394,13 @@ void tst_script::setproperty_qmlobject() void tst_script::function_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call(); + QJSEngine engine; + + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call(); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -394,39 +408,41 @@ void tst_script::function_js() } } -static QScriptValue function_method(QScriptContext *, QScriptEngine *) +#if 0 +static QJSValue function_method(QScriptContext *, QJSEngine *) { static int x = 0; - return QScriptValue(x++); + return QJSValue(x++); } void tst_script::function_cpp() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("method"), engine.newFunction(function_method)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { prog.call(); } } +#endif void tst_script::function_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -438,14 +454,16 @@ void tst_script::function_qmlobject() { QDeclarativeEngine qmlengine; - QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(FUNCTION_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -464,13 +482,13 @@ void tst_script::function_qmlobject() void tst_script::function_args_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.methodArgs = (function(a) { return a + this._x++; }); return o; })").call(); + QJSEngine engine; - QScriptValueList args; + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.methodArgs = (function(a) { return a + this._x++; }); return o; })").call(); + + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -478,39 +496,41 @@ void tst_script::function_args_js() } } -static QScriptValue function_args_method(QScriptContext *ctxt, QScriptEngine *) +#if 0 +static QJSValue function_args_method(QScriptContext *ctxt, QJSEngine *) { static int x = 0; - return QScriptValue(ctxt->argument(0).toNumber() + x++); + return QJSValue(ctxt->argument(0).toNumber() + x++); } void tst_script::function_args_cpp() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("methodArgs"), engine.newFunction(function_args_method)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { prog.call(); } } +#endif void tst_script::function_args_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -522,14 +542,16 @@ void tst_script::function_args_qmlobject() { QDeclarativeEngine qmlengine; - QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(FUNCTION_ARGS_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -593,6 +615,34 @@ void tst_script::signal_unusedArgs() delete object; } +void tst_script::signal_heavyArgsAccess() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_heavyArgsAccess.qml")); + TestObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QBENCHMARK { + object->emitMySignalWithArgs(11); + } + + delete object; +} + +void tst_script::signal_heavyIdAccess() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_heavyIdAccess.qml")); + TestObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QBENCHMARK { + object->emitMySignalWithArgs(11); + } + + delete object; +} + void tst_script::slot_simple() { QDeclarativeEngine engine; @@ -662,7 +712,7 @@ void tst_script::block() QFETCH(QString, methodName); QDeclarativeEngine engine; QDeclarativeComponent component(&engine, TEST_FILE("block.qml")); - QDeclarativeRectangle *rect = qobject_cast(component.create()); + QQuickRectangle *rect = qobject_cast(component.create()); QVERIFY(rect != 0); int index = rect->metaObject()->indexOfMethod(methodName.toUtf8()); @@ -685,9 +735,9 @@ void tst_script::block() void tst_script::global_property_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM); + QJSValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM); prog.call(); QBENCHMARK { @@ -699,8 +749,7 @@ void tst_script::global_property_qml() { QDeclarativeEngine qmlengine; - QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); - QScriptValue prog = engine->evaluate(GLOBALPROPERTY_PROGRAM); + QJSValue prog = qmlengine.evaluate(GLOBALPROPERTY_PROGRAM); prog.call(); QBENCHMARK { @@ -712,7 +761,7 @@ void tst_script::global_property_qml_js() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine, TEST_FILE("global_prop.qml")); - QDeclarativeRectangle *rect = qobject_cast(component.create()); + QQuickRectangle *rect = qobject_cast(component.create()); QVERIFY(rect != 0); int index = rect->metaObject()->indexOfMethod("triggered()"); @@ -730,7 +779,7 @@ void tst_script::scriptfile_property() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine, TEST_FILE("global_prop.qml")); - QDeclarativeRectangle *rect = qobject_cast(component.create()); + QQuickRectangle *rect = qobject_cast(component.create()); QVERIFY(rect != 0); int index = rect->metaObject()->indexOfMethod("incrementTriggered()"); From 86b14cf97081cad1e32b8b5261f771184300f8af Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Feb 2012 10:12:52 +1000 Subject: [PATCH 22/82] Remove unused member. Change-Id: Ibfcc7a78e442c2be5bab6933e2e85ed39344e6c2 Reviewed-by: Kim M. Kalland --- src/quick/scenegraph/qsgcontext.cpp | 2 +- src/quick/scenegraph/qsgdefaultrectanglenode.cpp | 3 +-- src/quick/scenegraph/qsgdefaultrectanglenode_p.h | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 03afed293a..877278116f 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -238,7 +238,7 @@ void QSGContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) */ QSGRectangleNode *QSGContext::createRectangleNode() { - return new QSGDefaultRectangleNode(this); + return new QSGDefaultRectangleNode; } /*! diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp index cb385f6dd0..3d15f6944d 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp +++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -QSGDefaultRectangleNode::QSGDefaultRectangleNode(QSGContext *context) +QSGDefaultRectangleNode::QSGDefaultRectangleNode() : m_border(0) , m_radius(0) , m_pen_width(0) @@ -62,7 +62,6 @@ QSGDefaultRectangleNode::QSGDefaultRectangleNode(QSGContext *context) , m_gradient_is_opaque(true) , m_dirty_geometry(false) , m_default_geometry(QSGGeometry::defaultAttributes_Point2D(), 4) - , m_context(context) { setGeometry(&m_default_geometry); setMaterial(&m_fill_material); diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h index 49ca3771c1..a5e43f8581 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h +++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h @@ -57,7 +57,7 @@ class QSGContext; class QSGDefaultRectangleNode : public QSGRectangleNode { public: - QSGDefaultRectangleNode(QSGContext *context); + QSGDefaultRectangleNode(); ~QSGDefaultRectangleNode(); virtual void setRect(const QRectF &rect); @@ -95,8 +95,6 @@ class QSGDefaultRectangleNode : public QSGRectangleNode uint m_material_type : 2; // Only goes up to 3 QSGGeometry m_default_geometry; - - QSGContext *m_context; }; QT_END_NAMESPACE From 6c08b232f31430896e332b9222f3ded2b3e73c7a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 24 Feb 2012 18:05:35 +1000 Subject: [PATCH 23/82] Stabilise tests Change-Id: I2227fede52f5b0d59bd0dd9b10ab0151318d61dd Reviewed-by: Martin Jones --- .../data/multipleTransitions.qml | 2 +- .../qquicklistview/tst_qquicklistview.cpp | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml b/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml index 50ffbc53c3..3e3248535b 100644 --- a/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml +++ b/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml @@ -10,7 +10,7 @@ Rectangle { // interrupting transitions will still produce the correct result) property int timeBetweenActions: duration / 2 - property int duration: 100 + property int duration: 300 property int count: list.count diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index eb7efd6d33..959bb2b265 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -490,6 +490,7 @@ void tst_QQuickListView::inserted_more() canvas->setSource(testFileUrl("listviewtest.qml")); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -643,6 +644,7 @@ void tst_QQuickListView::insertBeforeVisible() canvas->setSource(testFileUrl("listviewtest.qml")); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -733,6 +735,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) canvas->setSource(source); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -922,6 +925,7 @@ void tst_QQuickListView::removed_more(const QUrl &source) canvas->setSource(source); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -1143,6 +1147,7 @@ void tst_QQuickListView::moved(const QUrl &source) canvas->setSource(source); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -1369,6 +1374,7 @@ void tst_QQuickListView::multipleChanges() canvas->setSource(testFileUrl("listviewtest.qml")); canvas->show(); qApp->processEvents(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -4813,6 +4819,7 @@ void tst_QQuickListView::populateTransitions() canvas->rootContext()->setContextProperty("model_transitionVia", &model_transitionVia); canvas->setSource(testFileUrl("populateTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QVERIFY(listview); @@ -4950,6 +4957,7 @@ void tst_QQuickListView::addTransitions() ctxt->setContextProperty("testObject", testObject); canvas->setSource(testFileUrl("addTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -5144,6 +5152,7 @@ void tst_QQuickListView::moveTransitions() ctxt->setContextProperty("testObject", testObject); canvas->setSource(testFileUrl("moveTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -5346,6 +5355,7 @@ void tst_QQuickListView::removeTransitions() ctxt->setContextProperty("testObject", testObject); canvas->setSource(testFileUrl("removeTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -5537,6 +5547,7 @@ void tst_QQuickListView::multipleTransitions() ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom); canvas->setSource(testFileUrl("multipleTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickListView *listview = findItem(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -5603,20 +5614,9 @@ void tst_QQuickListView::multipleTransitions() } QCOMPARE(listview->count(), model.count()); - QList items = findItems(contentItem, "wrapper"); - int firstVisibleIndex = -1; - for (int i=0; iy() >= contentY) { - QDeclarativeExpression e(qmlContext(items[i]), items[i], "index"); - firstVisibleIndex = e.evaluate().toInt(); - break; - } - } - QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); - // verify all items moved to the correct final positions - int itemCount = findItems(contentItem, "wrapper").count(); - for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) { + QList items = findItems(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { QQuickItem *item = findItem(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), 0.0); From cd6cabc6ccd2499662ddb3b5748561557360843b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 27 Feb 2012 11:08:15 +1000 Subject: [PATCH 24/82] Improve test coverage for anchors. Change-Id: I2705407b16ef678ed5b3cbfa7116ae6b18366688 Reviewed-by: Yann Bodson --- .../qtquick2/qquickanchors/data/stretch.qml | 39 ++++++++++++++++++ .../qquickanchors/tst_qquickanchors.cpp | 41 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/auto/qtquick2/qquickanchors/data/stretch.qml diff --git a/tests/auto/qtquick2/qquickanchors/data/stretch.qml b/tests/auto/qtquick2/qquickanchors/data/stretch.qml new file mode 100644 index 0000000000..64e23e30b5 --- /dev/null +++ b/tests/auto/qtquick2/qquickanchors/data/stretch.qml @@ -0,0 +1,39 @@ +import QtQuick 2.0 + +Rectangle { + width: 400; height: 400 + + Rectangle { + id: rect1 + x: 20; y: 20; + height: 360; width: 360; + + Rectangle { + id: rect2; objectName: "stretcher" + anchors.verticalCenter: rect1.verticalCenter + anchors.bottom: rect3.top + anchors.horizontalCenter: rect1.horizontalCenter + anchors.left: rect3.left + } + + Rectangle { + id: rect3 + x: 160; y: 230 + width: 10 + height: 10 + } + + Rectangle { + id: rect4; objectName: "stretcher2" + anchors.verticalCenter: rect1.verticalCenter + anchors.top: rect5.top + } + + Rectangle { + id: rect5 + x: 160; y: 130 + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp index 8d82abc53b..af43686e27 100644 --- a/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp +++ b/tests/auto/qtquick2/qquickanchors/tst_qquickanchors.cpp @@ -83,6 +83,7 @@ private slots: void fillRTL(); void margins(); void marginsRTL(); + void stretch(); }; void tst_qquickanchors::basicAnchors() @@ -472,6 +473,10 @@ void tst_qquickanchors::fill() qApp->processEvents(); QQuickRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); + QCOMPARE(rectPrivate->anchors()->leftMargin(), 10.0); + QCOMPARE(rectPrivate->anchors()->topMargin(), 30.0); + QCOMPARE(rectPrivate->anchors()->rightMargin(), 20.0); + QCOMPARE(rectPrivate->anchors()->bottomMargin(), 40.0); QCOMPARE(rect->x(), 0.0 + 10.0); QCOMPARE(rect->y(), 0.0 + 30.0); QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); @@ -481,6 +486,10 @@ void tst_qquickanchors::fill() rectPrivate->anchors()->setRightMargin(0.0); rectPrivate->anchors()->setBottomMargin(0.0); rectPrivate->anchors()->setTopMargin(10.0); + QCOMPARE(rectPrivate->anchors()->leftMargin(), 20.0); + QCOMPARE(rectPrivate->anchors()->topMargin(), 10.0); + QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0); + QCOMPARE(rectPrivate->anchors()->bottomMargin(), 0.0); QCOMPARE(rect->x(), 0.0 + 20.0); QCOMPARE(rect->y(), 0.0 + 10.0); QCOMPARE(rect->width(), 200.0 - 20.0); @@ -523,11 +532,15 @@ void tst_qquickanchors::centerIn() QQuickRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); + QCOMPARE(rectPrivate->anchors()->horizontalCenterOffset(), 10.0); + QCOMPARE(rectPrivate->anchors()->verticalCenterOffset(), 30.0); QCOMPARE(rect->x(), 75.0 + 10); QCOMPARE(rect->y(), 75.0 + 30); //Alter Offsets (tests QTBUG-6631) rectPrivate->anchors()->setHorizontalCenterOffset(-20.0); rectPrivate->anchors()->setVerticalCenterOffset(-10.0); + QCOMPARE(rectPrivate->anchors()->horizontalCenterOffset(), -20.0); + QCOMPARE(rectPrivate->anchors()->verticalCenterOffset(), -10.0); QCOMPARE(rect->x(), 75.0 - 20.0); QCOMPARE(rect->y(), 75.0 - 10.0); @@ -623,6 +636,11 @@ void tst_qquickanchors::margins() qApp->processEvents(); QQuickRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); + QCOMPARE(rectPrivate->anchors()->margins(), 10.0); + QCOMPARE(rectPrivate->anchors()->topMargin(), 6.0); + QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0); + QCOMPARE(rectPrivate->anchors()->bottomMargin(), 10.0); + QCOMPARE(rectPrivate->anchors()->rightMargin(), 10.0); QCOMPARE(rect->x(), 5.0); QCOMPARE(rect->y(), 6.0); QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0); @@ -631,6 +649,12 @@ void tst_qquickanchors::margins() rectPrivate->anchors()->setTopMargin(0.0); rectPrivate->anchors()->setMargins(20.0); + QCOMPARE(rectPrivate->anchors()->margins(), 20.0); + QEXPECT_FAIL("","QTBUG-24515", Continue); + QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0); + QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0); + QCOMPARE(rectPrivate->anchors()->bottomMargin(), 20.0); + QCOMPARE(rectPrivate->anchors()->rightMargin(), 20.0); QCOMPARE(rect->x(), 5.0); QCOMPARE(rect->y(), 20.0); QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0); @@ -663,6 +687,23 @@ void tst_qquickanchors::marginsRTL() delete view; } +void tst_qquickanchors::stretch() +{ + QQuickView *view = new QQuickView(testFileUrl("stretch.qml")); + + qApp->processEvents(); + QQuickRectangle* rect = findItem(view->rootObject(), QLatin1String("stretcher")); + QCOMPARE(rect->x(), 160.0); + QCOMPARE(rect->y(), 130.0); + QCOMPARE(rect->width(), 40.0); + QCOMPARE(rect->height(), 100.0); + + QQuickRectangle* rect2 = findItem(view->rootObject(), QLatin1String("stretcher2")); + QCOMPARE(rect2->y(), 130.0); + QCOMPARE(rect2->height(), 100.0); + + delete view; +} QTEST_MAIN(tst_qquickanchors) From de02b0f6ba4c422ff617308617b32804b15d1f7e Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Fri, 24 Feb 2012 16:14:12 +1000 Subject: [PATCH 25/82] Ensure importing module API in js import works This commit adds a unit test to ensure that a property of a module api can be accessed in a JavaScript import. Change-Id: Iecba76a9db0400ece1777256f19803d4bad53438 Reviewed-by: Alan Alpert --- .../data/jsimport/importModuleApi.js | 5 +++++ .../data/jsimport/testImportModuleApi.qml | 10 ++++++++++ .../tst_qdeclarativeecmascript.cpp | 7 +++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/jsimport/importModuleApi.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/jsimport/testImportModuleApi.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/importModuleApi.js b/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/importModuleApi.js new file mode 100644 index 0000000000..7a4f434665 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/importModuleApi.js @@ -0,0 +1,5 @@ +.import Qt.test 1.0 as QObjectModuleApi + +function testFunc() { + return QObjectModuleApi.qobjectTestProperty +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/testImportModuleApi.qml b/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/testImportModuleApi.qml new file mode 100644 index 0000000000..b3e545dd7c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/jsimport/testImportModuleApi.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import "importModuleApi.js" as Script + +Item { + property variant testValue: 5 + + Component.onCompleted: { + testValue = Script.testFunc(); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 7fc137e38d..6905252107 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -3267,6 +3267,13 @@ void tst_qdeclarativeecmascript::importScripts_data() << QStringList() << (QStringList() << QLatin1String("testValue")) << (QVariantList() << QVariant(18)); + + QTest::newRow("import module api into js import") + << testFileUrl("jsimport/testImportModuleApi.qml") + << QString() + << QStringList() + << (QStringList() << QLatin1String("testValue")) + << (QVariantList() << QVariant(20)); } void tst_qdeclarativeecmascript::importScripts() From d2921ffc52fed380326f8abb86d6d659cc47f9d1 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Fri, 24 Feb 2012 14:40:11 +1000 Subject: [PATCH 26/82] Check engine equality condition inside null ptr check Previously, we asserted if the engine associated with the two external resources from the arguments to the object comparison callback were not equal, prior to checking that the external resources were non-null. Task-number: QTBUG-24489 Change-Id: I4b2bd2377fcf38163d1341e43e056b1405ab72ac Reviewed-by: Yunqiao Yin Reviewed-by: Michael Brasser --- src/declarative/qml/v8/qv8engine.cpp | 6 ++++-- .../data/nonValueTypeComparison.qml | 10 ++++++++++ .../tst_qdeclarativevaluetypes.cpp | 13 +++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index 04589fe244..70e6528f0a 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -75,12 +75,14 @@ static bool ObjectComparisonCallback(v8::Local lhs, v8::Local(lhs->GetExternalResource()); QV8ObjectResource *rhsr = static_cast(rhs->GetExternalResource()); - Q_ASSERT(lhsr->engine == rhsr->engine); - if (lhsr && rhsr) { + Q_ASSERT(lhsr->engine == rhsr->engine); QV8ObjectResource::ResourceType lhst = lhsr->resourceType(); QV8ObjectResource::ResourceType rhst = rhsr->resourceType(); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml new file mode 100644 index 0000000000..0ffa5eb666 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +Item { + property variant somepoint: Qt.point(1,2) + property variant randomjsobj: {"some": 1, "thing": 2} + property bool test1: somepoint != randomjsobj + + property variant similar: {"x":1, "y":2} + property bool test2: somepoint != similar +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 72ec7a5abf..e701efa2a4 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -93,6 +93,7 @@ private slots: void returnValues(); void varAssignment(); void bindingsSpliceCorrectly(); + void nonValueTypeComparison(); private: QDeclarativeEngine engine; @@ -1301,6 +1302,18 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly() } } +void tst_qdeclarativevaluetypes::nonValueTypeComparison() +{ + QDeclarativeComponent component(&engine, testFileUrl("nonValueTypeComparison.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + + delete object; +} + QTEST_MAIN(tst_qdeclarativevaluetypes) #include "tst_qdeclarativevaluetypes.moc" From 15dac112df4f44ba8b15047720e1570fd4096f26 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 23 Feb 2012 16:57:06 +1000 Subject: [PATCH 27/82] Don't create a separate section header for currentItem The currentItem FxViewItem contained it's own section item, which when created would cause the current item delegate to be repositioned. This change associates the section item with the delegate item, via the attached object. Change-Id: Ie675d545539b56d0f1cf5a9b4ea26668978a5e72 Reviewed-by: Bea Lam --- src/quick/items/qquickitemview.cpp | 15 ++- src/quick/items/qquickitemview_p_p.h | 8 +- src/quick/items/qquicklistview.cpp | 112 ++++++++++-------- src/quick/items/qquicklistview_p.h | 3 +- .../data/sectionpropertychange.qml | 92 ++++++++++++++ .../qquicklistview/tst_qquicklistview.cpp | 53 ++++++++- 6 files changed, 217 insertions(+), 66 deletions(-) create mode 100644 tests/auto/qtquick2/qquicklistview/data/sectionpropertychange.qml diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 533e1f6852..f62fa94f5e 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -46,11 +46,12 @@ QT_BEGIN_NAMESPACE FxViewItem::FxViewItem(QQuickItem *i, bool own) - : item(i), ownItem(own), index(-1), releaseAfterTransition(false) - , transition(0) - , nextTransitionType(FxViewItemTransitionManager::NoTransition) + : item(i), ownItem(own), releaseAfterTransition(false) , isTransitionTarget(false) , nextTransitionToSet(false) + , index(-1) + , transition(0) + , nextTransitionType(FxViewItemTransitionManager::NoTransition) { } @@ -2768,21 +2769,23 @@ void QQuickItemView::destroyingItem(QQuickItem *item) d->unrequestedItems.remove(item); } -void QQuickItemViewPrivate::releaseItem(FxViewItem *item) +bool QQuickItemViewPrivate::releaseItem(FxViewItem *item) { Q_Q(QQuickItemView); if (!item || !model) - return; + return true; if (trackedItem == item) trackedItem = 0; QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item->item); itemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry); - if (model->release(item->item) == 0) { + QQuickVisualModel::ReleaseFlags flags = model->release(item->item); + if (flags == 0) { // item was not destroyed, and we no longer reference it. item->item->setVisible(false); unrequestedItems.insert(item->item, model->indexOf(item->item, q)); } delete item; + return flags != QQuickVisualModel::Referenced; } QQuickItem *QQuickItemViewPrivate::createHighlightItem() diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index 05927c0d68..fce6e4eba5 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -117,15 +117,15 @@ class FxViewItem QQuickItem *item; bool ownItem; - int index; bool releaseAfterTransition; + bool isTransitionTarget; + bool nextTransitionToSet; + int index; QQuickItemViewAttached *attached; FxViewItemTransitionManager *transition; QPointF nextTransitionTo; FxViewItemTransitionManager::TransitionType nextTransitionType; - bool isTransitionTarget; - bool nextTransitionToSet; protected: void moveTo(const QPointF &pos); @@ -225,7 +225,7 @@ class QQuickItemViewPrivate : public QQuickFlickablePrivate void mirrorChange(); FxViewItem *createItem(int modelIndex, bool asynchronous = false); - virtual void releaseItem(FxViewItem *item); + virtual bool releaseItem(FxViewItem *item); QQuickItem *createHighlightItem(); QQuickItem *createComponentItem(QDeclarativeComponent *component, bool receiveItemGeometryChanges, bool createDefault = false); diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 6324c7d2ff..0e643a13e3 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -93,7 +93,7 @@ class QQuickListViewPrivate : public QQuickItemViewPrivate virtual FxViewItem *newViewItem(int index, QQuickItem *item); virtual void initializeViewItem(FxViewItem *item); - virtual void releaseItem(FxViewItem *item); + virtual bool releaseItem(FxViewItem *item); virtual void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer); virtual void repositionPackageItemAt(QQuickItem *item, int index); virtual void resetFirstItemPosition(qreal pos = 0.0); @@ -236,7 +236,7 @@ void QQuickViewSection::setLabelPositioning(int l) class FxListItemSG : public FxViewItem { public: - FxListItemSG(QQuickItem *i, QQuickListView *v, bool own) : FxViewItem(i, own), section(0), view(v) { + FxListItemSG(QQuickItem *i, QQuickListView *v, bool own) : FxViewItem(i, own), view(v) { attached = static_cast(qmlAttachedPropertiesObject(item)); if (attached) static_cast(attached)->setView(view); @@ -244,12 +244,21 @@ class FxListItemSG : public FxViewItem ~FxListItemSG() {} + inline QQuickItem *section() const { + return attached ? static_cast(attached)->m_sectionItem : 0; + } + void setSection(QQuickItem *s) { + if (!attached) + attached = static_cast(qmlAttachedPropertiesObject(item)); + static_cast(attached)->m_sectionItem = s; + } + qreal position() const { - if (section) { + if (section()) { if (view->orientation() == QQuickListView::Vertical) - return section->y(); + return section()->y(); else - return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section->width()-section->x() : section->x()); + return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section()->width()-section()->x() : section()->x()); } else { return itemPosition(); } @@ -261,8 +270,8 @@ class FxListItemSG : public FxViewItem return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -item->width()-itemX() : itemX()); } qreal size() const { - if (section) - return (view->orientation() == QQuickListView::Vertical ? item->height()+section->height() : item->width()+section->width()); + if (section()) + return (view->orientation() == QQuickListView::Vertical ? item->height()+section()->height() : item->width()+section()->width()); else return (view->orientation() == QQuickListView::Vertical ? item->height() : item->width()); } @@ -270,8 +279,8 @@ class FxListItemSG : public FxViewItem return (view->orientation() == QQuickListView::Vertical ? item->height() : item->width()); } qreal sectionSize() const { - if (section) - return (view->orientation() == QQuickListView::Vertical ? section->height() : section->width()); + if (section()) + return (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width()); return 0.0; } qreal endPosition() const { @@ -285,14 +294,14 @@ class FxListItemSG : public FxViewItem } void setPosition(qreal pos) { // position the section immediately even if there is a transition - if (section) { + if (section()) { if (view->orientation() == QQuickListView::Vertical) { - section->setY(pos); + section()->setY(pos); } else { if (view->effectiveLayoutDirection() == Qt::RightToLeft) - section->setX(-section->width()-pos); + section()->setX(-section()->width()-pos); else - section->setX(pos); + section()->setX(pos); } } moveTo(pointForPosition(pos)); @@ -311,23 +320,22 @@ class FxListItemSG : public FxViewItem return view; } - QQuickItem *section; QQuickListView *view; private: QPointF pointForPosition(qreal pos) const { if (view->orientation() == QQuickListView::Vertical) { - if (section) - pos += section->height(); + if (section()) + pos += section()->height(); return QPointF(itemX(), pos); } else { if (view->effectiveLayoutDirection() == Qt::RightToLeft) { - if (section) - pos += section->width(); + if (section()) + pos += section()->width(); return QPointF(-item->width() - pos, itemY()); } else { - if (section) - pos += section->width(); + if (section()) + pos += section()->width(); return QPointF(pos, itemY()); } } @@ -566,25 +574,31 @@ void QQuickListViewPrivate::initializeViewItem(FxViewItem *item) } } -void QQuickListViewPrivate::releaseItem(FxViewItem *item) +bool QQuickListViewPrivate::releaseItem(FxViewItem *item) { - if (item) { - FxListItemSG* listItem = static_cast(item); - if (listItem->section) { - int i = 0; - do { - if (!sectionCache[i]) { - sectionCache[i] = listItem->section; - sectionCache[i]->setVisible(false); - listItem->section = 0; - break; - } - ++i; - } while (i < sectionCacheSize); - delete listItem->section; - } + if (!item || !model) + return true; + + QQuickListViewAttached *att = static_cast(item->attached); + + bool released = QQuickItemViewPrivate::releaseItem(item); + if (released && att && att->m_sectionItem) { + // We hold no more references to this item + int i = 0; + do { + if (!sectionCache[i]) { + sectionCache[i] = att->m_sectionItem; + sectionCache[i]->setVisible(false); + att->m_sectionItem = 0; + break; + } + ++i; + } while (i < sectionCacheSize); + delete att->m_sectionItem; + att->m_sectionItem = 0; } - QQuickItemViewPrivate::releaseItem(item); + + return released; } bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool doBuffer) @@ -944,18 +958,18 @@ void QQuickListViewPrivate::updateInlineSection(FxListItemSG *listItem) if (listItem->attached->m_prevSection != listItem->attached->m_section && (sectionCriteria->labelPositioning() & QQuickViewSection::InlineLabels || (listItem->index == 0 && sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart))) { - if (!listItem->section) { + if (!listItem->section()) { qreal pos = listItem->position(); - listItem->section = getSectionItem(listItem->attached->m_section); + listItem->setSection(getSectionItem(listItem->attached->m_section)); listItem->setPosition(pos); } else { - QDeclarativeContext *context = QDeclarativeEngine::contextForObject(listItem->section)->parentContext(); + QDeclarativeContext *context = QDeclarativeEngine::contextForObject(listItem->section())->parentContext(); context->setContextProperty(QLatin1String("section"), listItem->attached->m_section); } - } else if (listItem->section) { + } else if (listItem->section()) { qreal pos = listItem->position(); - releaseSectionItem(listItem->section); - listItem->section = 0; + releaseSectionItem(listItem->section()); + listItem->setSection(0); listItem->setPosition(pos); } } @@ -972,7 +986,7 @@ void QQuickListViewPrivate::updateStickySections() QQuickItem *lastSectionItem = 0; int index = 0; while (index < visibleItems.count()) { - if (QQuickItem *section = static_cast(visibleItems.at(index))->section) { + if (QQuickItem *section = static_cast(visibleItems.at(index))->section()) { // Find the current section header and last visible section header // and hide them if they will overlap a static section header. qreal sectionPos = orient == QQuickListView::Vertical ? section->y() : section->x(); @@ -1173,9 +1187,9 @@ void QQuickListViewPrivate::initializeCurrentItem() if (currentItem) { FxListItemSG *listItem = static_cast(currentItem); - // don't reposition the item if it's about to be transitioned to another position + // don't reposition the item if it is already in the visibleItems list FxViewItem *actualItem = visibleItem(currentIndex); - if ((!actualItem || !actualItem->transitionScheduledOrRunning())) { + if (!actualItem) { if (currentIndex == visibleIndex - 1 && visibleItems.count()) { // We can calculate exact postion in this case listItem->setPosition(visibleItems.first()->position() - currentItem->size() - spacing); @@ -1186,12 +1200,6 @@ void QQuickListViewPrivate::initializeCurrentItem() } } - // Avoid showing section delegate twice. We still need the section heading so that - // currentItem positioning works correctly. - // This is slightly sub-optimal, but section heading caching minimizes the impact. - if (listItem->section) - listItem->section->setVisible(false); - if (visibleItems.isEmpty()) averageSize = listItem->size(); } diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index bffd935616..058c50f4d7 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -181,7 +181,7 @@ class QQuickListViewAttached : public QQuickItemViewAttached public: QQuickListViewAttached(QObject *parent) - : QQuickItemViewAttached(parent), m_view(0) {} + : QQuickItemViewAttached(parent), m_view(0), m_sectionItem(0) {} ~QQuickListViewAttached() {} Q_PROPERTY(QQuickListView *view READ view NOTIFY viewChanged) @@ -198,6 +198,7 @@ class QQuickListViewAttached : public QQuickItemViewAttached public: QDeclarativeGuard m_view; + QQuickItem *m_sectionItem; }; diff --git a/tests/auto/qtquick2/qquicklistview/data/sectionpropertychange.qml b/tests/auto/qtquick2/qquicklistview/data/sectionpropertychange.qml new file mode 100644 index 0000000000..f4679b5af0 --- /dev/null +++ b/tests/auto/qtquick2/qquicklistview/data/sectionpropertychange.qml @@ -0,0 +1,92 @@ +import QtQuick 2.0 + +Rectangle { + width: 320; height: 480 + + Rectangle { + id: groupButtons + width: 300; height: 30 + color: "yellow" + border.width: 1 + Text { + anchors.centerIn: parent + text: "swap" + } + anchors { + top: parent.top + horizontalCenter: parent.horizontalCenter + } + MouseArea { + anchors.fill: parent + onClicked: switchGroups() + } + } + + function switchGroups() { + if ("title" === myListView.groupBy) + myListView.groupBy = "genre" + else + myListView.groupBy = "title" + } + + Component.onCompleted: { + myListView.model = generateModel(myListView) + } + + ListView { + id: myListView + objectName: "list" + + clip: true + property string groupBy: "title" + + anchors { + top: groupButtons.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + delegate: Item { + objectName: "wrapper" + height: 50 + width: 320 + Text { id: t; text: model.title } + Text { text: model.author; font.pixelSize: 10; anchors.top: t.bottom } + Text { text: parent.y; anchors.right: parent.right } + } + + onGroupByChanged: { + model.move(0,1,1) + section.property = groupBy + } + + section { + criteria: ViewSection.FullString + delegate: Rectangle { width: 320; height: 25; color: "lightblue" + objectName: "sect" + Text {text: section } + Text { text: parent.y; anchors.right: parent.right } + } + property: "title" + } + } + + function generateModel(theParent) + { + var books = [ + { "author": "Billy Bob", "genre": "Anarchism", "title": "Frogs and Love" }, + { "author": "Lefty Smith", "genre": "Horror", "title": "Chainsaws for Noobs" } + ]; + + var model = Qt.createQmlObject("import QtQuick 2.0; ListModel {}", theParent); + + for (var i = 0; i < books.length; ++i) { + var book = books[i]; + model.append(book); + } + return model; + } + +} + diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index 959bb2b265..253df3295f 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -125,6 +125,7 @@ private slots: void qAbstractItemModel_sections(); void sectionsPositioning(); void sectionsDelegate(); + void sectionPropertyChange(); void cacheBuffer(); void positionViewAtIndex(); void resetModel(); @@ -2095,9 +2096,9 @@ void tst_QQuickListView::sectionsPositioning() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); model.removeItem(5); QTRY_COMPARE(listview->count(), model.count()); - for (int i = 0; i < 3; ++i) { - QQuickItem *item = findItem(contentItem, - "sect_" + (i == 0 ? QString("aaa") : QString::number(i))); + for (int i = 1; i < 3; ++i) { + QQuickItem *item = findVisibleChild(contentItem, + "sect_" + QString::number(i)); QVERIFY(item); QTRY_COMPARE(item->y(), qreal(i*20*6)); } @@ -2135,6 +2136,52 @@ void tst_QQuickListView::sectionsPositioning() delete canvas; } +void tst_QQuickListView::sectionPropertyChange() +{ + QQuickView *canvas = createView(); + + canvas->setSource(testFileUrl("sectionpropertychange.qml")); + canvas->show(); + qApp->processEvents(); + + QQuickListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QQuickItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + // Confirm items positioned correctly + for (int i = 0; i < 2; ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(25. + i*75.)); + } + + QMetaObject::invokeMethod(canvas->rootObject(), "switchGroups"); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + // Confirm items positioned correctly + for (int i = 0; i < 2; ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(25. + i*75.)); + } + + QMetaObject::invokeMethod(canvas->rootObject(), "switchGroups"); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + // Confirm items positioned correctly + for (int i = 0; i < 2; ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(25. + i*75.)); + } + + delete canvas; +} + void tst_QQuickListView::currentIndex_delayedItemCreation() { QFETCH(bool, setCurrentToZero); From 4fc0df58b8458052a818e3e970a97457882808e6 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 24 Feb 2012 13:33:59 +1000 Subject: [PATCH 28/82] Force to send defer deletion events before deleting QQuickCanvas Also change the assert in QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate() to a warning message. Change-Id: Ic1fb7e0b7ffe4a54458a0f3a65127b1afd6dda53 Reviewed-by: Michael Brasser --- src/declarative/qml/qdeclarativeengine.cpp | 3 ++- src/quick/items/qquickcanvas.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 2031bc424a..dca0ef2faf 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -355,7 +355,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate() { - Q_ASSERT(inProgressCreations == 0); + if (inProgressCreations) + qWarning() << QDeclarativeEngine::tr("There are still \"%1\" items in the process of being created at engine destruction.").arg(inProgressCreations); while (cleanup) { QDeclarativeCleanup *c = cleanup; diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index a9df484a98..6b0eb5b96b 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -746,6 +746,7 @@ QQuickCanvas::~QQuickCanvas() QQuickItemPrivate *rootItemPrivate = QQuickItemPrivate::get(d->rootItem); rootItemPrivate->removeFromDirtyList(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); delete d->incubationController; d->incubationController = 0; delete d->rootItem; d->rootItem = 0; From 8e3284135d2be23ca1be79569271f39092d6d6b4 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 27 Feb 2012 17:37:57 +1000 Subject: [PATCH 29/82] Skip test case for now Change-Id: I06128c544c1ee03d4528f6f86fc776e09be87316 Reviewed-by: Bea Lam --- tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp | 2 ++ tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp index cc76b7b401..5765a67b77 100644 --- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp @@ -1272,6 +1272,8 @@ void tst_QQuickGridView::moved_data() void tst_QQuickGridView::multipleChanges() { + QSKIP("QTBUG-24523"); + QFETCH(int, startCount); QFETCH(QList, changes); QFETCH(int, newCount); diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index 253df3295f..04da3f732f 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -5566,6 +5566,8 @@ void tst_QQuickListView::removeTransitions_data() void tst_QQuickListView::multipleTransitions() { + QSKIP("QTBUG-24523"); + // Tests that if you interrupt a transition in progress with another action that // cancels the previous transition, the resulting items are still placed correctly. From cfad9eb4df8b8e389143b138ca4536bca0d163eb Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Mon, 27 Feb 2012 13:01:03 +0100 Subject: [PATCH 30/82] QmlProfiler: send v8 profiling started signal Change-Id: Ie26bd47c9b79a7f524b9c5bc59146be1ea93761d Reviewed-by: Kai Koehne --- src/declarative/debugger/qv8profilerservice.cpp | 14 ++++++++++++++ src/declarative/debugger/qv8profilerservice_p.h | 1 + .../qv8profilerservice/tst_qv8profilerservice.cpp | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/declarative/debugger/qv8profilerservice.cpp b/src/declarative/debugger/qv8profilerservice.cpp index 5ae2d01cc2..7a8a3507cf 100644 --- a/src/declarative/debugger/qv8profilerservice.cpp +++ b/src/declarative/debugger/qv8profilerservice.cpp @@ -187,6 +187,13 @@ void QV8ProfilerService::startProfiling(const QString &title) v8::CpuProfiler::StartProfiling(v8title); d->m_ongoing.append(title); + + // indicate profiling started + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << (int)QV8ProfilerService::V8Started; + + sendMessage(data); } void QV8ProfilerService::stopProfiling(const QString &title) @@ -205,6 +212,13 @@ void QV8ProfilerService::stopProfiling(const QString &title) // can happen at start const v8::CpuProfileNode *rootNode = cpuProfile->GetTopDownRoot(); d->printProfileTree(rootNode); + } else { + // indicate completion, even without data + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << (int)QV8ProfilerService::V8Complete; + + sendMessage(data); } } diff --git a/src/declarative/debugger/qv8profilerservice_p.h b/src/declarative/debugger/qv8profilerservice_p.h index 706907ae23..3762845fd3 100644 --- a/src/declarative/debugger/qv8profilerservice_p.h +++ b/src/declarative/debugger/qv8profilerservice_p.h @@ -85,6 +85,7 @@ class Q_AUTOTEST_EXPORT QV8ProfilerService : public QDeclarativeDebugService V8Complete, V8SnapshotChunk, V8SnapshotComplete, + V8Started, V8MaximumMessage }; diff --git a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp index 92b893afc6..165783fed5 100644 --- a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp +++ b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp @@ -91,6 +91,7 @@ class QV8ProfilerClient : public QDeclarativeDebugClient QList snapshotMessages; signals: + void started(); void complete(); void snapshot(); @@ -158,6 +159,9 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message) case QV8ProfilerService::V8SnapshotComplete: emit snapshot(); break; + case QV8ProfilerService::V8Started: + emit started(); + break; default: QString failMessage = QString("Unknown message type: %1").arg(messageType); QFAIL(qPrintable(failMessage)); @@ -208,6 +212,8 @@ void tst_QV8ProfilerService::blockingConnectWithTraceEnabled() QTRY_COMPARE(m_client->state(), QDeclarativeDebugClient::Enabled); m_client->startProfiling(""); + QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(started())), + "No start signal received in time."); m_client->stopProfiling(""); QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); @@ -225,6 +231,8 @@ void tst_QV8ProfilerService::blockingConnectWithTraceDisabled() QFAIL(qPrintable(failMsg)); } m_client->startProfiling(""); + QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(started())), + "No start signal received in time."); m_client->stopProfiling(""); QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); @@ -236,6 +244,8 @@ void tst_QV8ProfilerService::nonBlockingConnect() QTRY_COMPARE(m_client->state(), QDeclarativeDebugClient::Enabled); m_client->startProfiling(""); + QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(started())), + "No start signal received in time."); m_client->stopProfiling(""); QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); @@ -257,6 +267,8 @@ void tst_QV8ProfilerService::profileOnExit() QTRY_COMPARE(m_client->state(), QDeclarativeDebugClient::Enabled); m_client->startProfiling(""); + QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(started())), + "No start signal received in time."); QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); @@ -270,6 +282,8 @@ void tst_QV8ProfilerService::console() m_client->stopProfiling(""); + QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(started())), + "No start signal received in time."); QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); QVERIFY(!m_client->traceMessages.isEmpty()); From ccd859d2c47e926415c5b1307e84efd4197583c4 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 27 Feb 2012 10:19:01 +1000 Subject: [PATCH 31/82] Skip c++ examples in sgexamples test They should be tested separately, QTBUG-24516 has been raised to implement this. Change-Id: Ic90bc8327e6c07164ed34b3d02f2612561491ec0 Reviewed-by: Michael Brasser --- tests/auto/qtquick2/examples/tst_examples.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/auto/qtquick2/examples/tst_examples.cpp b/tests/auto/qtquick2/examples/tst_examples.cpp index ce8f214efd..e80bfec0e2 100644 --- a/tests/auto/qtquick2/examples/tst_examples.cpp +++ b/tests/auto/qtquick2/examples/tst_examples.cpp @@ -88,10 +88,11 @@ tst_examples::tst_examples() // Add files to exclude here excludedFiles << "doc/src/snippets/declarative/listmodel.qml"; //Just a ListModel, no root QQuickItem - // Add directories you want excluded here - excludedDirs << "examples/shared"; //Not an example - excludedDirs << "examples/qtquick/text/fonts"; // QTBUG-21415 + // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) + excludedDirs << "shared"; //Not an example + excludedDirs << "qtquick/text/fonts"; // QTBUG-21415 excludedDirs << "doc/src/snippets/declarative/path"; //No root QQuickItem + excludedDirs << "tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir // These snippets are not expected to run on their own. excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex"; @@ -99,15 +100,15 @@ tst_examples::tst_examples() excludedDirs << "doc/src/snippets/declarative/imports"; #ifdef QT_NO_WEBKIT - excludedDirs << "examples/qtquick/modelviews/webview"; - excludedDirs << "examples/demos/webbrowser"; + excludedDirs << "qtquick/modelviews/webview"; + excludedDirs << "demos/webbrowser"; excludedDirs << "doc/src/snippets/declarative/webview"; #endif #ifdef QT_NO_XMLPATTERNS - excludedDirs << "examples/demos/twitter"; - excludedDirs << "examples/demos/flickr"; - excludedDirs << "examples/demos/photoviewer"; + excludedDirs << "demos/twitter"; + excludedDirs << "demos/flickr"; + excludedDirs << "demos/photoviewer"; #endif } From 929935dd693058d898b57c98c97cf5e7401c42ec Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 27 Feb 2012 08:40:31 +1000 Subject: [PATCH 32/82] Examples refactor rebase Automatic rebase did not move some new files to where they should have gone. Change-Id: I25515d29d8992acde15db0df1bb5972e35573e60 Reviewed-by: Martin Jones --- examples/declarative/cppextensions/qwidgets/qwidgets.json | 1 - .../cppextensions/imageprovider/imageprovider.json | 0 examples/{declarative => qml}/cppextensions/plugins/plugin.json | 0 .../painteditem/textballoons}/textballoon.json | 0 .../tutorials/extending/chapter6-plugins/chartsplugin.json | 0 5 files changed, 1 deletion(-) delete mode 100644 examples/declarative/cppextensions/qwidgets/qwidgets.json rename examples/{declarative => qml}/cppextensions/imageprovider/imageprovider.json (100%) rename examples/{declarative => qml}/cppextensions/plugins/plugin.json (100%) rename examples/{declarative/painteditem/textballoons/TextBalloonPlugin => qtquick/painteditem/textballoons}/textballoon.json (100%) rename examples/{declarative => }/tutorials/extending/chapter6-plugins/chartsplugin.json (100%) diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.json b/examples/declarative/cppextensions/qwidgets/qwidgets.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.json b/examples/qml/cppextensions/imageprovider/imageprovider.json similarity index 100% rename from examples/declarative/cppextensions/imageprovider/imageprovider.json rename to examples/qml/cppextensions/imageprovider/imageprovider.json diff --git a/examples/declarative/cppextensions/plugins/plugin.json b/examples/qml/cppextensions/plugins/plugin.json similarity index 100% rename from examples/declarative/cppextensions/plugins/plugin.json rename to examples/qml/cppextensions/plugins/plugin.json diff --git a/examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json b/examples/qtquick/painteditem/textballoons/textballoon.json similarity index 100% rename from examples/declarative/painteditem/textballoons/TextBalloonPlugin/textballoon.json rename to examples/qtquick/painteditem/textballoons/textballoon.json diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json b/examples/tutorials/extending/chapter6-plugins/chartsplugin.json similarity index 100% rename from examples/declarative/tutorials/extending/chapter6-plugins/chartsplugin.json rename to examples/tutorials/extending/chapter6-plugins/chartsplugin.json From af42c1821f4be7f0b1032221a9e40be6a87cc43c Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 24 Feb 2012 15:35:46 +1000 Subject: [PATCH 33/82] Don't create unnecessary shadow data Shadow data was being made by accident for uninitialized datums, because they had not yet had the ImageParticle set as the datum owner. Change-Id: Ia1d55610d845627cdb9c83bfda1d7ed4c024f703 Reviewed-by: Michael Brasser --- src/quick/particles/qquickimageparticle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/quick/particles/qquickimageparticle.cpp b/src/quick/particles/qquickimageparticle.cpp index 2936935f3f..83687ae234 100644 --- a/src/quick/particles/qquickimageparticle.cpp +++ b/src/quick/particles/qquickimageparticle.cpp @@ -1237,6 +1237,9 @@ void QQuickImageParticle::clearShadows() //Only call if you need to, may initialize the whole array first time QQuickParticleData* QQuickImageParticle::getShadowDatum(QQuickParticleData* datum) { + //Will return datum if the datum is a sentinel or uninitialized, to centralize that one check + if (datum->systemIndex == -1) + return datum; QQuickParticleGroupData* gd = m_system->groupData[datum->group]; if (!m_shadowData.contains(datum->group)) { QVector data; From 0bf62c44ab5bc53162ef0d7efea38764e2df8318 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Feb 2012 09:48:27 +1000 Subject: [PATCH 34/82] Correctly set duration and easing for AnchorAnimation. Task-number: QTBUG-24532 Change-Id: I3aad9cd8281b954896c2c1d44b2dcae68f913928 Reviewed-by: Yunqiao Yin --- src/quick/items/qquickanimation.cpp | 2 ++ .../tst_qdeclarativeanimations.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/quick/items/qquickanimation.cpp b/src/quick/items/qquickanimation.cpp index 4880190697..641fbb2d37 100644 --- a/src/quick/items/qquickanimation.cpp +++ b/src/quick/items/qquickanimation.cpp @@ -551,6 +551,8 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QDeclarativeStateAction delete data; } + animator->setDuration(d->duration); + animator->setEasingCurve(d->easing); return initInstance(animator); } diff --git a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index c7a0717dd3..348586cea8 100644 --- a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,7 @@ private slots: void pauseBindingBug(); void pauseBug(); void loopingBug(); + void anchorBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1314,6 +1316,19 @@ void tst_qdeclarativeanimations::loopingBug() delete obj; } +//QTBUG-24532 +void tst_qdeclarativeanimations::anchorBug() +{ + QQuickAnchorAnimation animation; + animation.setDuration(5000); + animation.setEasing(QEasingCurve(QEasingCurve::InOutBack)); + animation.start(); + animation.pause(); + + QCOMPARE(animation.qtAnimation()->duration(), 5000); + QCOMPARE(static_cast(animation.qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutBack)); +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" From f2c5c77777b61c8fe54a1107e67283d576301a69 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 27 Feb 2012 15:54:16 +1000 Subject: [PATCH 35/82] Incubators are not async with the threaded renderer. The threaded incubator relies on the event loop spinning to signal item updates. This change ensures that the event loop is processed while items are being created and that the render loop is woken if it is sleeping. Also cancel delegate incubation correctly during destruction. Change-Id: Ib5bb55c788411490e0959c75933da587fdfd4b8c Reviewed-by: Yunqiao Yin Reviewed-by: Michael Brasser --- src/declarative/qml/qdeclarativeincubator.cpp | 7 +++--- src/declarative/qml/qdeclarativeincubator.h | 2 +- src/declarative/qml/qdeclarativevme_p.h | 24 +++++++++---------- src/quick/items/qquickcanvas.cpp | 7 +++--- src/quick/items/qquickitemview.cpp | 6 +++++ src/quick/items/qquickvisualdatamodel.cpp | 21 ++++++++++++++-- src/quick/items/qquickvisualdatamodel_p.h | 1 + src/quick/items/qquickvisualitemmodel_p.h | 1 + src/quick/items/qquickwindowmanager.cpp | 22 +++++++++++++---- src/quick/items/qquickwindowmanager_p.h | 3 ++- 10 files changed, 66 insertions(+), 28 deletions(-) diff --git a/src/declarative/qml/qdeclarativeincubator.cpp b/src/declarative/qml/qdeclarativeincubator.cpp index 38f172f795..6d39fc763a 100644 --- a/src/declarative/qml/qdeclarativeincubator.cpp +++ b/src/declarative/qml/qdeclarativeincubator.cpp @@ -376,17 +376,18 @@ void QDeclarativeIncubationController::incubateFor(int msecs) /*! Incubate objects while the bool pointed to by \a flag is true, or until there are no -more objects to incubate. +more objects to incubate, or up to msecs if msecs is not zero. Generally this method is used in conjunction with a thread or a UNIX signal that sets the bool pointed to by \a flag to false when it wants incubation to be interrupted. */ -void QDeclarativeIncubationController::incubateWhile(bool *flag) +void QDeclarativeIncubationController::incubateWhile(volatile bool *flag, int msecs) { if (!d || d->incubatorCount == 0) return; - QDeclarativeVME::Interrupt i(flag); + QDeclarativeVME::Interrupt i(flag, msecs * 1000000); + i.reset(); do { QDeclarativeIncubatorPrivate *p = (QDeclarativeIncubatorPrivate*)d->incubatorList.first(); p->incubate(i); diff --git a/src/declarative/qml/qdeclarativeincubator.h b/src/declarative/qml/qdeclarativeincubator.h index cabd7e2b28..dca5c3a6bc 100644 --- a/src/declarative/qml/qdeclarativeincubator.h +++ b/src/declarative/qml/qdeclarativeincubator.h @@ -110,7 +110,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeIncubationController int incubatingObjectCount() const; void incubateFor(int msecs); - void incubateWhile(bool *flag); + void incubateWhile(volatile bool *flag, int msecs=0); protected: virtual void incubatingObjectCountChanged(int); diff --git a/src/declarative/qml/qdeclarativevme_p.h b/src/declarative/qml/qdeclarativevme_p.h index d413555847..1f2f861314 100644 --- a/src/declarative/qml/qdeclarativevme_p.h +++ b/src/declarative/qml/qdeclarativevme_p.h @@ -97,7 +97,7 @@ class QDeclarativeVME class Interrupt { public: inline Interrupt(); - inline Interrupt(bool *runWhile); + inline Interrupt(volatile bool *runWhile, int nsecs=0); inline Interrupt(int nsecs); inline void reset(); @@ -105,13 +105,11 @@ class QDeclarativeVME private: enum Mode { None, Time, Flag }; Mode mode; - union { - struct { - QElapsedTimer timer; - int nsecs; - }; - bool *runWhile; + struct { + QElapsedTimer timer; + int nsecs; }; + volatile bool *runWhile; }; QDeclarativeVME() : data(0), componentAttached(0) {} @@ -202,23 +200,23 @@ class QDeclarativeVMEGuard }; QDeclarativeVME::Interrupt::Interrupt() -: mode(None) + : mode(None), nsecs(0), runWhile(0) { } -QDeclarativeVME::Interrupt::Interrupt(bool *runWhile) -: mode(Flag), runWhile(runWhile) +QDeclarativeVME::Interrupt::Interrupt(volatile bool *runWhile, int nsecs) + : mode(Flag), nsecs(nsecs), runWhile(runWhile) { } QDeclarativeVME::Interrupt::Interrupt(int nsecs) -: mode(Time), nsecs(nsecs) + : mode(Time), nsecs(nsecs), runWhile(0) { } void QDeclarativeVME::Interrupt::reset() { - if (mode == Time) + if (mode == Time || nsecs) timer.start(); } @@ -229,7 +227,7 @@ bool QDeclarativeVME::Interrupt::shouldInterrupt() const } else if (mode == Time) { return timer.nsecsElapsed() > nsecs; } else if (mode == Flag) { - return !*runWhile; + return !*runWhile || (nsecs && timer.nsecsElapsed() > nsecs); } else { return false; } diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index 6b0eb5b96b..e6a3e87401 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -94,11 +94,10 @@ class QQuickCanvasIncubationController : public QObject, public QDeclarativeIncu { if (e->type() == QEvent::User) { Q_ASSERT(m_eventSent); - - bool *amtp = m_canvas->windowManager->allowMainThreadProcessing(); + volatile bool *amtp = m_canvas->windowManager->allowMainThreadProcessing(); while (incubatingObjectCount()) { if (amtp) - incubateWhile(amtp); + incubateWhile(amtp, 2); else incubateFor(5); QCoreApplication::processEvents(); @@ -115,6 +114,8 @@ class QQuickCanvasIncubationController : public QObject, public QDeclarativeIncu m_eventSent = true; QCoreApplication::postEvent(this, new QEvent(QEvent::User)); } + // If no animations are running, the renderer may be waiting + m_canvas->windowManager->wakeup(); } private: diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index f62fa94f5e..d5ce567590 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -2162,6 +2162,12 @@ void QQuickItemViewPrivate::clear() createHighlight(); trackedItem = 0; + if (requestedIndex >= 0 && requestedAsync) { + if (model) + model->cancel(requestedIndex); + requestedIndex = -1; + } + markExtentsDirty(); itemCount = 0; } diff --git a/src/quick/items/qquickvisualdatamodel.cpp b/src/quick/items/qquickvisualdatamodel.cpp index 4fdcc98602..0bdf0cb5af 100644 --- a/src/quick/items/qquickvisualdatamodel.cpp +++ b/src/quick/items/qquickvisualdatamodel.cpp @@ -450,6 +450,21 @@ QQuickVisualDataModel::ReleaseFlags QQuickVisualDataModel::release(QQuickItem *i return stat; } +// Cancel a requested async item +void QQuickVisualDataModel::cancel(int index) +{ + Q_D(QQuickVisualDataModel); + if (!d->m_delegate || index < 0 || index >= d->m_compositor.count(d->m_compositorGroup)) { + qWarning() << "VisualDataModel::cancel: index out range" << index << d->m_compositor.count(d->m_compositorGroup); + return; + } + + Compositor::iterator it = d->m_compositor.find(d->m_compositorGroup, index); + QQuickVisualDataModelItem *cacheItem = it->inCache() ? d->m_cache.at(it.cacheIndex) : 0; + if (cacheItem && cacheItem->incubationTask) + d->releaseIncubator(cacheItem->incubationTask); +} + void QQuickVisualDataModelPrivate::group_append( QDeclarativeListProperty *property, QQuickVisualDataGroup *group) { @@ -708,8 +723,10 @@ void QQuickVisualDataModelPrivate::incubatorStatusChanged(QVDMIncubationTask *in incubationTask->incubatingContext = 0; if (!cacheItem->isReferenced()) { int cidx = m_cache.indexOf(cacheItem); - m_compositor.clearFlags(Compositor::Cache, cidx, 1, Compositor::CacheFlag); - m_cache.removeAt(cidx); + if (cidx >= 0) { + m_compositor.clearFlags(Compositor::Cache, cidx, 1, Compositor::CacheFlag); + m_cache.removeAt(cidx); + } delete cacheItem; Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); } diff --git a/src/quick/items/qquickvisualdatamodel_p.h b/src/quick/items/qquickvisualdatamodel_p.h index 54cc16d660..043fcfd8a9 100644 --- a/src/quick/items/qquickvisualdatamodel_p.h +++ b/src/quick/items/qquickvisualdatamodel_p.h @@ -106,6 +106,7 @@ class Q_QUICK_EXPORT QQuickVisualDataModel : public QQuickVisualModel, public QD bool isValid() const { return delegate() != 0; } QQuickItem *item(int index, bool asynchronous=false); ReleaseFlags release(QQuickItem *item); + void cancel(int index); virtual QString stringValue(int index, const QString &role); virtual void setWatchedRoles(QList roles); diff --git a/src/quick/items/qquickvisualitemmodel_p.h b/src/quick/items/qquickvisualitemmodel_p.h index f1c9d066be..7d2b79f718 100644 --- a/src/quick/items/qquickvisualitemmodel_p.h +++ b/src/quick/items/qquickvisualitemmodel_p.h @@ -69,6 +69,7 @@ class Q_QUICK_EXPORT QQuickVisualModel : public QObject virtual bool isValid() const = 0; virtual QQuickItem *item(int index, bool asynchronous=false) = 0; virtual ReleaseFlags release(QQuickItem *item) = 0; + virtual void cancel(int) {} virtual QString stringValue(int, const QString &) = 0; virtual void setWatchedRoles(QList roles) = 0; diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 16b6d92e22..79fd266e1e 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -193,6 +193,7 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui void resize(QQuickCanvas *canvas, const QSize &size); void handleDeferredUpdate(); void maybeUpdate(QQuickCanvas *canvas); + void wakeup(); void startRendering(); void stopRendering(); @@ -202,7 +203,7 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui void initialize(); - bool *allowMainThreadProcessing() { return &allowMainThreadProcessingFlag; } + volatile bool *allowMainThreadProcessing() { return &allowMainThreadProcessingFlag; } bool event(QEvent *); @@ -243,7 +244,7 @@ public slots: QMutex mutex; QWaitCondition condition; - bool allowMainThreadProcessingFlag; + volatile bool allowMainThreadProcessingFlag; int isGuiLocked; uint animationRunning: 1; @@ -299,12 +300,13 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager void paint(QQuickCanvas *canvas); QImage grab(QQuickCanvas *canvas); void resize(QQuickCanvas *canvas, const QSize &size); + void wakeup(); void maybeUpdate(QQuickCanvas *canvas); void releaseResources() { } - bool *allowMainThreadProcessing(); + volatile bool *allowMainThreadProcessing(); QSGContext *sceneGraphContext() const; @@ -1129,6 +1131,14 @@ void QQuickRenderThreadSingleContextWindowManager::maybeUpdate(QQuickCanvas *) } +void QQuickRenderThreadSingleContextWindowManager::wakeup() +{ + lockInGui(); + if (isRenderBlocked) + wake(); + unlockInGui(); +} + QQuickTrivialWindowManager::QQuickTrivialWindowManager() : gl(0) , eventPending(false) @@ -1268,9 +1278,11 @@ void QQuickTrivialWindowManager::maybeUpdate(QQuickCanvas *canvas) } } +void QQuickTrivialWindowManager::wakeup() +{ +} - -bool *QQuickTrivialWindowManager::allowMainThreadProcessing() +volatile bool *QQuickTrivialWindowManager::allowMainThreadProcessing() { return 0; } diff --git a/src/quick/items/qquickwindowmanager_p.h b/src/quick/items/qquickwindowmanager_p.h index 86312655b3..a0bdf08a91 100644 --- a/src/quick/items/qquickwindowmanager_p.h +++ b/src/quick/items/qquickwindowmanager_p.h @@ -64,8 +64,9 @@ class QQuickWindowManager virtual void resize(QQuickCanvas *canvas, const QSize &size) = 0; virtual void maybeUpdate(QQuickCanvas *canvas) = 0; + virtual void wakeup() = 0; - virtual bool *allowMainThreadProcessing() = 0; + virtual volatile bool *allowMainThreadProcessing() = 0; virtual QSGContext *sceneGraphContext() const = 0; From e6c5e06c0879a80ecff01b316a4fc148b3646437 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Tue, 28 Feb 2012 14:04:38 +1000 Subject: [PATCH 36/82] Fix crash in QDeclarativePixmapStore global static dtor Due to the undefined ordering of global static dtors, the QDPS dtor could run after the texture factories were deleted. Thus, the QDPS dtor cannot call the cost() method of the pixmap data during its destructor, as this could cause a crash. Change-Id: I5d23066dc57e1992cf9d1c13d514f06c431bc752 Reviewed-by: Alan Alpert --- src/declarative/qml/qdeclarativeimageprovider.h | 2 +- src/quick/util/qdeclarativepixmapcache.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h index 55a5ca2d23..16af45282c 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.h +++ b/src/declarative/qml/qdeclarativeimageprovider.h @@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextureFactory : public QObject { public: QDeclarativeTextureFactory(); - ~QDeclarativeTextureFactory(); + virtual ~QDeclarativeTextureFactory(); virtual QSGTexture *createTexture(QQuickCanvas *canvas) const = 0; virtual QSize textureSize() const = 0; diff --git a/src/quick/util/qdeclarativepixmapcache.cpp b/src/quick/util/qdeclarativepixmapcache.cpp index 95cbd361b8..1f187a7f03 100644 --- a/src/quick/util/qdeclarativepixmapcache.cpp +++ b/src/quick/util/qdeclarativepixmapcache.cpp @@ -762,6 +762,8 @@ void QDeclarativePixmapStore::unreferencePixmap(QDeclarativePixmapData *data) data->nextUnreferenced = m_unreferencedPixmaps; data->prevUnreferencedPtr = &m_unreferencedPixmaps; + if (!m_destroying) // the texture factories may have been cleaned up already. + m_unreferencedCost += data->cost(); m_unreferencedPixmaps = data; if (m_unreferencedPixmaps->nextUnreferenced) { @@ -772,8 +774,6 @@ void QDeclarativePixmapStore::unreferencePixmap(QDeclarativePixmapData *data) if (!m_lastUnreferencedPixmap) m_lastUnreferencedPixmap = data; - m_unreferencedCost += data->cost(); - shrinkCache(-1); // Shrink the cache incase it has become larger than cache_limit if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying) @@ -810,8 +810,10 @@ void QDeclarativePixmapStore::shrinkCache(int remove) data->prevUnreferencedPtr = 0; data->prevUnreferenced = 0; - remove -= data->cost(); - m_unreferencedCost -= data->cost(); + if (!m_destroying) { + remove -= data->cost(); + m_unreferencedCost -= data->cost(); + } data->removeFromCache(); delete data; } From e38096931ba81bafe6d8737d6fc9737b77ab8723 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 6 Feb 2012 14:05:58 +0100 Subject: [PATCH 37/82] Move distance field util functions to QtGui These distance field generation functions have been moved to QtGui. Change-Id: I78d9015c8776717ede2d1299c2ef3787d165e0b9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/scenegraph/qsgadaptationlayer.cpp | 1 + .../qsgdefaultdistancefieldglyphcache.cpp | 1 + src/quick/scenegraph/qsgpathsimplifier.cpp | 1673 ----------------- src/quick/scenegraph/qsgpathsimplifier_p.h | 68 - src/quick/scenegraph/scenegraph.pri | 2 - .../scenegraph/util/qsgdistancefieldutil.cpp | 714 ------- .../scenegraph/util/qsgdistancefieldutil_p.h | 24 - 7 files changed, 2 insertions(+), 2481 deletions(-) delete mode 100644 src/quick/scenegraph/qsgpathsimplifier.cpp delete mode 100644 src/quick/scenegraph/qsgpathsimplifier_p.h diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 08e85ab8cb..2795d4d9a8 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index ef5b24d1fd..08f05075da 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -41,6 +41,7 @@ #include "qsgdefaultdistancefieldglyphcache_p.h" +#include #include #include diff --git a/src/quick/scenegraph/qsgpathsimplifier.cpp b/src/quick/scenegraph/qsgpathsimplifier.cpp deleted file mode 100644 index 21e5d473f0..0000000000 --- a/src/quick/scenegraph/qsgpathsimplifier.cpp +++ /dev/null @@ -1,1673 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsgpathsimplifier_p.h" - -#include -#include -#include -#include - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -#define Q_FIXED_POINT_SCALE 256 -#define Q_TRIANGULATE_END_OF_POLYGON quint32(-1) - - -namespace { - -//============================================================================// -// QPoint // -//============================================================================// - -inline bool operator < (const QPoint &a, const QPoint &b) -{ - return a.y() < b.y() || (a.y() == b.y() && a.x() < b.x()); -} - -inline bool operator > (const QPoint &a, const QPoint &b) -{ - return b < a; -} - -inline bool operator <= (const QPoint &a, const QPoint &b) -{ - return !(a > b); -} - -inline bool operator >= (const QPoint &a, const QPoint &b) -{ - return !(a < b); -} - -inline int cross(const QPoint &u, const QPoint &v) -{ - return u.x() * v.y() - u.y() * v.x(); -} - -inline int dot(const QPoint &u, const QPoint &v) -{ - return u.x() * v.x() + u.y() * v.y(); -} - -//============================================================================// -// Fraction // -//============================================================================// - -// Fraction must be in the range [0, 1) -struct Fraction -{ - bool isValid() const { return denominator != 0; } - - // numerator and denominator must not have common denominators. - unsigned int numerator, denominator; -}; - -inline unsigned int gcd(unsigned int x, unsigned int y) -{ - while (y != 0) { - unsigned int z = y; - y = x % y; - x = z; - } - return x; -} - -// Fraction must be in the range [0, 1) -// Assume input is valid. -Fraction fraction(unsigned int n, unsigned int d) { - Fraction result; - if (n == 0) { - result.numerator = 0; - result.denominator = 1; - } else { - unsigned int g = gcd(n, d); - result.numerator = n / g; - result.denominator = d / g; - } - return result; -} - -//============================================================================// -// Rational // -//============================================================================// - -struct Rational -{ - bool isValid() const { return fraction.isValid(); } - int integer; - Fraction fraction; -}; - -//============================================================================// -// IntersectionPoint // -//============================================================================// - -struct IntersectionPoint -{ - bool isValid() const { return x.fraction.isValid() && y.fraction.isValid(); } - QPoint round() const; - bool isAccurate() const { return x.fraction.numerator == 0 && y.fraction.numerator == 0; } - - Rational x; // 8:8 signed, 32/32 - Rational y; // 8:8 signed, 32/32 -}; - -QPoint IntersectionPoint::round() const -{ - QPoint result(x.integer, y.integer); - if (2 * x.fraction.numerator >= x.fraction.denominator) - ++result.rx(); - if (2 * y.fraction.numerator >= y.fraction.denominator) - ++result.ry(); - return result; -} - -// Return positive value if 'p' is to the right of the line 'v1'->'v2', negative if left of the -// line and zero if exactly on the line. -// The returned value is the z-component of the qCross product between 'v2-v1' and 'p-v1', -// which is twice the signed area of the triangle 'p'->'v1'->'v2' (positive for CW order). -inline int pointDistanceFromLine(const QPoint &p, const QPoint &v1, const QPoint &v2) -{ - return cross(v2 - v1, p - v1); -} - -IntersectionPoint intersectionPoint(const QPoint &u1, const QPoint &u2, - const QPoint &v1, const QPoint &v2) -{ - IntersectionPoint result = {{0, {0, 0}}, {0, {0, 0}}}; - - QPoint u = u2 - u1; - QPoint v = v2 - v1; - int d1 = cross(u, v1 - u1); - int d2 = cross(u, v2 - u1); - int det = d2 - d1; - int d3 = cross(v, u1 - v1); - int d4 = d3 - det; //qCross(v, u2 - v1); - - // Check that the math is correct. - Q_ASSERT(d4 == cross(v, u2 - v1)); - - // The intersection point can be expressed as: - // v1 - v * d1/det - // v2 - v * d2/det - // u1 + u * d3/det - // u2 + u * d4/det - - // I'm only interested in lines that are crossing, so ignore parallel lines even if they overlap. - if (det == 0) - return result; - - if (det < 0) { - det = -det; - d1 = -d1; - d2 = -d2; - d3 = -d3; - d4 = -d4; - } - - // I'm only interested in lines intersecting at their interior, not at their end points. - // The lines intersect at their interior if and only if 'd1 < 0', 'd2 > 0', 'd3 < 0' and 'd4 > 0'. - if (d1 >= 0 || d2 <= 0 || d3 <= 0 || d4 >= 0) - return result; - - // Calculate the intersection point as follows: - // v1 - v * d1/det | v1 <= v2 (component-wise) - // v2 - v * d2/det | v2 < v1 (component-wise) - - // Assuming 16 bits per vector component. - if (v.x() >= 0) { - result.x.integer = v1.x() + int(qint64(-v.x()) * d1 / det); - result.x.fraction = fraction((unsigned int)(qint64(-v.x()) * d1 % det), (unsigned int)det); - } else { - result.x.integer = v2.x() + int(qint64(-v.x()) * d2 / det); - result.x.fraction = fraction((unsigned int)(qint64(-v.x()) * d2 % det), (unsigned int)det); - } - - if (v.y() >= 0) { - result.y.integer = v1.y() + int(qint64(-v.y()) * d1 / det); - result.y.fraction = fraction((unsigned int)(qint64(-v.y()) * d1 % det), (unsigned int)det); - } else { - result.y.integer = v2.y() + int(qint64(-v.y()) * d2 / det); - result.y.fraction = fraction((unsigned int)(qint64(-v.y()) * d2 % det), (unsigned int)det); - } - - Q_ASSERT(result.x.fraction.isValid()); - Q_ASSERT(result.y.fraction.isValid()); - return result; -} - -//============================================================================// -// PathSimplifier // -//============================================================================// - -class PathSimplifier -{ -public: - PathSimplifier(const QVectorPath &path, QDataBuffer &vertices, - QDataBuffer &indices, const QTransform &matrix); - -private: - struct Element; - - class BoundingVolumeHierarchy - { - public: - struct Node - { - enum Type - { - Leaf, - Split - }; - Type type; - QPoint minimum; - QPoint maximum; - union { - Element *element; // type == Leaf - Node *left; // type == Split - }; - Node *right; - }; - - BoundingVolumeHierarchy(); - ~BoundingVolumeHierarchy(); - void allocate(int nodeCount); - void free(); - Node *newNode(); - - Node *root; - private: - void freeNode(Node *n); - - Node *nodeBlock; - int blockSize; - int firstFree; - }; - - struct Element - { - enum Degree - { - Line = 1, - Quadratic = 2, - Cubic = 3 - }; - - quint32 &upperIndex() { return indices[pointingUp ? degree : 0]; } - quint32 &lowerIndex() { return indices[pointingUp ? 0 : degree]; } - quint32 upperIndex() const { return indices[pointingUp ? degree : 0]; } - quint32 lowerIndex() const { return indices[pointingUp ? 0 : degree]; } - void flip(); - - QPoint middle; - quint32 indices[4]; // index to points - Element *next, *previous; // used in connectElements() - int winding; // used in connectElements() - union { - QRBTree::Node *edgeNode; // used in connectElements() - BoundingVolumeHierarchy::Node *bvhNode; - }; - Degree degree : 8; - uint processed : 1; // initially false, true when the element has been checked for intersections. - uint pointingUp : 1; // used in connectElements() - uint originallyPointingUp : 1; // used in connectElements() - }; - - class ElementAllocator - { - public: - ElementAllocator(); - ~ElementAllocator(); - void allocate(int count); - Element *newElement(); - private: - struct ElementBlock - { - ElementBlock *next; - int blockSize; - int firstFree; - Element elements[1]; - } *blocks; - }; - - struct Event - { - enum Type { Upper, Lower }; - bool operator < (const Event &other) const; - - QPoint point; - Type type; - Element *element; - }; - - typedef QRBTree::Node RBNode; - typedef BoundingVolumeHierarchy::Node BVHNode; - - void initElements(const QVectorPath &path, const QTransform &matrix); - void removeIntersections(); - void connectElements(); - void fillIndices(); - BVHNode *buildTree(Element **elements, int elementCount); - bool intersectNodes(QDataBuffer &elements, BVHNode *elementNode, BVHNode *treeNode); - bool equalElements(const Element *e1, const Element *e2); - bool splitLineAt(QDataBuffer &elements, BVHNode *node, quint32 pointIndex, bool processAgain); - void appendSeparatingAxes(QVarLengthArray &axes, Element *element); - QPair calculateSeparatingAxisRange(const QPoint &axis, Element *element); - void splitCurve(QDataBuffer &elements, BVHNode *node); - bool setElementToQuadratic(Element *element, quint32 pointIndex1, const QPoint &ctrl, quint32 pointIndex2); - bool setElementToCubic(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2); - void setElementToCubicAndSimplify(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2); - RBNode *findElementLeftOf(const Element *element, const QPair &bounds); - bool elementIsLeftOf(const Element *left, const Element *right); - QPair outerBounds(const QPoint &point); - static bool flattenQuadratic(const QPoint &u, const QPoint &v, const QPoint &w); - static bool flattenCubic(const QPoint &u, const QPoint &v, const QPoint &w, const QPoint &q); - static bool splitQuadratic(const QPoint &u, const QPoint &v, const QPoint &w, QPoint *result); - static bool splitCubic(const QPoint &u, const QPoint &v, const QPoint &w, const QPoint &q, QPoint *result); - void subDivQuadratic(const QPoint &u, const QPoint &v, const QPoint &w); - void subDivCubic(const QPoint &u, const QPoint &v, const QPoint &w, const QPoint &q); - static void sortEvents(Event *events, int count); - - ElementAllocator m_elementAllocator; - QDataBuffer m_elements; - QDataBuffer *m_points; - BoundingVolumeHierarchy m_bvh; - QDataBuffer *m_indices; - QRBTree m_elementList; - uint m_hints; -}; - -inline PathSimplifier::BoundingVolumeHierarchy::BoundingVolumeHierarchy() - : root(0) - , nodeBlock(0) - , blockSize(0) - , firstFree(0) -{ -} - -inline PathSimplifier::BoundingVolumeHierarchy::~BoundingVolumeHierarchy() -{ - free(); -} - -inline void PathSimplifier::BoundingVolumeHierarchy::allocate(int nodeCount) -{ - Q_ASSERT(nodeBlock == 0); - Q_ASSERT(firstFree == 0); - nodeBlock = new Node[blockSize = nodeCount]; -} - -inline void PathSimplifier::BoundingVolumeHierarchy::free() -{ - freeNode(root); - delete[] nodeBlock; - nodeBlock = 0; - firstFree = blockSize = 0; - root = 0; -} - -inline PathSimplifier::BVHNode *PathSimplifier::BoundingVolumeHierarchy::newNode() -{ - if (firstFree < blockSize) - return &nodeBlock[firstFree++]; - return new Node; -} - -inline void PathSimplifier::BoundingVolumeHierarchy::freeNode(Node *n) -{ - if (!n) - return; - Q_ASSERT(n->type == Node::Split || n->type == Node::Leaf); - if (n->type == Node::Split) { - freeNode(n->left); - freeNode(n->right); - } - if (!(n >= nodeBlock && n < nodeBlock + blockSize)) - delete n; -} - -inline PathSimplifier::ElementAllocator::ElementAllocator() - : blocks(0) -{ -} - -inline PathSimplifier::ElementAllocator::~ElementAllocator() -{ - while (blocks) { - ElementBlock *block = blocks; - blocks = blocks->next; - free(block); - } -} - -inline void PathSimplifier::ElementAllocator::allocate(int count) -{ - Q_ASSERT(blocks == 0); - Q_ASSERT(count > 0); - blocks = (ElementBlock *)malloc(sizeof(ElementBlock) + (count - 1) * sizeof(Element)); - blocks->blockSize = count; - blocks->next = 0; - blocks->firstFree = 0; -} - -inline PathSimplifier::Element *PathSimplifier::ElementAllocator::newElement() -{ - Q_ASSERT(blocks); - if (blocks->firstFree < blocks->blockSize) - return &blocks->elements[blocks->firstFree++]; - ElementBlock *oldBlock = blocks; - blocks = (ElementBlock *)malloc(sizeof(ElementBlock) + (oldBlock->blockSize - 1) * sizeof(Element)); - blocks->blockSize = oldBlock->blockSize; - blocks->next = oldBlock; - blocks->firstFree = 0; - return &blocks->elements[blocks->firstFree++]; -} - - -inline bool PathSimplifier::Event::operator < (const Event &other) const -{ - if (point == other.point) - return type < other.type; - return other.point < point; -} - -inline void PathSimplifier::Element::flip() -{ - for (int i = 0; i < (degree + 1) >> 1; ++i) { - Q_ASSERT(degree >= Line && degree <= Cubic); - Q_ASSERT(i >= 0 && i < degree); - qSwap(indices[i], indices[degree - i]); - } - pointingUp = !pointingUp; - Q_ASSERT(next == 0 && previous == 0); -} - -PathSimplifier::PathSimplifier(const QVectorPath &path, QDataBuffer &vertices, - QDataBuffer &indices, const QTransform &matrix) - : m_elements(0) - , m_points(&vertices) - , m_indices(&indices) -{ - m_points->reset(); - m_indices->reset(); - initElements(path, matrix); - if (!m_elements.isEmpty()) { - removeIntersections(); - connectElements(); - fillIndices(); - } -} - -void PathSimplifier::initElements(const QVectorPath &path, const QTransform &matrix) -{ - m_hints = path.hints(); - int pathElementCount = path.elementCount(); - if (pathElementCount == 0) - return; - m_elements.reserve(2 * pathElementCount); - m_elementAllocator.allocate(2 * pathElementCount); - m_points->reserve(2 * pathElementCount); - const QPainterPath::ElementType *e = path.elements(); - const qreal *p = path.points(); - if (e) { - qreal x, y; - quint32 moveToIndex = 0; - quint32 previousIndex = 0; - for (int i = 0; i < pathElementCount; ++i, ++e, p += 2) { - switch (*e) { - case QPainterPath::MoveToElement: - { - if (!m_points->isEmpty()) { - const QPoint &from = m_points->at(previousIndex); - const QPoint &to = m_points->at(moveToIndex); - if (from != to) { - Element *element = m_elementAllocator.newElement(); - element->degree = Element::Line; - element->indices[0] = previousIndex; - element->indices[1] = moveToIndex; - element->middle.rx() = (from.x() + to.x()) >> 1; - element->middle.ry() = (from.y() + to.y()) >> 1; - m_elements.add(element); - } - } - previousIndex = moveToIndex = m_points->size(); - matrix.map(p[0], p[1], &x, &y); - QPoint to(qRound(x * Q_FIXED_POINT_SCALE), qRound(y * Q_FIXED_POINT_SCALE)); - m_points->add(to); - } - break; - case QPainterPath::LineToElement: - Q_ASSERT(!m_points->isEmpty()); - { - matrix.map(p[0], p[1], &x, &y); - QPoint to(qRound(x * Q_FIXED_POINT_SCALE), qRound(y * Q_FIXED_POINT_SCALE)); - const QPoint &from = m_points->last(); - if (to != from) { - Element *element = m_elementAllocator.newElement(); - element->degree = Element::Line; - element->indices[0] = previousIndex; - element->indices[1] = quint32(m_points->size()); - element->middle.rx() = (from.x() + to.x()) >> 1; - element->middle.ry() = (from.y() + to.y()) >> 1; - m_elements.add(element); - previousIndex = m_points->size(); - m_points->add(to); - } - } - break; - case QPainterPath::CurveToElement: - Q_ASSERT(i + 2 < pathElementCount); - Q_ASSERT(!m_points->isEmpty()); - Q_ASSERT(e[1] == QPainterPath::CurveToDataElement); - Q_ASSERT(e[2] == QPainterPath::CurveToDataElement); - { - quint32 startPointIndex = previousIndex; - matrix.map(p[4], p[5], &x, &y); - QPoint end(qRound(x * Q_FIXED_POINT_SCALE), qRound(y * Q_FIXED_POINT_SCALE)); - previousIndex = m_points->size(); - m_points->add(end); - - // See if this cubic bezier is really quadratic. - qreal x1 = p[-2] + qreal(1.5) * (p[0] - p[-2]); - qreal y1 = p[-1] + qreal(1.5) * (p[1] - p[-1]); - qreal x2 = p[4] + qreal(1.5) * (p[2] - p[4]); - qreal y2 = p[5] + qreal(1.5) * (p[3] - p[5]); - - Element *element = m_elementAllocator.newElement(); - if (qAbs(x1 - x2) < qreal(1e-3) && qAbs(y1 - y2) < qreal(1e-3)) { - // The bezier curve is quadratic. - matrix.map(x1, y1, &x, &y); - QPoint ctrl(qRound(x * Q_FIXED_POINT_SCALE), - qRound(y * Q_FIXED_POINT_SCALE)); - setElementToQuadratic(element, startPointIndex, ctrl, previousIndex); - } else { - // The bezier curve is cubic. - matrix.map(p[0], p[1], &x, &y); - QPoint ctrl1(qRound(x * Q_FIXED_POINT_SCALE), - qRound(y * Q_FIXED_POINT_SCALE)); - matrix.map(p[2], p[3], &x, &y); - QPoint ctrl2(qRound(x * Q_FIXED_POINT_SCALE), - qRound(y * Q_FIXED_POINT_SCALE)); - setElementToCubicAndSimplify(element, startPointIndex, ctrl1, ctrl2, - previousIndex); - } - m_elements.add(element); - } - i += 2; - e += 2; - p += 4; - - break; - default: - Q_ASSERT_X(0, "QSGPathSimplifier::initialize", "Unexpected element type."); - break; - } - } - if (!m_points->isEmpty()) { - const QPoint &from = m_points->at(previousIndex); - const QPoint &to = m_points->at(moveToIndex); - if (from != to) { - Element *element = m_elementAllocator.newElement(); - element->degree = Element::Line; - element->indices[0] = previousIndex; - element->indices[1] = moveToIndex; - element->middle.rx() = (from.x() + to.x()) >> 1; - element->middle.ry() = (from.y() + to.y()) >> 1; - m_elements.add(element); - } - } - } else { - qreal x, y; - - for (int i = 0; i < pathElementCount; ++i, p += 2) { - matrix.map(p[0], p[1], &x, &y); - QPoint to(qRound(x * Q_FIXED_POINT_SCALE), qRound(y * Q_FIXED_POINT_SCALE)); - if (to != m_points->last()) - m_points->add(to); - } - - while (!m_points->isEmpty() && m_points->last() == m_points->first()) - m_points->pop_back(); - - if (m_points->isEmpty()) - return; - - quint32 prev = quint32(m_points->size() - 1); - for (int i = 0; i < m_points->size(); ++i) { - QPoint &to = m_points->at(i); - QPoint &from = m_points->at(prev); - Element *element = m_elementAllocator.newElement(); - element->degree = Element::Line; - element->indices[0] = prev; - element->indices[1] = quint32(i); - element->middle.rx() = (from.x() + to.x()) >> 1; - element->middle.ry() = (from.y() + to.y()) >> 1; - m_elements.add(element); - prev = i; - } - } - - for (int i = 0; i < m_elements.size(); ++i) - m_elements.at(i)->processed = false; -} - -void PathSimplifier::removeIntersections() -{ - Q_ASSERT(!m_elements.isEmpty()); - QDataBuffer elements(m_elements.size()); - for (int i = 0; i < m_elements.size(); ++i) - elements.add(m_elements.at(i)); - m_bvh.allocate(2 * m_elements.size()); - m_bvh.root = buildTree(elements.data(), elements.size()); - - elements.reset(); - for (int i = 0; i < m_elements.size(); ++i) - elements.add(m_elements.at(i)); - - while (!elements.isEmpty()) { - Element *element = elements.last(); - elements.pop_back(); - BVHNode *node = element->bvhNode; - Q_ASSERT(node->type == BVHNode::Leaf); - Q_ASSERT(node->element == element); - if (!element->processed) { - if (!intersectNodes(elements, node, m_bvh.root)) - element->processed = true; - } - } - - m_bvh.free(); // The bounding volume hierarchy is not needed anymore. -} - -void PathSimplifier::connectElements() -{ - Q_ASSERT(!m_elements.isEmpty()); - QDataBuffer events(m_elements.size() * 2); - for (int i = 0; i < m_elements.size(); ++i) { - Element *element = m_elements.at(i); - element->next = element->previous = 0; - element->winding = 0; - element->edgeNode = 0; - const QPoint &u = m_points->at(element->indices[0]); - const QPoint &v = m_points->at(element->indices[element->degree]); - if (u != v) { - element->pointingUp = element->originallyPointingUp = v < u; - - Event event; - event.element = element; - event.point = u; - event.type = element->pointingUp ? Event::Lower : Event::Upper; - events.add(event); - event.point = v; - event.type = element->pointingUp ? Event::Upper : Event::Lower; - events.add(event); - } - } - QVarLengthArray orderedElements; - if (!events.isEmpty()) - sortEvents(events.data(), events.size()); - while (!events.isEmpty()) { - const Event *event = &events.last(); - QPoint eventPoint = event->point; - - // Find all elements passing through the event point. - QPair bounds = outerBounds(eventPoint); - - // Special case: single element above and single element below event point. - int eventCount = events.size(); - if (event->type == Event::Lower && eventCount > 2) { - QPair range; - range.first = bounds.first ? m_elementList.next(bounds.first) - : m_elementList.front(m_elementList.root); - range.second = bounds.second ? m_elementList.previous(bounds.second) - : m_elementList.back(m_elementList.root); - - const Event *event2 = &events.at(eventCount - 2); - const Event *event3 = &events.at(eventCount - 3); - Q_ASSERT(event2->point == eventPoint); // There are always at least two events at a point. - if (range.first == range.second && event2->type == Event::Upper && event3->point != eventPoint) { - Element *element = event->element; - Element *element2 = event2->element; - element->edgeNode->data = event2->element; - element2->edgeNode = element->edgeNode; - element->edgeNode = 0; - - events.pop_back(); - events.pop_back(); - - if (element2->pointingUp != element->pointingUp) - element2->flip(); - element2->winding = element->winding; - int winding = element->winding; - if (element->originallyPointingUp) - ++winding; - if (winding == 0 || winding == 1) { - if (element->pointingUp) { - element->previous = event2->element; - element2->next = event->element; - } else { - element->next = event2->element; - element2->previous = event->element; - } - } - continue; - } - } - orderedElements.clear(); - - // First, find the ones above the event point. - if (m_elementList.root) { - RBNode *current = bounds.first ? m_elementList.next(bounds.first) - : m_elementList.front(m_elementList.root); - while (current != bounds.second) { - Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - int winding = element->winding; - if (element->originallyPointingUp) - ++winding; - const QPoint &lower = m_points->at(element->lowerIndex()); - if (lower == eventPoint) { - if (winding == 0 || winding == 1) - orderedElements.append(current->data); - } else { - // The element is passing through 'event.point'. - Q_ASSERT(m_points->at(element->upperIndex()) != eventPoint); - Q_ASSERT(element->degree == Element::Line); - // Split the line. - Element *eventElement = event->element; - int indexIndex = (event->type == Event::Upper) == eventElement->pointingUp - ? eventElement->degree : 0; - quint32 pointIndex = eventElement->indices[indexIndex]; - Q_ASSERT(eventPoint == m_points->at(pointIndex)); - - Element *upperElement = m_elementAllocator.newElement(); - *upperElement = *element; - upperElement->lowerIndex() = element->upperIndex() = pointIndex; - upperElement->edgeNode = 0; - element->next = element->previous = 0; - if (upperElement->next) - upperElement->next->previous = upperElement; - else if (upperElement->previous) - upperElement->previous->next = upperElement; - if (element->pointingUp != element->originallyPointingUp) - element->flip(); - if (winding == 0 || winding == 1) - orderedElements.append(upperElement); - m_elements.add(upperElement); - } - current = m_elementList.next(current); - } - } - while (!events.isEmpty() && events.last().point == eventPoint) { - event = &events.last(); - if (event->type == Event::Upper) { - Q_ASSERT(event->point == m_points->at(event->element->upperIndex())); - RBNode *left = findElementLeftOf(event->element, bounds); - RBNode *node = m_elementList.newNode(); - node->data = event->element; - Q_ASSERT(event->element->edgeNode == 0); - event->element->edgeNode = node; - m_elementList.attachAfter(left, node); - } else { - Q_ASSERT(event->type == Event::Lower); - Q_ASSERT(event->point == m_points->at(event->element->lowerIndex())); - Element *element = event->element; - Q_ASSERT(element->edgeNode); - m_elementList.deleteNode(element->edgeNode); - Q_ASSERT(element->edgeNode == 0); - } - events.pop_back(); - } - - if (m_elementList.root) { - RBNode *current = bounds.first ? m_elementList.next(bounds.first) - : m_elementList.front(m_elementList.root); - int winding = bounds.first ? bounds.first->data->winding : 0; - - // Calculate winding numbers and flip elements if necessary. - while (current != bounds.second) { - Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - int ccw = winding & 1; - Q_ASSERT(element->pointingUp == element->originallyPointingUp); - if (element->originallyPointingUp) { - --winding; - } else { - ++winding; - ccw ^= 1; - } - element->winding = winding; - if (ccw == 0) - element->flip(); - current = m_elementList.next(current); - } - - // Pick elements with correct winding number. - current = bounds.second ? m_elementList.previous(bounds.second) - : m_elementList.back(m_elementList.root); - while (current != bounds.first) { - Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - Q_ASSERT(m_points->at(element->upperIndex()) == eventPoint); - int winding = element->winding; - if (element->originallyPointingUp) - ++winding; - if (winding == 0 || winding == 1) - orderedElements.append(current->data); - current = m_elementList.previous(current); - } - } - - if (!orderedElements.isEmpty()) { - Q_ASSERT((orderedElements.size() & 1) == 0); - int i = 0; - Element *firstElement = orderedElements.at(0); - if (m_points->at(firstElement->indices[0]) != eventPoint) { - orderedElements.append(firstElement); - i = 1; - } - for (; i < orderedElements.size(); i += 2) { - Q_ASSERT(i + 1 < orderedElements.size()); - Element *next = orderedElements.at(i); - Element *previous = orderedElements.at(i + 1); - Q_ASSERT(next->previous == 0); - Q_ASSERT(previous->next == 0); - next->previous = previous; - previous->next = next; - } - } - } -#ifndef QT_NO_DEBUG - for (int i = 0; i < m_elements.size(); ++i) { - const Element *element = m_elements.at(i); - Q_ASSERT(element->next == 0 || element->next->previous == element); - Q_ASSERT(element->previous == 0 || element->previous->next == element); - Q_ASSERT((element->next == 0) == (element->previous == 0)); - } -#endif -} - -void PathSimplifier::fillIndices() -{ - for (int i = 0; i < m_elements.size(); ++i) - m_elements.at(i)->processed = false; - for (int i = 0; i < m_elements.size(); ++i) { - Element *element = m_elements.at(i); - if (element->processed || element->next == 0) - continue; - do { - m_indices->add(element->indices[0]); - switch (element->degree) { - case Element::Quadratic: - { - QPoint pts[] = { - m_points->at(element->indices[0]), - m_points->at(element->indices[1]), - m_points->at(element->indices[2]) - }; - subDivQuadratic(pts[0], pts[1], pts[2]); - } - break; - case Element::Cubic: - { - QPoint pts[] = { - m_points->at(element->indices[0]), - m_points->at(element->indices[1]), - m_points->at(element->indices[2]), - m_points->at(element->indices[3]) - }; - subDivCubic(pts[0], pts[1], pts[2], pts[3]); - } - break; - default: - break; - } - Q_ASSERT(element->next); - element->processed = true; - element = element->next; - } while (element != m_elements.at(i)); - m_indices->add(Q_TRIANGULATE_END_OF_POLYGON); - } -} - -PathSimplifier::BVHNode *PathSimplifier::buildTree(Element **elements, int elementCount) -{ - Q_ASSERT(elementCount > 0); - BVHNode *node = m_bvh.newNode(); - if (elementCount == 1) { - Element *element = *elements; - element->bvhNode = node; - node->type = BVHNode::Leaf; - node->element = element; - node->minimum = node->maximum = m_points->at(element->indices[0]); - for (int i = 1; i <= element->degree; ++i) { - const QPoint &p = m_points->at(element->indices[i]); - node->minimum.rx() = qMin(node->minimum.x(), p.x()); - node->minimum.ry() = qMin(node->minimum.y(), p.y()); - node->maximum.rx() = qMax(node->maximum.x(), p.x()); - node->maximum.ry() = qMax(node->maximum.y(), p.y()); - } - return node; - } - - node->type = BVHNode::Split; - - QPoint minimum, maximum; - minimum = maximum = elements[0]->middle; - - for (int i = 1; i < elementCount; ++i) { - const QPoint &p = elements[i]->middle; - minimum.rx() = qMin(minimum.x(), p.x()); - minimum.ry() = qMin(minimum.y(), p.y()); - maximum.rx() = qMax(maximum.x(), p.x()); - maximum.ry() = qMax(maximum.y(), p.y()); - } - - int comp, pivot; - if (maximum.x() - minimum.x() > maximum.y() - minimum.y()) { - comp = 0; - pivot = (maximum.x() + minimum.x()) >> 1; - } else { - comp = 1; - pivot = (maximum.y() + minimum.y()) >> 1; - } - - int lo = 0; - int hi = elementCount - 1; - while (lo < hi) { - while (lo < hi && (&elements[lo]->middle.rx())[comp] <= pivot) - ++lo; - while (lo < hi && (&elements[hi]->middle.rx())[comp] > pivot) - --hi; - if (lo < hi) - qSwap(elements[lo], elements[hi]); - } - - if (lo == elementCount) { - // All points are the same. - Q_ASSERT(minimum.x() == maximum.x() && minimum.y() == maximum.y()); - lo = elementCount >> 1; - } - - node->left = buildTree(elements, lo); - node->right = buildTree(elements + lo, elementCount - lo); - - const BVHNode *left = node->left; - const BVHNode *right = node->right; - node->minimum.rx() = qMin(left->minimum.x(), right->minimum.x()); - node->minimum.ry() = qMin(left->minimum.y(), right->minimum.y()); - node->maximum.rx() = qMax(left->maximum.x(), right->maximum.x()); - node->maximum.ry() = qMax(left->maximum.y(), right->maximum.y()); - - return node; -} - -bool PathSimplifier::intersectNodes(QDataBuffer &elements, BVHNode *elementNode, - BVHNode *treeNode) -{ - if (elementNode->minimum.x() >= treeNode->maximum.x() - || elementNode->minimum.y() >= treeNode->maximum.y() - || elementNode->maximum.x() <= treeNode->minimum.x() - || elementNode->maximum.y() <= treeNode->minimum.y()) - { - return false; - } - - Q_ASSERT(elementNode->type == BVHNode::Leaf); - Element *element = elementNode->element; - Q_ASSERT(!element->processed); - - if (treeNode->type == BVHNode::Leaf) { - Element *nodeElement = treeNode->element; - if (!nodeElement->processed) - return false; - - if (treeNode->element == elementNode->element) - return false; - - if (equalElements(treeNode->element, elementNode->element)) - return false; // element doesn't split itself. - - if (element->degree == Element::Line && nodeElement->degree == Element::Line) { - const QPoint &u1 = m_points->at(element->indices[0]); - const QPoint &u2 = m_points->at(element->indices[1]); - const QPoint &v1 = m_points->at(nodeElement->indices[0]); - const QPoint &v2 = m_points->at(nodeElement->indices[1]); - IntersectionPoint intersection = intersectionPoint(u1, u2, v1, v2); - if (!intersection.isValid()) - return false; - - Q_ASSERT(intersection.x.integer >= qMin(u1.x(), u2.x())); - Q_ASSERT(intersection.y.integer >= qMin(u1.y(), u2.y())); - Q_ASSERT(intersection.x.integer >= qMin(v1.x(), v2.x())); - Q_ASSERT(intersection.y.integer >= qMin(v1.y(), v2.y())); - - Q_ASSERT(intersection.x.integer <= qMax(u1.x(), u2.x())); - Q_ASSERT(intersection.y.integer <= qMax(u1.y(), u2.y())); - Q_ASSERT(intersection.x.integer <= qMax(v1.x(), v2.x())); - Q_ASSERT(intersection.y.integer <= qMax(v1.y(), v2.y())); - - m_points->add(intersection.round()); - splitLineAt(elements, treeNode, m_points->size() - 1, !intersection.isAccurate()); - return splitLineAt(elements, elementNode, m_points->size() - 1, false); - } else { - QVarLengthArray axes; - appendSeparatingAxes(axes, elementNode->element); - appendSeparatingAxes(axes, treeNode->element); - for (int i = 0; i < axes.size(); ++i) { - QPair range1 = calculateSeparatingAxisRange(axes.at(i), elementNode->element); - QPair range2 = calculateSeparatingAxisRange(axes.at(i), treeNode->element); - if (range1.first >= range2.second || range1.second <= range2.first) { - return false; // Separating axis found. - } - } - // Bounding areas overlap. - if (nodeElement->degree > Element::Line) - splitCurve(elements, treeNode); - if (element->degree > Element::Line) { - splitCurve(elements, elementNode); - } else { - // The element was not split, so it can be processed further. - if (intersectNodes(elements, elementNode, treeNode->left)) - return true; - if (intersectNodes(elements, elementNode, treeNode->right)) - return true; - return false; - } - return true; - } - } else { - if (intersectNodes(elements, elementNode, treeNode->left)) - return true; - if (intersectNodes(elements, elementNode, treeNode->right)) - return true; - return false; - } -} - -bool PathSimplifier::equalElements(const Element *e1, const Element *e2) -{ - Q_ASSERT(e1 != e2); - if (e1->degree != e2->degree) - return false; - - // Possibly equal and in the same direction. - bool equalSame = true; - for (int i = 0; i <= e1->degree; ++i) - equalSame &= m_points->at(e1->indices[i]) == m_points->at(e2->indices[i]); - - // Possibly equal and in opposite directions. - bool equalOpposite = true; - for (int i = 0; i <= e1->degree; ++i) - equalOpposite &= m_points->at(e1->indices[e1->degree - i]) == m_points->at(e2->indices[i]); - - return equalSame || equalOpposite; -} - -bool PathSimplifier::splitLineAt(QDataBuffer &elements, BVHNode *node, - quint32 pointIndex, bool processAgain) -{ - Q_ASSERT(node->type == BVHNode::Leaf); - Element *element = node->element; - Q_ASSERT(element->degree == Element::Line); - const QPoint &u = m_points->at(element->indices[0]); - const QPoint &v = m_points->at(element->indices[1]); - const QPoint &p = m_points->at(pointIndex); - if (u == p || v == p) - return false; // No split needed. - - if (processAgain) - element->processed = false; // Needs to be processed again. - - Element *first = node->element; - Element *second = m_elementAllocator.newElement(); - *second = *first; - first->indices[1] = second->indices[0] = pointIndex; - first->middle.rx() = (u.x() + p.x()) >> 1; - first->middle.ry() = (u.y() + p.y()) >> 1; - second->middle.rx() = (v.x() + p.x()) >> 1; - second->middle.ry() = (v.y() + p.y()) >> 1; - m_elements.add(second); - - BVHNode *left = m_bvh.newNode(); - BVHNode *right = m_bvh.newNode(); - left->type = right->type = BVHNode::Leaf; - left->element = first; - right->element = second; - left->minimum = right->minimum = node->minimum; - left->maximum = right->maximum = node->maximum; - if (u.x() < v.x()) - left->maximum.rx() = right->minimum.rx() = p.x(); - else - left->minimum.rx() = right->maximum.rx() = p.x(); - if (u.y() < v.y()) - left->maximum.ry() = right->minimum.ry() = p.y(); - else - left->minimum.ry() = right->maximum.ry() = p.y(); - left->element->bvhNode = left; - right->element->bvhNode = right; - - node->type = BVHNode::Split; - node->left = left; - node->right = right; - - if (!first->processed) { - elements.add(left->element); - elements.add(right->element); - } - return true; -} - -void PathSimplifier::appendSeparatingAxes(QVarLengthArray &axes, Element *element) -{ - switch (element->degree) { - case Element::Cubic: - { - const QPoint &u = m_points->at(element->indices[0]); - const QPoint &v = m_points->at(element->indices[1]); - const QPoint &w = m_points->at(element->indices[2]); - const QPoint &q = m_points->at(element->indices[3]); - QPoint ns[] = { - QPoint(u.y() - v.y(), v.x() - u.x()), - QPoint(v.y() - w.y(), w.x() - v.x()), - QPoint(w.y() - q.y(), q.x() - w.x()), - QPoint(q.y() - u.y(), u.x() - q.x()), - QPoint(u.y() - w.y(), w.x() - u.x()), - QPoint(v.y() - q.y(), q.x() - v.x()) - }; - for (int i = 0; i < 6; ++i) { - if (ns[i].x() || ns[i].y()) - axes.append(ns[i]); - } - } - break; - case Element::Quadratic: - { - const QPoint &u = m_points->at(element->indices[0]); - const QPoint &v = m_points->at(element->indices[1]); - const QPoint &w = m_points->at(element->indices[2]); - QPoint ns[] = { - QPoint(u.y() - v.y(), v.x() - u.x()), - QPoint(v.y() - w.y(), w.x() - v.x()), - QPoint(w.y() - u.y(), u.x() - w.x()) - }; - for (int i = 0; i < 3; ++i) { - if (ns[i].x() || ns[i].y()) - axes.append(ns[i]); - } - } - break; - case Element::Line: - { - const QPoint &u = m_points->at(element->indices[0]); - const QPoint &v = m_points->at(element->indices[1]); - QPoint n(u.y() - v.y(), v.x() - u.x()); - if (n.x() || n.y()) - axes.append(n); - } - break; - default: - Q_ASSERT_X(0, "QSGPathSimplifier::appendSeparatingAxes", "Unexpected element type."); - break; - } -} - -QPair PathSimplifier::calculateSeparatingAxisRange(const QPoint &axis, Element *element) -{ - QPair range(0x7fffffff, -0x7fffffff); - for (int i = 0; i <= element->degree; ++i) { - const QPoint &p = m_points->at(element->indices[i]); - int dist = dot(axis, p); - range.first = qMin(range.first, dist); - range.second = qMax(range.second, dist); - } - return range; -} - -void PathSimplifier::splitCurve(QDataBuffer &elements, BVHNode *node) -{ - Q_ASSERT(node->type == BVHNode::Leaf); - - Element *first = node->element; - Element *second = m_elementAllocator.newElement(); - *second = *first; - m_elements.add(second); - Q_ASSERT(first->degree > Element::Line); - - bool accurate = true; - const QPoint &u = m_points->at(first->indices[0]); - const QPoint &v = m_points->at(first->indices[1]); - const QPoint &w = m_points->at(first->indices[2]); - - if (first->degree == Element::Quadratic) { - QPoint pts[3]; - accurate = splitQuadratic(u, v, w, pts); - int pointIndex = m_points->size(); - m_points->add(pts[1]); - accurate &= setElementToQuadratic(first, first->indices[0], pts[0], pointIndex); - accurate &= setElementToQuadratic(second, pointIndex, pts[2], second->indices[2]); - } else { - Q_ASSERT(first->degree == Element::Cubic); - const QPoint &q = m_points->at(first->indices[3]); - QPoint pts[5]; - accurate = splitCubic(u, v, w, q, pts); - int pointIndex = m_points->size(); - m_points->add(pts[2]); - accurate &= setElementToCubic(first, first->indices[0], pts[0], pts[1], pointIndex); - accurate &= setElementToCubic(second, pointIndex, pts[3], pts[4], second->indices[3]); - } - - if (!accurate) - first->processed = second->processed = false; // Needs to be processed again. - - BVHNode *left = m_bvh.newNode(); - BVHNode *right = m_bvh.newNode(); - left->type = right->type = BVHNode::Leaf; - left->element = first; - right->element = second; - - left->minimum.rx() = left->minimum.ry() = right->minimum.rx() = right->minimum.ry() = INT_MAX; - left->maximum.rx() = left->maximum.ry() = right->maximum.rx() = right->maximum.ry() = INT_MIN; - - for (int i = 0; i <= first->degree; ++i) { - QPoint &p = m_points->at(first->indices[i]); - left->minimum.rx() = qMin(left->minimum.x(), p.x()); - left->minimum.ry() = qMin(left->minimum.y(), p.y()); - left->maximum.rx() = qMax(left->maximum.x(), p.x()); - left->maximum.ry() = qMax(left->maximum.y(), p.y()); - } - for (int i = 0; i <= second->degree; ++i) { - QPoint &p = m_points->at(second->indices[i]); - right->minimum.rx() = qMin(right->minimum.x(), p.x()); - right->minimum.ry() = qMin(right->minimum.y(), p.y()); - right->maximum.rx() = qMax(right->maximum.x(), p.x()); - right->maximum.ry() = qMax(right->maximum.y(), p.y()); - } - left->element->bvhNode = left; - right->element->bvhNode = right; - - node->type = BVHNode::Split; - node->left = left; - node->right = right; - - if (!first->processed) { - elements.add(left->element); - elements.add(right->element); - } -} - -bool PathSimplifier::setElementToQuadratic(Element *element, quint32 pointIndex1, - const QPoint &ctrl, quint32 pointIndex2) -{ - const QPoint &p1 = m_points->at(pointIndex1); - const QPoint &p2 = m_points->at(pointIndex2); - if (flattenQuadratic(p1, ctrl, p2)) { - // Insert line. - element->degree = Element::Line; - element->indices[0] = pointIndex1; - element->indices[1] = pointIndex2; - element->middle.rx() = (p1.x() + p2.x()) >> 1; - element->middle.ry() = (p1.y() + p2.y()) >> 1; - return false; - } else { - // Insert bezier. - element->degree = Element::Quadratic; - element->indices[0] = pointIndex1; - element->indices[1] = m_points->size(); - element->indices[2] = pointIndex2; - element->middle.rx() = (p1.x() + ctrl.x() + p2.x()) / 3; - element->middle.ry() = (p1.y() + ctrl.y() + p2.y()) / 3; - m_points->add(ctrl); - return true; - } -} - -bool PathSimplifier::setElementToCubic(Element *element, quint32 pointIndex1, const QPoint &v, - const QPoint &w, quint32 pointIndex2) -{ - const QPoint &u = m_points->at(pointIndex1); - const QPoint &q = m_points->at(pointIndex2); - if (flattenCubic(u, v, w, q)) { - // Insert line. - element->degree = Element::Line; - element->indices[0] = pointIndex1; - element->indices[1] = pointIndex2; - element->middle.rx() = (u.x() + q.x()) >> 1; - element->middle.ry() = (u.y() + q.y()) >> 1; - return false; - } else { - // Insert bezier. - element->degree = Element::Cubic; - element->indices[0] = pointIndex1; - element->indices[1] = m_points->size(); - element->indices[2] = m_points->size() + 1; - element->indices[3] = pointIndex2; - element->middle.rx() = (u.x() + v.x() + w.x() + q.x()) >> 2; - element->middle.ry() = (u.y() + v.y() + w.y() + q.y()) >> 2; - m_points->add(v); - m_points->add(w); - return true; - } -} - -void PathSimplifier::setElementToCubicAndSimplify(Element *element, quint32 pointIndex1, - const QPoint &v, const QPoint &w, - quint32 pointIndex2) -{ - const QPoint &u = m_points->at(pointIndex1); - const QPoint &q = m_points->at(pointIndex2); - if (flattenCubic(u, v, w, q)) { - // Insert line. - element->degree = Element::Line; - element->indices[0] = pointIndex1; - element->indices[1] = pointIndex2; - element->middle.rx() = (u.x() + q.x()) >> 1; - element->middle.ry() = (u.y() + q.y()) >> 1; - return; - } - - bool intersecting = (u == q) || intersectionPoint(u, v, w, q).isValid(); - if (!intersecting) { - // Insert bezier. - element->degree = Element::Cubic; - element->indices[0] = pointIndex1; - element->indices[1] = m_points->size(); - element->indices[2] = m_points->size() + 1; - element->indices[3] = pointIndex2; - element->middle.rx() = (u.x() + v.x() + w.x() + q.x()) >> 2; - element->middle.ry() = (u.y() + v.y() + w.y() + q.y()) >> 2; - m_points->add(v); - m_points->add(w); - return; - } - - QPoint pts[5]; - splitCubic(u, v, w, q, pts); - int pointIndex = m_points->size(); - m_points->add(pts[2]); - Element *element2 = m_elementAllocator.newElement(); - m_elements.add(element2); - setElementToCubicAndSimplify(element, pointIndex1, pts[0], pts[1], pointIndex); - setElementToCubicAndSimplify(element2, pointIndex, pts[3], pts[4], pointIndex2); -} - -PathSimplifier::RBNode *PathSimplifier::findElementLeftOf(const Element *element, - const QPair &bounds) -{ - if (!m_elementList.root) - return 0; - RBNode *current = bounds.first; - Q_ASSERT(!current || !elementIsLeftOf(element, current->data)); - if (!current) - current = m_elementList.front(m_elementList.root); - Q_ASSERT(current); - RBNode *result = 0; - while (current != bounds.second && !elementIsLeftOf(element, current->data)) { - result = current; - current = m_elementList.next(current); - } - return result; -} - -bool PathSimplifier::elementIsLeftOf(const Element *left, const Element *right) -{ - const QPoint &leftU = m_points->at(left->upperIndex()); - const QPoint &leftL = m_points->at(left->lowerIndex()); - const QPoint &rightU = m_points->at(right->upperIndex()); - const QPoint &rightL = m_points->at(right->lowerIndex()); - Q_ASSERT(leftL >= rightU && rightL >= leftU); - if (leftU.x() < qMin(rightL.x(), rightU.x())) - return true; - if (leftU.x() > qMax(rightL.x(), rightU.x())) - return false; - int d = pointDistanceFromLine(leftU, rightL, rightU); - // d < 0: left, d > 0: right, d == 0: on top - if (d == 0) { - d = pointDistanceFromLine(leftL, rightL, rightU); - if (d == 0) { - if (right->degree > Element::Line) { - d = pointDistanceFromLine(leftL, rightL, m_points->at(right->indices[1])); - if (d == 0) - d = pointDistanceFromLine(leftL, rightL, m_points->at(right->indices[2])); - } else if (left->degree > Element::Line) { - d = pointDistanceFromLine(m_points->at(left->indices[1]), rightL, rightU); - if (d == 0) - d = pointDistanceFromLine(m_points->at(left->indices[2]), rightL, rightU); - } - } - } - return d < 0; -} - -QPair PathSimplifier::outerBounds(const QPoint &point) -{ - RBNode *current = m_elementList.root; - QPair result(0, 0); - - while (current) { - const Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - const QPoint &v1 = m_points->at(element->lowerIndex()); - const QPoint &v2 = m_points->at(element->upperIndex()); - Q_ASSERT(point >= v2 && point <= v1); - if (point == v1 || point == v2) - break; - int d = pointDistanceFromLine(point, v1, v2); - if (d == 0) { - if (element->degree == Element::Line) - break; - d = pointDistanceFromLine(point, v1, m_points->at(element->indices[1])); - if (d == 0) - d = pointDistanceFromLine(point, v1, m_points->at(element->indices[2])); - Q_ASSERT(d != 0); - } - if (d < 0) { - result.second = current; - current = current->left; - } else { - result.first = current; - current = current->right; - } - } - - if (!current) - return result; - - RBNode *mid = current; - - current = mid->left; - while (current) { - const Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - const QPoint &v1 = m_points->at(element->lowerIndex()); - const QPoint &v2 = m_points->at(element->upperIndex()); - Q_ASSERT(point >= v2 && point <= v1); - bool equal = (point == v1 || point == v2); - if (!equal) { - int d = pointDistanceFromLine(point, v1, v2); - Q_ASSERT(d >= 0); - equal = (d == 0 && element->degree == Element::Line); - } - if (equal) { - current = current->left; - } else { - result.first = current; - current = current->right; - } - } - - current = mid->right; - while (current) { - const Element *element = current->data; - Q_ASSERT(element->edgeNode == current); - const QPoint &v1 = m_points->at(element->lowerIndex()); - const QPoint &v2 = m_points->at(element->upperIndex()); - Q_ASSERT(point >= v2 && point <= v1); - bool equal = (point == v1 || point == v2); - if (!equal) { - int d = pointDistanceFromLine(point, v1, v2); - Q_ASSERT(d <= 0); - equal = (d == 0 && element->degree == Element::Line); - } - if (equal) { - current = current->right; - } else { - result.second = current; - current = current->left; - } - } - - return result; -} - -inline bool PathSimplifier::flattenQuadratic(const QPoint &u, const QPoint &v, const QPoint &w) -{ - QPoint deltas[2] = { v - u, w - v }; - int d = qAbs(cross(deltas[0], deltas[1])); - int l = qAbs(deltas[0].x()) + qAbs(deltas[0].y()) + qAbs(deltas[1].x()) + qAbs(deltas[1].y()); - return d < (Q_FIXED_POINT_SCALE * Q_FIXED_POINT_SCALE * 3 / 2) || l <= Q_FIXED_POINT_SCALE * 2; -} - -inline bool PathSimplifier::flattenCubic(const QPoint &u, const QPoint &v, - const QPoint &w, const QPoint &q) -{ - QPoint deltas[] = { v - u, w - v, q - w, q - u }; - int d = qAbs(cross(deltas[0], deltas[1])) + qAbs(cross(deltas[1], deltas[2])) - + qAbs(cross(deltas[0], deltas[3])) + qAbs(cross(deltas[3], deltas[2])); - int l = qAbs(deltas[0].x()) + qAbs(deltas[0].y()) + qAbs(deltas[1].x()) + qAbs(deltas[1].y()) - + qAbs(deltas[2].x()) + qAbs(deltas[2].y()); - return d < (Q_FIXED_POINT_SCALE * Q_FIXED_POINT_SCALE * 3) || l <= Q_FIXED_POINT_SCALE * 2; -} - -inline bool PathSimplifier::splitQuadratic(const QPoint &u, const QPoint &v, - const QPoint &w, QPoint *result) -{ - result[0] = u + v; - result[2] = v + w; - result[1] = result[0] + result[2]; - bool accurate = ((result[0].x() | result[0].y() | result[2].x() | result[2].y()) & 1) == 0 - && ((result[1].x() | result[1].y()) & 3) == 0; - result[0].rx() >>= 1; - result[0].ry() >>= 1; - result[1].rx() >>= 2; - result[1].ry() >>= 2; - result[2].rx() >>= 1; - result[2].ry() >>= 1; - return accurate; -} - -inline bool PathSimplifier::splitCubic(const QPoint &u, const QPoint &v, - const QPoint &w, const QPoint &q, QPoint *result) -{ - result[0] = u + v; - result[2] = v + w; - result[4] = w + q; - result[1] = result[0] + result[2]; - result[3] = result[2] + result[4]; - result[2] = result[1] + result[3]; - bool accurate = ((result[0].x() | result[0].y() | result[4].x() | result[4].y()) & 1) == 0 - && ((result[1].x() | result[1].y() | result[3].x() | result[3].y()) & 3) == 0 - && ((result[2].x() | result[2].y()) & 7) == 0; - result[0].rx() >>= 1; - result[0].ry() >>= 1; - result[1].rx() >>= 2; - result[1].ry() >>= 2; - result[2].rx() >>= 3; - result[2].ry() >>= 3; - result[3].rx() >>= 2; - result[3].ry() >>= 2; - result[4].rx() >>= 1; - result[4].ry() >>= 1; - return accurate; -} - -inline void PathSimplifier::subDivQuadratic(const QPoint &u, const QPoint &v, const QPoint &w) -{ - if (flattenQuadratic(u, v, w)) - return; - QPoint pts[3]; - splitQuadratic(u, v, w, pts); - subDivQuadratic(u, pts[0], pts[1]); - m_indices->add(m_points->size()); - m_points->add(pts[1]); - subDivQuadratic(pts[1], pts[2], w); -} - -inline void PathSimplifier::subDivCubic(const QPoint &u, const QPoint &v, - const QPoint &w, const QPoint &q) -{ - if (flattenCubic(u, v, w, q)) - return; - QPoint pts[5]; - splitCubic(u, v, w, q, pts); - subDivCubic(u, pts[0], pts[1], pts[2]); - m_indices->add(m_points->size()); - m_points->add(pts[2]); - subDivCubic(pts[2], pts[3], pts[4], q); -} - -void PathSimplifier::sortEvents(Event *events, int count) -{ - // Bucket sort + insertion sort. - Q_ASSERT(count > 0); - QDataBuffer buffer(count); - buffer.resize(count); - QScopedArrayPointer bins(new int[count]); - int counts[0x101]; - memset(counts, 0, sizeof(counts)); - - int minimum, maximum; - minimum = maximum = events[0].point.y(); - for (int i = 1; i < count; ++i) { - minimum = qMin(minimum, events[i].point.y()); - maximum = qMax(maximum, events[i].point.y()); - } - - for (int i = 0; i < count; ++i) { - bins[i] = ((maximum - events[i].point.y()) << 8) / (maximum - minimum + 1); - Q_ASSERT(bins[i] >= 0 && bins[i] < 0x100); - ++counts[bins[i]]; - } - - for (int i = 1; i < 0x100; ++i) - counts[i] += counts[i - 1]; - counts[0x100] = counts[0xff]; - Q_ASSERT(counts[0x100] == count); - - for (int i = 0; i < count; ++i) - buffer.at(--counts[bins[i]]) = events[i]; - - int j = 0; - for (int i = 0; i < 0x100; ++i) { - for (; j < counts[i + 1]; ++j) { - int k = j; - while (k > 0 && (buffer.at(j) < events[k - 1])) { - events[k] = events[k - 1]; - --k; - } - events[k] = buffer.at(j); - } - } -} - -} // end anonymous namespace - - -void qSimplifyPath(const QVectorPath &path, QDataBuffer &vertices, - QDataBuffer &indices, const QTransform &matrix) -{ - PathSimplifier(path, vertices, indices, matrix); -} - -void qSimplifyPath(const QPainterPath &path, QDataBuffer &vertices, - QDataBuffer &indices, const QTransform &matrix) -{ - qSimplifyPath(qtVectorPathForPath(path), vertices, indices, matrix); -} - - -QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgpathsimplifier_p.h b/src/quick/scenegraph/qsgpathsimplifier_p.h deleted file mode 100644 index e60dc4fe37..0000000000 --- a/src/quick/scenegraph/qsgpathsimplifier_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSGPATHSIMPLIFIER_P_H -#define QSGPATHSIMPLIFIER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// The returned vertices are in 8:8 fixed point format. The path is assumed to be in the range (-128, 128)x(-128, 128). -void qSimplifyPath(const QVectorPath &path, QDataBuffer &vertices, QDataBuffer &indices, const QTransform &matrix = QTransform()); -void qSimplifyPath(const QPainterPath &path, QDataBuffer &vertices, QDataBuffer &indices, const QTransform &matrix = QTransform()); - -QT_END_NAMESPACE - -#endif diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index dae4a3b8a8..f5fa18f87a 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -64,7 +64,6 @@ HEADERS += \ $$PWD/qsgdefaultimagenode_p.h \ $$PWD/qsgdefaultrectanglenode_p.h \ $$PWD/qsgflashnode_p.h \ - $$PWD/qsgpathsimplifier_p.h \ $$PWD/qsgshareddistancefieldglyphcache_p.h SOURCES += \ @@ -79,7 +78,6 @@ SOURCES += \ $$PWD/qsgdefaultimagenode.cpp \ $$PWD/qsgdefaultrectanglenode.cpp \ $$PWD/qsgflashnode.cpp \ - $$PWD/qsgpathsimplifier.cpp \ $$PWD/qsgshareddistancefieldglyphcache.cpp diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp index be4673bdca..a8d73ed7d1 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp @@ -41,8 +41,6 @@ #include "qsgdistancefieldutil_p.h" -#include -#include #include #include #include @@ -64,718 +62,6 @@ static float defaultAntialiasingSpreadFunc(float glyphScale) return range / glyphScale; } -namespace -{ - enum FillHDir - { - LeftToRight, - RightToLeft - }; - - enum FillVDir - { - TopDown, - BottomUp - }; - - enum FillClip - { - NoClip, - Clip - }; -} - -template -inline void fillLine(qint32 *, int, int, int, qint32, qint32) -{ -} - -template <> -inline void fillLine(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd) -{ - int fromX = qMax(0, lx >> 8); - int toX = qMin(width, rx >> 8); - int x = toX - fromX; - if (x <= 0) - return; - qint32 val = d + (((fromX << 8) + 0xff - lx) * dd >> 8); - line += fromX; - do { - *line = abs(val) < abs(*line) ? val : *line; - val += dd; - ++line; - } while (--x); -} - -template <> -inline void fillLine(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd) -{ - int fromX = qMax(0, lx >> 8); - int toX = qMin(width, rx >> 8); - int x = toX - fromX; - if (x <= 0) - return; - qint32 val = d + (((toX << 8) + 0xff - rx) * dd >> 8); - line += toX; - do { - val -= dd; - --line; - *line = abs(val) < abs(*line) ? val : *line; - } while (--x); -} - -template <> -inline void fillLine(qint32 *line, int, int lx, int rx, qint32 d, qint32 dd) -{ - int fromX = lx >> 8; - int toX = rx >> 8; - int x = toX - fromX; - if (x <= 0) - return; - qint32 val = d + ((~lx & 0xff) * dd >> 8); - line += fromX; - do { - *line = abs(val) < abs(*line) ? val : *line; - val += dd; - ++line; - } while (--x); -} - -template <> -inline void fillLine(qint32 *line, int, int lx, int rx, qint32 d, qint32 dd) -{ - int fromX = lx >> 8; - int toX = rx >> 8; - int x = toX - fromX; - if (x <= 0) - return; - qint32 val = d + ((~rx & 0xff) * dd >> 8); - line += toX; - do { - val -= dd; - --line; - *line = abs(val) < abs(*line) ? val : *line; - } while (--x); -} - -template -inline void fillLines(qint32 *bits, int width, int height, int upperY, int lowerY, - int &lx, int ldx, int &rx, int rdx, qint32 &d, qint32 ddy, qint32 ddx) -{ - Q_UNUSED(height); - Q_ASSERT(upperY < lowerY); - int y = lowerY - upperY; - if (vDir == TopDown) { - qint32 *line = bits + upperY * width; - do { - fillLine(line, width, lx, rx, d, ddx); - lx += ldx; - d += ddy; - rx += rdx; - line += width; - } while (--y); - } else { - qint32 *line = bits + lowerY * width; - do { - lx -= ldx; - d -= ddy; - rx -= rdx; - line -= width; - fillLine(line, width, lx, rx, d, ddx); - } while (--y); - } -} - -template -void drawTriangle(qint32 *bits, int width, int height, const QPoint *center, - const QPoint *v1, const QPoint *v2, qint32 value) -{ - const int y1 = clip == Clip ? qBound(0, v1->y() >> 8, height) : v1->y() >> 8; - const int y2 = clip == Clip ? qBound(0, v2->y() >> 8, height) : v2->y() >> 8; - const int yC = clip == Clip ? qBound(0, center->y() >> 8, height) : center->y() >> 8; - - const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v2->y() & 0xff; - const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v1->y() & 0xff; - const int centerFrac = clip == Clip ? (yC << 8) + 0xff - center->y() : ~center->y() & 0xff; - - int dx1 = 0, x1 = 0, dx2 = 0, x2 = 0; - qint32 dd1, d1, dd2, d2; - if (v1->y() != center->y()) { - dx1 = ((v1->x() - center->x()) << 8) / (v1->y() - center->y()); - x1 = center->x() + centerFrac * (v1->x() - center->x()) / (v1->y() - center->y()); - } - if (v2->y() != center->y()) { - dx2 = ((v2->x() - center->x()) << 8) / (v2->y() - center->y()); - x2 = center->x() + centerFrac * (v2->x() - center->x()) / (v2->y() - center->y()); - } - - const qint32 div = (v2->x() - center->x()) * (v1->y() - center->y()) - - (v2->y() - center->y()) * (v1->x() - center->x()); - const qint32 dd = div ? qint32((qint64(value * (v1->y() - v2->y())) << 8) / div) : 0; - - if (y2 < yC) { - if (y1 < yC) { - // Center at the bottom. - if (y2 < y1) { - // y2 < y1 < yC - // Long right edge. - d1 = centerFrac * value / (v1->y() - center->y()); - dd1 = ((value << 8) / (v1->y() - center->y())); - fillLines(bits, width, height, y1, yC, x1, dx1, - x2, dx2, d1, dd1, dd); - dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y2, y1, x1, dx1, - x2, dx2, value, 0, dd); - } else { - // y1 <= y2 < yC - // Long left edge. - d2 = centerFrac * value / (v2->y() - center->y()); - dd2 = ((value << 8) / (v2->y() - center->y())); - fillLines(bits, width, height, y2, yC, x1, dx1, - x2, dx2, d2, dd2, dd); - if (y1 != y2) { - dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y1, y2, x1, dx1, - x2, dx2, value, 0, dd); - } - } - } else { - // y2 < yC <= y1 - // Center to the right. - int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - int xUp, xDn; - xUp = xDn = v2->x() + (clip == Clip ? (yC << 8) + 0xff - v2->y() - : (center->y() | 0xff) - v2->y()) - * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y2, yC, xUp, dx, - x2, dx2, value, 0, dd); - if (yC != y1) - fillLines(bits, width, height, yC, y1, xDn, dx, - x1, dx1, value, 0, dd); - } - } else { - if (y1 < yC) { - // y1 < yC <= y2 - // Center to the left. - int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - int xUp, xDn; - xUp = xDn = v1->x() + (clip == Clip ? (yC << 8) + 0xff - v1->y() - : (center->y() | 0xff) - v1->y()) - * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y1, yC, x1, dx1, - xUp, dx, value, 0, dd); - if (yC != y2) - fillLines(bits, width, height, yC, y2, x2, dx2, - xDn, dx, value, 0, dd); - } else { - // Center at the top. - if (y2 < y1) { - // yC <= y2 < y1 - // Long right edge. - if (yC != y2) { - d2 = centerFrac * value / (v2->y() - center->y()); - dd2 = ((value << 8) / (v2->y() - center->y())); - fillLines(bits, width, height, yC, y2, x2, dx2, - x1, dx1, d2, dd2, dd); - } - dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y2, y1, x2, dx2, - x1, dx1, value, 0, dd); - } else { - // Long left edge. - // yC <= y1 <= y2 - if (yC != y1) { - d1 = centerFrac * value / (v1->y() - center->y()); - dd1 = ((value << 8) / (v1->y() - center->y())); - fillLines(bits, width, height, yC, y1, x2, dx2, - x1, dx1, d1, dd1, dd); - } - if (y1 != y2) { - dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y()); - x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y()); - fillLines(bits, width, height, y1, y2, x2, dx2, - x1, dx1, value, 0, dd); - } - } - } - } -} - -template -void drawRectangle(qint32 *bits, int width, int height, - const QPoint *int1, const QPoint *center1, const QPoint *ext1, - const QPoint *int2, const QPoint *center2, const QPoint *ext2, - qint32 extValue) -{ - if (center1->y() > center2->y()) { - qSwap(center1, center2); - qSwap(int1, ext2); - qSwap(ext1, int2); - extValue = -extValue; - } - - Q_ASSERT(ext1->x() - center1->x() == center1->x() - int1->x()); - Q_ASSERT(ext1->y() - center1->y() == center1->y() - int1->y()); - Q_ASSERT(ext2->x() - center2->x() == center2->x() - int2->x()); - Q_ASSERT(ext2->y() - center2->y() == center2->y() - int2->y()); - - const int yc1 = clip == Clip ? qBound(0, center1->y() >> 8, height) : center1->y() >> 8; - const int yc2 = clip == Clip ? qBound(0, center2->y() >> 8, height) : center2->y() >> 8; - const int yi1 = clip == Clip ? qBound(0, int1->y() >> 8, height) : int1->y() >> 8; - const int yi2 = clip == Clip ? qBound(0, int2->y() >> 8, height) : int2->y() >> 8; - const int ye1 = clip == Clip ? qBound(0, ext1->y() >> 8, height) : ext1->y() >> 8; - const int ye2 = clip == Clip ? qBound(0, ext2->y() >> 8, height) : ext2->y() >> 8; - - const int center1Frac = clip == Clip ? (yc1 << 8) + 0xff - center1->y() : ~center1->y() & 0xff; - const int center2Frac = clip == Clip ? (yc2 << 8) + 0xff - center2->y() : ~center2->y() & 0xff; - const int int1Frac = clip == Clip ? (yi1 << 8) + 0xff - int1->y() : ~int1->y() & 0xff; - const int ext1Frac = clip == Clip ? (ye1 << 8) + 0xff - ext1->y() : ~ext1->y() & 0xff; - - int dxC = 0, dxE = 0; // cap slope, edge slope - qint32 ddC = 0; - if (ext1->y() != int1->y()) { - dxC = ((ext1->x() - int1->x()) << 8) / (ext1->y() - int1->y()); - ddC = (extValue << 9) / (ext1->y() - int1->y()); - } - if (ext1->y() != ext2->y()) - dxE = ((ext1->x() - ext2->x()) << 8) / (ext1->y() - ext2->y()); - - const qint32 div = (ext1->x() - int1->x()) * (ext2->y() - int1->y()) - - (ext1->y() - int1->y()) * (ext2->x() - int1->x()); - const qint32 dd = div ? qint32((qint64(extValue * (ext2->y() - ext1->y())) << 9) / div) : 0; - - int xe1, xe2, xc1, xc2; - qint32 d; - - qint32 intValue = -extValue; - - if (center2->x() < center1->x()) { - // Leaning to the right. '/' - if (int1->y() < ext2->y()) { - // Mostly vertical. - Q_ASSERT(ext1->y() != ext2->y()); - xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - if (ye1 != yi1) { - xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc2 += (ye1 - yc1) * dxC; - fillLines(bits, width, height, ye1, yi1, xe1, dxE, - xc2, dxC, extValue, 0, dd); - } - if (yi1 != ye2) - fillLines(bits, width, height, yi1, ye2, xe1, dxE, - xe2, dxE, extValue, 0, dd); - if (ye2 != yi2) { - xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc1 += (ye2 - yc2) * dxC; - fillLines(bits, width, height, ye2, yi2, xc1, dxC, - xe2, dxE, intValue, 0, dd); - } - } else { - // Mostly horizontal. - Q_ASSERT(ext1->y() != int1->y()); - xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc1 += (ye2 - yc2) * dxC; - xc2 += (ye1 - yc1) * dxC; - if (ye1 != ye2) { - xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - fillLines(bits, width, height, ye1, ye2, xe1, dxE, - xc2, dxC, extValue, 0, dd); - } - if (ye2 != yi1) { - d = (clip == Clip ? (ye2 << 8) + 0xff - center2->y() - : (ext2->y() | 0xff) - center2->y()) - * 2 * extValue / (ext1->y() - int1->y()); - fillLines(bits, width, height, ye2, yi1, xc1, dxC, - xc2, dxC, d, ddC, dd); - } - if (yi1 != yi2) { - xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - fillLines(bits, width, height, yi1, yi2, xc1, dxC, - xe2, dxE, intValue, 0, dd); - } - } - } else { - // Leaning to the left. '\' - if (ext1->y() < int2->y()) { - // Mostly vertical. - Q_ASSERT(ext1->y() != ext2->y()); - xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - if (yi1 != ye1) { - xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc1 += (yi1 - yc1) * dxC; - fillLines(bits, width, height, yi1, ye1, xc1, dxC, - xe2, dxE, intValue, 0, dd); - } - if (ye1 != yi2) - fillLines(bits, width, height, ye1, yi2, xe1, dxE, - xe2, dxE, intValue, 0, dd); - if (yi2 != ye2) { - xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc2 += (yi2 - yc2) * dxC; - fillLines(bits, width, height, yi2, ye2, xe1, dxE, - xc2, dxC, extValue, 0, dd); - } - } else { - // Mostly horizontal. - Q_ASSERT(ext1->y() != int1->y()); - xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y()); - xc1 += (yi1 - yc1) * dxC; - xc2 += (yi2 - yc2) * dxC; - if (yi1 != yi2) { - xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - fillLines(bits, width, height, yi1, yi2, xc1, dxC, - xe2, dxE, intValue, 0, dd); - } - if (yi2 != ye1) { - d = (clip == Clip ? (yi2 << 8) + 0xff - center2->y() - : (int2->y() | 0xff) - center2->y()) - * 2 * extValue / (ext1->y() - int1->y()); - fillLines(bits, width, height, yi2, ye1, xc1, dxC, - xc2, dxC, d, ddC, dd); - } - if (ye1 != ye2) { - xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y()); - fillLines(bits, width, height, ye1, ye2, xe1, dxE, - xc2, dxC, extValue, 0, dd); - } - } - } -} - -static void drawPolygons(qint32 *bits, int width, int height, const QPoint *vertices, - const quint32 *indices, int indexCount, qint32 value) -{ - Q_ASSERT(indexCount != 0); - Q_ASSERT(height <= 128); - QVarLengthArray scans[128]; - int first = 0; - for (int i = 1; i < indexCount; ++i) { - quint32 idx1 = indices[i - 1]; - quint32 idx2 = indices[i]; - Q_ASSERT(idx1 != quint32(-1)); - if (idx2 == quint32(-1)) { - idx2 = indices[first]; - Q_ASSERT(idx2 != quint32(-1)); - first = ++i; - } - const QPoint *v1 = &vertices[idx1]; - const QPoint *v2 = &vertices[idx2]; - if (v2->y() < v1->y()) - qSwap(v1, v2); - int fromY = qMax(0, v1->y() >> 8); - int toY = qMin(height, v2->y() >> 8); - if (fromY >= toY) - continue; - int dx = ((v2->x() - v1->x()) << 8) / (v2->y() - v1->y()); - int x = v1->x() + ((fromY << 8) + 0xff - v1->y()) * (v2->x() - v1->x()) / (v2->y() - v1->y()); - for (int y = fromY; y < toY; ++y) { - quint32 c = quint32(x >> 8); - if (c < quint32(width)) - scans[y].append(quint8(c)); - x += dx; - } - } - for (int i = 0; i < height; ++i) { - quint8 *scanline = scans[i].data(); - int size = scans[i].size(); - for (int j = 1; j < size; ++j) { - int k = j; - quint8 value = scanline[k]; - for (; k != 0 && value < scanline[k - 1]; --k) - scanline[k] = scanline[k - 1]; - scanline[k] = value; - } - qint32 *line = bits + i * width; - int j = 0; - for (; j + 1 < size; j += 2) { - for (quint8 x = scanline[j]; x < scanline[j + 1]; ++x) - line[x] = value; - } - if (j < size) { - for (int x = scanline[j]; x < width; ++x) - line[x] = value; - } - } -} - -static QImage makeDistanceField(int imgSize, const QPainterPath &path, int dfScale, int offs) -{ - QImage image(imgSize, imgSize, QImage::Format_Indexed8); - - if (path.isEmpty()) { - image.fill(0); - return image; - } - - QTransform transform; - transform.translate(offs, offs); - transform.scale(qreal(1) / dfScale, qreal(1) / dfScale); - - QDataBuffer pathIndices(0); - QDataBuffer pathVertices(0); - qSimplifyPath(path, pathVertices, pathIndices, transform); - - const qint32 interiorColor = -0x7f80; // 8:8 signed format, -127.5 - const qint32 exteriorColor = 0x7f80; // 8:8 signed format, 127.5 - - QScopedArrayPointer bits(new qint32[imgSize * imgSize]); - for (int i = 0; i < imgSize * imgSize; ++i) - bits[i] = exteriorColor; - - const qreal angleStep = qreal(15 * 3.141592653589793238 / 180); - const QPoint rotation(qRound(cos(angleStep) * 0x4000), - qRound(sin(angleStep) * 0x4000)); // 2:14 signed - - const quint32 *indices = pathIndices.data(); - QVarLengthArray normals; - QVarLengthArray vertices; - QVarLengthArray isConvex; - QVarLengthArray needsClipping; - - drawPolygons(bits.data(), imgSize, imgSize, pathVertices.data(), indices, pathIndices.size(), - interiorColor); - - int index = 0; - - while (index < pathIndices.size()) { - normals.clear(); - vertices.clear(); - needsClipping.clear(); - - // Find end of polygon. - int end = index; - while (indices[end] != quint32(-1)) - ++end; - - // Calculate vertex normals. - for (int next = index, prev = end - 1; next < end; prev = next++) { - quint32 fromVertexIndex = indices[prev]; - quint32 toVertexIndex = indices[next]; - - const QPoint &from = pathVertices.at(fromVertexIndex); - const QPoint &to = pathVertices.at(toVertexIndex); - - QPoint n(to.y() - from.y(), from.x() - to.x()); - if (n.x() == 0 && n.y() == 0) - continue; - int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16 - n.rx() = n.x() * scale >> 8; - n.ry() = n.y() * scale >> 8; - normals.append(n); - QPoint v(to.x() + 0x7f, to.y() + 0x7f); - vertices.append(v); - needsClipping.append((to.x() < offs << 8) || (to.x() >= (imgSize - offs) << 8) - || (to.y() < offs << 8) || (to.y() >= (imgSize - offs) << 8)); - } - - isConvex.resize(normals.count()); - for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) { - isConvex[prev] = normals.at(prev).x() * normals.at(next).y() - - normals.at(prev).y() * normals.at(next).x() < 0; - } - - // Draw quads. - for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) { - QPoint n = normals.at(next); - QPoint intPrev = vertices.at(prev); - QPoint extPrev = vertices.at(prev); - QPoint intNext = vertices.at(next); - QPoint extNext = vertices.at(next); - - extPrev.rx() -= n.x(); - extPrev.ry() -= n.y(); - intPrev.rx() += n.x(); - intPrev.ry() += n.y(); - extNext.rx() -= n.x(); - extNext.ry() -= n.y(); - intNext.rx() += n.x(); - intNext.ry() += n.y(); - - if (needsClipping[prev] || needsClipping[next]) { - drawRectangle(bits.data(), imgSize, imgSize, - &intPrev, &vertices.at(prev), &extPrev, - &intNext, &vertices.at(next), &extNext, - exteriorColor); - } else { - drawRectangle(bits.data(), imgSize, imgSize, - &intPrev, &vertices.at(prev), &extPrev, - &intNext, &vertices.at(next), &extNext, - exteriorColor); - } - - if (isConvex.at(prev)) { - QPoint p = extPrev; - if (needsClipping[prev]) { - for (;;) { - QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14, - (n.y() * rotation.x() + n.x() * rotation.y()) >> 14); - n = rn; - if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0) { - p.rx() = vertices.at(prev).x() - normals.at(prev).x(); - p.ry() = vertices.at(prev).y() - normals.at(prev).y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &extPrev, &p, exteriorColor); - break; - } - - p.rx() = vertices.at(prev).x() - n.x(); - p.ry() = vertices.at(prev).y() - n.y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &extPrev, &p, exteriorColor); - extPrev = p; - } - } else { - for (;;) { - QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14, - (n.y() * rotation.x() + n.x() * rotation.y()) >> 14); - n = rn; - if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0) { - p.rx() = vertices.at(prev).x() - normals.at(prev).x(); - p.ry() = vertices.at(prev).y() - normals.at(prev).y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &extPrev, &p, exteriorColor); - break; - } - - p.rx() = vertices.at(prev).x() - n.x(); - p.ry() = vertices.at(prev).y() - n.y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &extPrev, &p, exteriorColor); - extPrev = p; - } - } - } else { - QPoint p = intPrev; - if (needsClipping[prev]) { - for (;;) { - QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14, - (n.y() * rotation.x() - n.x() * rotation.y()) >> 14); - n = rn; - if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0) { - p.rx() = vertices.at(prev).x() + normals.at(prev).x(); - p.ry() = vertices.at(prev).y() + normals.at(prev).y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &p, &intPrev, interiorColor); - break; - } - - p.rx() = vertices.at(prev).x() + n.x(); - p.ry() = vertices.at(prev).y() + n.y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &p, &intPrev, interiorColor); - intPrev = p; - } - } else { - for (;;) { - QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14, - (n.y() * rotation.x() - n.x() * rotation.y()) >> 14); - n = rn; - if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0) { - p.rx() = vertices.at(prev).x() + normals.at(prev).x(); - p.ry() = vertices.at(prev).y() + normals.at(prev).y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &p, &intPrev, interiorColor); - break; - } - - p.rx() = vertices.at(prev).x() + n.x(); - p.ry() = vertices.at(prev).y() + n.y(); - drawTriangle(bits.data(), imgSize, imgSize, &vertices.at(prev), - &p, &intPrev, interiorColor); - intPrev = p; - } - } - } - } - - index = end + 1; - } - - const qint32 *inLine = bits.data(); - uchar *outLine = image.bits(); - int padding = image.bytesPerLine() - image.width(); - for (int y = 0; y < imgSize; ++y) { - for (int x = 0; x < imgSize; ++x, ++inLine, ++outLine) - *outLine = uchar((0x7f80 - *inLine) >> 8); - outLine += padding; - } - - return image; -} - -bool qt_fontHasNarrowOutlines(const QRawFont &f) -{ - QRawFont font = f; - font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); - Q_ASSERT(font.isValid()); - - QVector glyphIndices = font.glyphIndexesForString(QLatin1String("O")); - if (glyphIndices.size() < 1) - return false; - - QImage im = font.alphaMapForGlyph(glyphIndices.at(0), QRawFont::PixelAntialiasing); - if (im.isNull()) - return false; - - int minHThick = 999; - int minVThick = 999; - - int thick = 0; - bool in = false; - int y = (im.height() + 1) / 2; - for (int x = 0; x < im.width(); ++x) { - int a = qAlpha(im.pixel(x, y)); - if (a > 127) { - in = true; - ++thick; - } else if (in) { - in = false; - minHThick = qMin(minHThick, thick); - thick = 0; - } - } - - thick = 0; - in = false; - int x = (im.width() + 1) / 2; - for (int y = 0; y < im.height(); ++y) { - int a = qAlpha(im.pixel(x, y)); - if (a > 127) { - in = true; - ++thick; - } else if (in) { - in = false; - minVThick = qMin(minVThick, thick); - thick = 0; - } - } - - return minHThick == 1 || minVThick == 1; -} - -QImage qt_renderDistanceFieldGlyph(const QRawFont &font, glyph_t glyph, bool doubleResolution) -{ - QRawFont renderFont = font; - renderFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(doubleResolution) * QT_DISTANCEFIELD_SCALE(doubleResolution)); - - QPainterPath path = renderFont.pathForGlyph(glyph); - path.translate(-path.boundingRect().topLeft()); - path.setFillRule(Qt::WindingFill); - - QImage im = makeDistanceField(QT_DISTANCEFIELD_TILESIZE(doubleResolution), - path, - QT_DISTANCEFIELD_SCALE(doubleResolution), - QT_DISTANCEFIELD_RADIUS(doubleResolution) / QT_DISTANCEFIELD_SCALE(doubleResolution)); - return im; -} - QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager(QSGContext *c) : sgCtx(c) , m_threshold_func(defaultThresholdFunc) diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h index 23da1d121f..bc1dbc2c72 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h @@ -48,33 +48,9 @@ QT_BEGIN_NAMESPACE -#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54 -#define QT_DISTANCEFIELD_DEFAULT_TILESIZE 64 -#define QT_DISTANCEFIELD_DEFAULT_SCALE 16 -#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80 -#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000 - -#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE) -#define QT_DISTANCEFIELD_TILESIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_TILESIZE) -#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \ - QT_DISTANCEFIELD_DEFAULT_SCALE) -#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \ - QT_DISTANCEFIELD_DEFAULT_RADIUS) - - typedef float (*ThresholdFunc)(float glyphScale); typedef float (*AntialiasingSpreadFunc)(float glyphScale); -bool qt_fontHasNarrowOutlines(const QRawFont &f); -QImage qt_renderDistanceFieldGlyph(const QRawFont &font, glyph_t glyph, bool doubleResolution); - - class QOpenGLShaderProgram; class QSGDistanceFieldGlyphCache; class QSGContext; From f7dae3960b2ab6f5db3a79e3ea701f2531b909d7 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 14 Feb 2012 09:33:42 +1000 Subject: [PATCH 38/82] Add AnimatedSprite A simpler sprite image element for the simple usecase. Because sometimes an engine with stochastic capabilities is overkill. Change-Id: I2b76c5d417719e92a548f6266bffd563dc016983 Reviewed-by: Alan Alpert --- .../{simplesprite.qml => animatedsprite.qml} | 29 +- src/quick/items/items.pri | 2 + src/quick/items/qquickanimatedsprite.cpp | 613 ++++++++++++++++++ src/quick/items/qquickanimatedsprite_p.h | 373 +++++++++++ src/quick/items/qquickitemsmodule.cpp | 2 + src/quick/items/qquicksprite_p.h | 1 + .../qquickanimatedsprite/data/basic.qml | 58 ++ .../data/squarefacesprite.png | Bin 0 -> 496 bytes .../qquickanimatedsprite.pro | 15 + .../tst_qquickanimatedsprite.cpp | 83 +++ tests/auto/qtquick2/qtquick2.pro | 1 + 11 files changed, 1170 insertions(+), 7 deletions(-) rename examples/qtquick/imageelements/{simplesprite.qml => animatedsprite.qml} (78%) create mode 100644 src/quick/items/qquickanimatedsprite.cpp create mode 100644 src/quick/items/qquickanimatedsprite_p.h create mode 100644 tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml create mode 100644 tests/auto/qtquick2/qquickanimatedsprite/data/squarefacesprite.png create mode 100644 tests/auto/qtquick2/qquickanimatedsprite/qquickanimatedsprite.pro create mode 100644 tests/auto/qtquick2/qquickanimatedsprite/tst_qquickanimatedsprite.cpp diff --git a/examples/qtquick/imageelements/simplesprite.qml b/examples/qtquick/imageelements/animatedsprite.qml similarity index 78% rename from examples/qtquick/imageelements/simplesprite.qml rename to examples/qtquick/imageelements/animatedsprite.qml index f619913bfc..3a597bba71 100644 --- a/examples/qtquick/imageelements/simplesprite.qml +++ b/examples/qtquick/imageelements/animatedsprite.qml @@ -46,14 +46,29 @@ Item { anchors.fill: parent color: "white" } - SpriteImage { + AnimatedSprite { + id: sprite anchors.fill: parent - Sprite{ - source: "content/speaker.png" - frames: 60 - frameSync: true - frameWidth: 170 - frameHeight: 170 + source: "content/speaker.png" + frameCount: 60 + frameSync: true + frameWidth: 170 + frameHeight: 170 + loops: 3 + } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (!sprite.running) + sprite.start(); + if (!sprite.paused) + sprite.pause(); + if ( mouse.button == Qt.LeftButton ) { + sprite.advance(1); + } else { + sprite.advance(-1); + } } } } diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index f02c769c3a..bdd1692e85 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -66,6 +66,7 @@ HEADERS += \ $$PWD/qquickspriteengine_p.h \ $$PWD/qquicksprite_p.h \ $$PWD/qquickspriteimage_p.h \ + $$PWD/qquickanimatedsprite_p.h \ $$PWD/qquickdrag_p.h \ $$PWD/qquickdroparea_p.h \ $$PWD/qquickmultipointtoucharea_p.h \ @@ -117,6 +118,7 @@ SOURCES += \ $$PWD/qquickspriteengine.cpp \ $$PWD/qquicksprite.cpp \ $$PWD/qquickspriteimage.cpp \ + $$PWD/qquickanimatedsprite.cpp \ $$PWD/qquickaccessibleattached.cpp \ $$PWD/qquickdrag.cpp \ $$PWD/qquickdroparea.cpp \ diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp new file mode 100644 index 0000000000..ef79d052a8 --- /dev/null +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -0,0 +1,613 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickanimatedsprite_p.h" +#include "qquicksprite_p.h" +#include "qquickspriteengine_p.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const char vertexShaderCode[] = + "attribute highp vec2 vTex;\n" + "uniform highp vec3 animData;// w,h(premultiplied of anim), interpolation progress\n" + "uniform highp vec4 animPos;//x,y, x,y (two frames for interpolation)\n" + "uniform highp vec2 size;//w,h of element\n" + "\n" + "uniform highp mat4 qt_Matrix;\n" + "\n" + "varying highp vec4 fTexS;\n" + "varying lowp float progress;\n" + "\n" + "\n" + "void main() {\n" + " progress = animData.z;\n" + " //Calculate frame location in texture\n" + " fTexS.xy = animPos.xy + vTex.xy * animData.xy;\n" + " //Next frame is also passed, for interpolation\n" + " fTexS.zw = animPos.zw + vTex.xy * animData.xy;\n" + "\n" + " gl_Position = qt_Matrix * vec4(size.x * vTex.x, size.y * vTex.y, 0, 1);\n" + "}\n"; + +static const char fragmentShaderCode[] = + "uniform sampler2D texture;\n" + "uniform lowp float qt_Opacity;\n" + "\n" + "varying highp vec4 fTexS;\n" + "varying lowp float progress;\n" + "\n" + "void main() {\n" + " gl_FragColor = mix(texture2D(texture, fTexS.xy), texture2D(texture, fTexS.zw), progress) * qt_Opacity;\n" + "}\n"; + +class QQuickAnimatedSpriteMaterial : public QSGMaterial +{ +public: + QQuickAnimatedSpriteMaterial(); + ~QQuickAnimatedSpriteMaterial(); + virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; } + virtual QSGMaterialShader *createShader() const; + virtual int compare(const QSGMaterial *other) const + { + return this - static_cast(other); + } + + QSGTexture *texture; + + float animT; + float animX1; + float animY1; + float animX2; + float animY2; + float animW; + float animH; + float elementWidth; + float elementHeight; +}; + +QQuickAnimatedSpriteMaterial::QQuickAnimatedSpriteMaterial() + : texture(0) + , animT(0.0f) + , animX1(0.0f) + , animY1(0.0f) + , animX2(0.0f) + , animY2(0.0f) + , animW(1.0f) + , animH(1.0f) + , elementWidth(1.0f) + , elementHeight(1.0f) +{ + setFlag(Blending, true); +} + +QQuickAnimatedSpriteMaterial::~QQuickAnimatedSpriteMaterial() +{ + delete texture; +} + +class AnimatedSpriteMaterialData : public QSGMaterialShader +{ +public: + AnimatedSpriteMaterialData(const char * /* vertexFile */ = 0, const char * /* fragmentFile */ = 0) + { + } + + void deactivate() { + QSGMaterialShader::deactivate(); + + for (int i=0; i<8; ++i) { + program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0); + } + } + + virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) + { + QQuickAnimatedSpriteMaterial *m = static_cast(newEffect); + m->texture->bind(); + + program()->setUniformValue(m_opacity_id, state.opacity()); + program()->setUniformValue(m_animData_id, m->animW, m->animH, m->animT); + program()->setUniformValue(m_animPos_id, m->animX1, m->animY1, m->animX2, m->animY2); + program()->setUniformValue(m_size_id, m->elementWidth, m->elementHeight); + + if (state.isMatrixDirty()) + program()->setUniformValue(m_matrix_id, state.combinedMatrix()); + } + + virtual void initialize() { + m_matrix_id = program()->uniformLocation("qt_Matrix"); + m_opacity_id = program()->uniformLocation("qt_Opacity"); + m_animData_id = program()->uniformLocation("animData"); + m_animPos_id = program()->uniformLocation("animPos"); + m_size_id = program()->uniformLocation("size"); + } + + virtual const char *vertexShader() const { return vertexShaderCode; } + virtual const char *fragmentShader() const { return fragmentShaderCode; } + + virtual char const *const *attributeNames() const { + static const char *attr[] = { + "vTex", + 0 + }; + return attr; + } + + int m_matrix_id; + int m_opacity_id; + int m_animData_id; + int m_animPos_id; + int m_size_id; + + static float chunkOfBytes[1024]; +}; + +float AnimatedSpriteMaterialData::chunkOfBytes[1024]; + +QSGMaterialShader *QQuickAnimatedSpriteMaterial::createShader() const +{ + return new AnimatedSpriteMaterialData; +} + +struct AnimatedSpriteVertex { + float tx; + float ty; +}; + +struct AnimatedSpriteVertices { + AnimatedSpriteVertex v1; + AnimatedSpriteVertex v2; + AnimatedSpriteVertex v3; + AnimatedSpriteVertex v4; +}; + +/*! + \qmlclass AnimatedSprite QQuickAnimatedSprite + \inqmlmodule QtQuick 2 + \inherits Item + \brief The AnimatedSprite element draws a sprite animation +*/ + +/*! + \qmlproperty bool QtQuick2::AnimatedSprite::running + + Whether the sprite is animating or not. + + Default is true +*/ + +/*! + \qmlproperty bool QtQuick2::AnimatedSprite::interpolate + + If true, interpolation will occur between sprite frames to make the + animation appear smoother. + + Default is true. +*/ + +/*! + \qmlproperty qreal QtQuick2::AnimatedSprite::frameRate + + Frames per second to show in the animation. Values below 0 are invalid. + + If frameRate is valid then it will be used to calculate the duration of the frames. + If not, and frameDuration is valid , then frameDuration will be used. +*/ + +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameDuration + + Duration of each frame of the animation. Values below 0 are invalid. + + If frameRate is valid then it will be used to calculate the duration of the frames. + If not, and frameDuration is valid, then frameDuration will be used. +*/ + +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameCount + + Number of frames in this AnimatedSprite. +*/ +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameHeight + + Height of a single frame in this AnimatedSprite. + + May be omitted if it is the only sprite in the file. +*/ +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameWidth + + Width of a single frame in this AnimatedSprite. + + May be omitted if it is the only sprite in the file. +*/ +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameX + + The X coordinate in the image file of the first frame of the AnimatedSprite. + + May be omitted if the first frame starts in the upper left corner of the file. +*/ +/*! + \qmlproperty int QtQuick2::AnimatedSprite::frameY + + The Y coordinate in the image file of the first frame of the AnimatedSprite. + + May be omitted if the first frame starts in the upper left corner of the file. +*/ +/*! + \qmlproperty url QtQuick2::AnimatedSprite::source + + The image source for the animation. + + If frameHeight and frameWidth are not specified, it is assumed to be a single long row of square frames. + Otherwise, it can be multiple contiguous rows or rectangluar frames, when one row runs out the next will be used. + + If frameX and frameY are specified, the row of frames will be taken with that x/y coordinate as the upper left corner. +*/ + +/*! + \qmlproperty bool QtQuick2::AnimatedSprite::reverse + + If true, then the animation will be played in reverse. + + Default is false. +*/ + +/*! + \qmlproperty bool QtQuick2::AnimatedSprite::frameSync + + If true, then the animation will have no duration. Instead, the animation will advance + one frame each time a frame is rendered to the screen. This syncronizes it with the painting + rate as opposed to elapsed time. + + If frameSync is set to true, it overrides both frameRate and frameDuration. + + Default is false. +*/ + +/*! + \qmlproperty int QtQuick2::AnimatedSprite::loops + + After playing the animation this many times, the animation will automatically stop. Negative values are invalid. + + If this is set to AnimatedSprite.Infinite the animation will not stop playing on its own. + + Default is AnimatedSprite.Infinite +*/ + +/*! + \qmlproperty bool QtQuick2::AnimatedSprite::paused + + When paused, the current frame can be advanced manually. + + Default is false. +*/ + +/*! + \qmlproperty int QtQuick2::AnimatedSprite::currentFrame + + When paused, the current frame can be advanced manually by setting this property or calling advance(). + +*/ + +//TODO: Implicitly size element to size of sprite +QQuickAnimatedSprite::QQuickAnimatedSprite(QQuickItem *parent) : + QQuickItem(parent) + , m_node(0) + , m_material(0) + , m_sprite(new QQuickSprite) + , m_spriteEngine(0) + , m_curFrame(0) + , m_pleaseReset(false) + , m_running(true) + , m_paused(false) + , m_interpolate(true) + , m_loops(-1) + , m_curLoop(0) + , m_pauseOffset(0) +{ + setFlag(ItemHasContents); + connect(this, SIGNAL(runningChanged(bool)), + this, SLOT(update())); +} + +void QQuickAnimatedSprite::reloadImage() +{ + if (!isComponentComplete()) + return; + createEngine();//### It's not as inefficient as it sounds, but it still sucks having to recreate the engine +} + +void QQuickAnimatedSprite::componentComplete() +{ + createEngine(); + QQuickItem::componentComplete(); + if (m_running) + start(); +} + +void QQuickAnimatedSprite::start() +{ + if (m_running) + return; + m_curLoop = 0; + m_timestamp.start(); + m_running = true; + emit runningChanged(true); + update(); +} + +void QQuickAnimatedSprite::stop() +{ + if (!m_running) + return; + m_running = false; + emit runningChanged(false); +} + +void QQuickAnimatedSprite::advance(int frames) +{ + if (!frames) + return; + //TODO-C: May not work when running - only when paused + m_curFrame += frames; + while (m_curFrame < 0) + m_curFrame += m_sprite->frames(); + m_curFrame = m_curFrame % m_sprite->frames(); + emit currentFrameChanged(m_curFrame); +} + +void QQuickAnimatedSprite::pause() +{ + if (m_paused) + return; + m_pauseOffset = m_timestamp.elapsed(); + m_paused = true; + emit pausedChanged(true); +} + +void QQuickAnimatedSprite::resume() +{ + if (!m_paused) + return; + m_pauseOffset = m_pauseOffset - m_timestamp.elapsed(); + m_paused = false; + emit pausedChanged(false); +} + +void QQuickAnimatedSprite::createEngine() +{ + if (m_spriteEngine) + delete m_spriteEngine; + QList spriteList; + spriteList << m_sprite; + m_spriteEngine = new QQuickSpriteEngine(QList(spriteList), this); + m_spriteEngine->startAssemblingImage(); + reset(); +} + +static QSGGeometry::Attribute AnimatedSprite_Attributes[] = { + QSGGeometry::Attribute::create(0, 2, GL_FLOAT), // tex +}; + +static QSGGeometry::AttributeSet AnimatedSprite_AttributeSet = +{ + 1, // Attribute Count + 2 * sizeof(float), + AnimatedSprite_Attributes +}; + +QSGGeometryNode* QQuickAnimatedSprite::buildNode() +{ + if (!m_spriteEngine) { + qmlInfo(this) << "No sprite engine..."; + return 0; + } else if (m_spriteEngine->status() == QDeclarativePixmap::Null) { + m_spriteEngine->startAssemblingImage(); + update();//Schedule another update, where we will check again + return 0; + } else if (m_spriteEngine->status() == QDeclarativePixmap::Loading) { + update();//Schedule another update, where we will check again + return 0; + } + + m_material = new QQuickAnimatedSpriteMaterial(); + + QImage image = m_spriteEngine->assembledImage(); + if (image.isNull()) + return 0; + m_sheetSize = QSizeF(image.size()); + m_material->texture = canvas()->createTextureFromImage(image); + m_material->texture->setFiltering(QSGTexture::Linear); + m_spriteEngine->start(0); + m_material->animT = 0; + m_material->animX1 = m_spriteEngine->spriteX() / m_sheetSize.width(); + m_material->animY1 = m_spriteEngine->spriteY() / m_sheetSize.height(); + m_material->animX2 = m_material->animX1; + m_material->animY2 = m_material->animY1; + m_material->animW = m_spriteEngine->spriteWidth() / m_sheetSize.width(); + m_material->animH = m_spriteEngine->spriteHeight() / m_sheetSize.height(); + m_material->elementWidth = width(); + m_material->elementHeight = height(); + + int vCount = 4; + int iCount = 6; + QSGGeometry *g = new QSGGeometry(AnimatedSprite_AttributeSet, vCount, iCount); + g->setDrawingMode(GL_TRIANGLES); + + AnimatedSpriteVertices *p = (AnimatedSpriteVertices *) g->vertexData(); + + p->v1.tx = 0; + p->v1.ty = 0; + + p->v2.tx = 1.0; + p->v2.ty = 0; + + p->v3.tx = 0; + p->v3.ty = 1.0; + + p->v4.tx = 1.0; + p->v4.ty = 1.0; + + quint16 *indices = g->indexDataAsUShort(); + indices[0] = 0; + indices[1] = 1; + indices[2] = 2; + indices[3] = 1; + indices[4] = 3; + indices[5] = 2; + + + m_timestamp.start(); + m_node = new QSGGeometryNode(); + m_node->setGeometry(g); + m_node->setMaterial(m_material); + m_node->setFlag(QSGGeometryNode::OwnsMaterial); + return m_node; +} + +void QQuickAnimatedSprite::reset() +{ + m_pleaseReset = true; +} + +QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *, UpdatePaintNodeData *) +{ + if (m_pleaseReset) { + delete m_node; + + m_node = 0; + m_material = 0; + m_pleaseReset = false; + } + + prepareNextFrame(); + + if (m_running) { + update(); + if (m_node) + m_node->markDirty(QSGNode::DirtyMaterial); + } + + return m_node; +} + +void QQuickAnimatedSprite::prepareNextFrame() +{ + if (m_node == 0) + m_node = buildNode(); + if (m_node == 0) //error creating node + return; + + uint timeInt = m_timestamp.elapsed() + m_pauseOffset; + qreal time = timeInt / 1000.; + m_material->elementHeight = height(); + m_material->elementWidth = width(); + + double frameAt; //double just for modf + qreal progress; + if (!m_paused) { + //Advance State (keeps time for psuedostates) + m_spriteEngine->updateSprites(timeInt); + + //Advance AnimatedSprite + qreal animT = m_spriteEngine->spriteStart()/1000.0; + qreal frameCount = m_spriteEngine->spriteFrames(); + qreal frameDuration = m_spriteEngine->spriteDuration()/frameCount; + if (frameDuration > 0) { + qreal frame = (time - animT)/(frameDuration / 1000.0); + frame = qBound(qreal(0.0), frame, frameCount - qreal(1.0));//Stop at count-1 frames until we have between anim interpolation + progress = modf(frame,&frameAt); + if (m_curFrame > frameAt) //went around + m_curLoop++; + m_curFrame = frameAt; + } else { + m_curFrame++; + if (m_curFrame >= frameCount){ + m_curFrame = 0; + m_curLoop++; + m_spriteEngine->advance(); + } + frameAt = m_curFrame; + progress = 0; + } + if (m_loops > 0 && m_curLoop >= m_loops) { + frameAt = 0; + m_running = false; + } + } else { + frameAt = m_curFrame; + } + if (m_spriteEngine->sprite()->reverse()) + frameAt = (m_spriteEngine->spriteFrames() - 1) - frameAt; + qreal y = m_spriteEngine->spriteY() / m_sheetSize.height(); + qreal w = m_spriteEngine->spriteWidth() / m_sheetSize.width(); + qreal h = m_spriteEngine->spriteHeight() / m_sheetSize.height(); + qreal x1 = m_spriteEngine->spriteX() / m_sheetSize.width(); + x1 += frameAt * w; + qreal x2 = x1; + if (frameAt < (m_spriteEngine->spriteFrames()-1)) + x2 += w; + + m_material->animX1 = x1; + m_material->animY1 = y; + m_material->animX2 = x2; + m_material->animY2 = y; + m_material->animW = w; + m_material->animH = h; + m_material->animT = m_interpolate ? progress : 0.0; +} + +QT_END_NAMESPACE diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h new file mode 100644 index 0000000000..062b191621 --- /dev/null +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -0,0 +1,373 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKANIMATEDSPRITE_P_H +#define QQUICKANIMATEDSPRITE_P_H + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSGContext; +class QQuickSprite; +class QQuickSpriteEngine; +class QSGGeometryNode; +class QQuickAnimatedSpriteMaterial; +class Q_AUTOTEST_EXPORT QQuickAnimatedSprite : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) + Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate NOTIFY interpolateChanged) + //###try to share similar spriteEngines for less overhead? + //These properties come out of QQuickSprite, since a SimpleSpriteImage is a renderer for a single sprite + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(bool reverse READ reverse WRITE setReverse NOTIFY reverseChanged) + Q_PROPERTY(bool frameSync READ frameSync WRITE setFrameSync NOTIFY frameSyncChanged) + Q_PROPERTY(int frameCount READ frameCount WRITE setFrameCount NOTIFY frameCountChanged) + //If frame height or width is not specified, it is assumed to be a single long row of square frames. + //Otherwise, it can be multiple contiguous rows, when one row runs out the next will be used. + Q_PROPERTY(int frameHeight READ frameHeight WRITE setFrameHeight NOTIFY frameHeightChanged) + Q_PROPERTY(int frameWidth READ frameWidth WRITE setFrameWidth NOTIFY frameWidthChanged) + Q_PROPERTY(int frameX READ frameX WRITE setFrameX NOTIFY frameXChanged) + Q_PROPERTY(int frameY READ frameY WRITE setFrameY NOTIFY frameYChanged) + //Precedence order: frameRate, frameDuration + Q_PROPERTY(qreal frameRate READ frameRate WRITE setFrameRate NOTIFY frameRateChanged RESET resetFrameRate) + Q_PROPERTY(int frameDuration READ frameDuration WRITE setFrameDuration NOTIFY frameDurationChanged RESET resetFrameDuration) + //Extra Simple Sprite Stuff + Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) + Q_PROPERTY(bool paused READ paused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged) + + Q_ENUMS(LoopParameters) +public: + explicit QQuickAnimatedSprite(QQuickItem *parent = 0); + enum LoopParameters { + Infinite = -1 + }; + + bool running() const + { + return m_running; + } + + bool interpolate() const + { + return m_interpolate; + } + + QUrl source() const + { + return m_sprite->source(); + } + + bool reverse() const + { + return m_sprite->reverse(); + } + + bool frameSync() const + { + return m_sprite->frameSync(); + } + + int frameCount() const + { + return m_sprite->frames(); + } + + int frameHeight() const + { + return m_sprite->frameHeight(); + } + + int frameWidth() const + { + return m_sprite->frameWidth(); + } + + int frameX() const + { + return m_sprite->frameX(); + } + + int frameY() const + { + return m_sprite->frameY(); + } + + qreal frameRate() const + { + return m_sprite->frameRate(); + } + + int frameDuration() const + { + return m_sprite->frameDuration(); + } + + int loops() const + { + return m_loops; + } + + bool paused() const + { + return m_paused; + } + + int currentFrame() const + { + return m_curFrame; + } + +signals: + + void pausedChanged(bool arg); + void runningChanged(bool arg); + void interpolateChanged(bool arg); + + void sourceChanged(QUrl arg); + + void reverseChanged(bool arg); + + void frameSyncChanged(bool arg); + + void frameCountChanged(int arg); + + void frameHeightChanged(int arg); + + void frameWidthChanged(int arg); + + void frameXChanged(int arg); + + void frameYChanged(int arg); + + void frameRateChanged(qreal arg); + + void frameDurationChanged(int arg); + + void loopsChanged(int arg); + + void currentFrameChanged(int arg); + +public slots: + void start(); + void stop(); + void restart() {stop(); start();} + void advance(int frames=1); + void pause(); + void resume(); + + void setRunning(bool arg) + { + if (m_running != arg) { + if (m_running) + stop(); + else + start(); + } + } + + void setPaused(bool arg) + { + if (m_paused != arg) { + if (m_paused) + resume(); + else + pause(); + } + } + + void setInterpolate(bool arg) + { + if (m_interpolate != arg) { + m_interpolate = arg; + emit interpolateChanged(arg); + } + } + + void setSource(QUrl arg) + { + if (m_sprite->m_source != arg) { + m_sprite->setSource(arg); + emit sourceChanged(arg); + } + } + + void setReverse(bool arg) + { + if (m_sprite->m_reverse != arg) { + m_sprite->setReverse(arg); + emit reverseChanged(arg); + } + } + + void setFrameSync(bool arg) + { + if (m_sprite->m_frameSync != arg) { + m_sprite->setFrameSync(arg); + emit frameSyncChanged(arg); + } + } + + void setFrameCount(int arg) + { + if (m_sprite->m_frames != arg) { + m_sprite->setFrameCount(arg); + emit frameCountChanged(arg); + reloadImage(); + } + } + + void setFrameHeight(int arg) + { + if (m_sprite->m_frameHeight != arg) { + m_sprite->setFrameHeight(arg); + emit frameHeightChanged(arg); + reloadImage(); + } + } + + void setFrameWidth(int arg) + { + if (m_sprite->m_frameWidth != arg) { + m_sprite->setFrameWidth(arg); + emit frameWidthChanged(arg); + reloadImage(); + } + } + + void setFrameX(int arg) + { + if (m_sprite->m_frameX != arg) { + m_sprite->setFrameX(arg); + emit frameXChanged(arg); + reloadImage(); + } + } + + void setFrameY(int arg) + { + if (m_sprite->m_frameY != arg) { + m_sprite->setFrameY(arg); + emit frameYChanged(arg); + reloadImage(); + } + } + + void setFrameRate(qreal arg) + { + if (m_sprite->m_frameRate != arg) { + m_sprite->setFrameRate(arg); + emit frameRateChanged(arg); + } + } + + void setFrameDuration(int arg) + { + if (m_sprite->m_frameDuration != arg) { + m_sprite->setFrameDuration(arg); + emit frameDurationChanged(arg); + } + } + + void resetFrameRate() + { + setFrameRate(-1.0); + } + + void resetFrameDuration() + { + setFrameDuration(-1); + } + + void setLoops(int arg) + { + if (m_loops != arg) { + m_loops = arg; + emit loopsChanged(arg); + } + } + + void setCurrentFrame(int arg) //TODO-C: Probably only works when paused + { + if (m_curFrame != arg) { + m_curFrame = arg; + emit currentFrameChanged(arg); //TODO-C Only emitted on manual advance! + } + } + + +private slots: + void createEngine(); +protected: + void reset(); + void componentComplete(); + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); +private: + void prepareNextFrame(); + void reloadImage(); + QSGGeometryNode* buildNode(); + QSGGeometryNode *m_node; + QQuickAnimatedSpriteMaterial *m_material; + QQuickSprite* m_sprite; + QQuickSpriteEngine* m_spriteEngine; + QTime m_timestamp; + int m_curFrame; + bool m_pleaseReset; + bool m_running; + bool m_paused; + bool m_interpolate; + QSizeF m_sheetSize; + int m_loops; + int m_curLoop; + int m_pauseOffset; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QQUICKANIMATEDSPRITE_P_H diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index a4cfa26205..2c74e3c91c 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -78,6 +78,7 @@ #include #include "qquicksprite_p.h" #include "qquickspriteimage_p.h" +#include "qquickanimatedsprite_p.h" #include "qquickdrag_p.h" #include "qquickdroparea_p.h" #include "qquickmultipointtoucharea_p.h" @@ -200,6 +201,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick", 2, 0, "Canvas"); qmlRegisterType("QtQuick", 2, 0, "Sprite"); + qmlRegisterType("QtQuick", 2, 0, "AnimatedSprite"); qmlRegisterType("QtQuick", 2, 0, "SpriteImage"); qmlRegisterType(uri, major, minor,"ParentChange"); diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 4c5e5ff58e..98cc90ad8c 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -279,6 +279,7 @@ private slots: private: friend class QQuickImageParticle; friend class QQuickSpriteImage; + friend class QQuickAnimatedSprite; friend class QQuickSpriteEngine; friend class QQuickStochasticEngine; int m_generatedCount; diff --git a/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml b/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml new file mode 100644 index 0000000000..f219e5fb81 --- /dev/null +++ b/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + color: "black" + width: 320 + height: 320 + + AnimatedSprite { + objectName: "sprite" + loops: 3 + source: "squarefacesprite.png" + frames: 6 + frameDuration: 120 + width: 160 + height: 160 + } +} diff --git a/tests/auto/qtquick2/qquickanimatedsprite/data/squarefacesprite.png b/tests/auto/qtquick2/qquickanimatedsprite/data/squarefacesprite.png new file mode 100644 index 0000000000000000000000000000000000000000..f9a5d5fccebbabbf83c5a36b67752bd1234846d3 GIT binary patch literal 496 zcmVj-Ki4wqJn88@zlQhjD`j9Tl zM{JUFvcxAf%CWJ->|-NVz%>^eJKWwIuo6Bs02_OSosMu`(1g?&$gr^^?Vos#ko!YN zC$9({oxCEyno8w7t2V#V)UgB`+rz$mqSqD^WtpaqCD_9ZRsWXKfav>1?*6u#hdn3bsOjE}aY-~^aa_UmM zKv|}#V+l64m#vz*Xf71>?gBQphppO2ADxO>&cVixwAK6Q+6Gw8!N!iZ)w?bu4TuOf z_DsyXE}BHG!m+VO&%b=4=WM&XyjJ0*y;bU!Ws&yQ`5a|$#qUm@h97!-**z>e?~{_&*2(> z1Lw`!pUU}K|H<}DPP;NfM}Lfc*G+b}Z4DhA`*k+2>5^Au@AC`pFKq1l?Bl?)vH|6Q mhK(I+-_d~9Zag-2nEeG?V91at6Cb$%0000 +#include "../../shared/util.h" +#include +#include + +class tst_qquickanimatedsprite : public QDeclarativeDataTest +{ + Q_OBJECT +public: + tst_qquickanimatedsprite(){} + +private slots: + void test_properties(); +}; + +void tst_qquickanimatedsprite::test_properties() +{ + QQuickView *canvas = new QQuickView(0); + + canvas->setSource(testFileUrl("basic.qml")); + canvas->show(); + QTest::qWaitForWindowShown(canvas); + + QVERIFY(canvas->rootObject()); + QQuickAnimatedSprite* sprite = canvas->rootObject()->findChild("sprite"); + QVERIFY(sprite); + + QVERIFY(sprite->running()); + QVERIFY(!sprite->paused()); + QVERIFY(sprite->interpolate()); + QCOMPARE(sprite->loops(), 3); + + sprite->setRunning(false); + QVERIFY(!sprite->running()); + sprite->setInterpolate(false); + QVERIFY(!sprite->interpolate()); + + delete canvas; +} + +QTEST_MAIN(tst_qquickanimatedsprite) + +#include "tst_qquickanimatedsprite.moc" diff --git a/tests/auto/qtquick2/qtquick2.pro b/tests/auto/qtquick2/qtquick2.pro index 7acd75f69e..60e302759e 100644 --- a/tests/auto/qtquick2/qtquick2.pro +++ b/tests/auto/qtquick2/qtquick2.pro @@ -31,6 +31,7 @@ QUICKTESTS = \ qquickaccessible \ qquickanchors \ qquickanimatedimage \ + qquickanimatedsprite \ qquickborderimage \ qquickcanvas \ qquickdrag \ From 75a0d33d250a97d5ee0314f5b7aad876d9ee2fa8 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 14 Feb 2012 18:16:21 +1000 Subject: [PATCH 39/82] Rename SpriteImage to SpriteSequence Also rename Sprite::frames->Sprite::frameCount Change-Id: I2e7a71adc37044fd696ffda2a5da4835725ba3a8 Reviewed-by: Alan Alpert --- .../content/PlasmaPatrolParticles.qml | 6 +- examples/particles/affectors/age.qml | 2 +- examples/particles/affectors/attractor.qml | 2 +- .../particles/affectors/customaffector.qml | 10 +-- examples/particles/affectors/friction.qml | 10 +-- examples/particles/affectors/spritegoal.qml | 6 +- examples/particles/affectors/wander.qml | 2 +- .../particles/imageparticle/allatonce.qml | 2 +- examples/particles/imageparticle/sprites.qml | 12 +-- .../qtquick/imageelements/spriteimage.qml | 12 +-- .../content/BearWhackParticleSystem.qml | 6 +- src/quick/items/items.pri | 4 +- src/quick/items/qquickitemsmodule.cpp | 5 +- src/quick/items/qquicksprite.cpp | 2 +- src/quick/items/qquicksprite_p.h | 21 +++++- ...riteimage.cpp => qquickspritesequence.cpp} | 70 +++++++++--------- ...riteimage_p.h => qquickspritesequence_p.h} | 14 ++-- .../qquickanimatedsprite/data/basic.qml | 2 +- .../data/advance.qml | 6 +- .../data/basic.qml | 4 +- .../data/squarefacesprite.png | Bin .../qquickspritesequence.pro} | 4 +- .../tst_qquickspritesequence.cpp} | 18 ++--- tests/auto/qtquick2/qtquick2.pro | 2 +- 24 files changed, 118 insertions(+), 104 deletions(-) rename src/quick/items/{qquickspriteimage.cpp => qquickspritesequence.cpp} (85%) rename src/quick/items/{qquickspriteimage_p.h => qquickspritesequence_p.h} (92%) rename tests/auto/qtquick2/{qquickspriteimage => qquickspritesequence}/data/advance.qml (96%) rename tests/auto/qtquick2/{qquickspriteimage => qquickspritesequence}/data/basic.qml (97%) rename tests/auto/qtquick2/{qquickspriteimage => qquickspritesequence}/data/squarefacesprite.png (100%) rename tests/auto/qtquick2/{qquickspriteimage/qquickspriteimage.pro => qquickspritesequence/qquickspritesequence.pro} (78%) rename tests/auto/qtquick2/{qquickspriteimage/tst_qquickspriteimage.cpp => qquickspritesequence/tst_qquickspritesequence.cpp} (83%) diff --git a/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml index 95d4bcd2b9..1d856b5805 100644 --- a/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml +++ b/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml @@ -127,19 +127,19 @@ Item { id: spinState name: "spinning" source: "pics/meteor.png" - frames: 35 + frameCount: 35 frameDuration: 40 to: {"death":0, "spinning":1} },Sprite { name: "death" source: "pics/meteor_explo.png" - frames: 22 + frameCount: 22 frameDuration: 40 to: {"null":1} }, Sprite { name: "null" source: "pics/nullRock.png" - frames: 1 + frameCount: 1 frameDuration: 1000 } ] diff --git a/examples/particles/affectors/age.qml b/examples/particles/affectors/age.qml index 1e7774b63b..ea1b30275e 100644 --- a/examples/particles/affectors/age.qml +++ b/examples/particles/affectors/age.qml @@ -54,7 +54,7 @@ Rectangle { sprites: Sprite { name: "snow" source: "../images/snowflake.png" - frames: 51 + frameCount: 51 frameDuration: 40 frameDurationVariation: 8 } diff --git a/examples/particles/affectors/attractor.qml b/examples/particles/affectors/attractor.qml index 460a497a92..0d50937fe7 100644 --- a/examples/particles/affectors/attractor.qml +++ b/examples/particles/affectors/attractor.qml @@ -108,7 +108,7 @@ Rectangle { id: spinState name: "spinning" source: "../images/meteor.png" - frames: 35 + frameCount: 35 frameDuration: 60 } } diff --git a/examples/particles/affectors/customaffector.qml b/examples/particles/affectors/customaffector.qml index 3f98cd5b43..9ccf45d3e6 100644 --- a/examples/particles/affectors/customaffector.qml +++ b/examples/particles/affectors/customaffector.qml @@ -135,31 +135,31 @@ Item { system: sys sprites: [Sprite { source: "../images/realLeaf1.png" - frames: 1 + frameCount: 1 frameDuration: 1 to: {"a":1, "b":1, "c":1, "d":1} }, Sprite { name: "a" source: "../images/realLeaf1.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "b" source: "../images/realLeaf2.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "c" source: "../images/realLeaf3.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "d" source: "../images/realLeaf4.png" - frames: 1 + frameCount: 1 frameDuration: 10000 } ] diff --git a/examples/particles/affectors/friction.qml b/examples/particles/affectors/friction.qml index 4161fd9f02..b93ead1967 100644 --- a/examples/particles/affectors/friction.qml +++ b/examples/particles/affectors/friction.qml @@ -65,31 +65,31 @@ Item { system: sys sprites: [Sprite { source: "../images/realLeaf1.png" - frames: 1 + frameCount: 1 frameDuration: 1 to: {"a":1, "b":1, "c":1, "d":1} }, Sprite { name: "a" source: "../images/realLeaf1.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "b" source: "../images/realLeaf2.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "c" source: "../images/realLeaf3.png" - frames: 1 + frameCount: 1 frameDuration: 10000 }, Sprite { name: "d" source: "../images/realLeaf4.png" - frames: 1 + frameCount: 1 frameDuration: 10000 } ] diff --git a/examples/particles/affectors/spritegoal.qml b/examples/particles/affectors/spritegoal.qml index 1ea61442aa..7102d09bc2 100644 --- a/examples/particles/affectors/spritegoal.qml +++ b/examples/particles/affectors/spritegoal.qml @@ -105,20 +105,20 @@ Item { id: spinState name: "spinning" source: "../images/meteor.png" - frames: 35 + frameCount: 35 frameDuration: 40 randomStart: true to: {"explode":0, "spinning":1} },Sprite { name: "explode" source: "../images/_explo.png" - frames: 22 + frameCount: 22 frameDuration: 40 to: {"nullFrame":1} },Sprite {//Not sure if this is needed, but seemed easiest name: "nullFrame" source: "../images/nullRock.png" - frames: 1 + frameCount: 1 frameDuration: 1000 } ] diff --git a/examples/particles/affectors/wander.qml b/examples/particles/affectors/wander.qml index 31a0b4a796..ea008795c2 100644 --- a/examples/particles/affectors/wander.qml +++ b/examples/particles/affectors/wander.qml @@ -51,7 +51,7 @@ Rectangle { sprites: Sprite { name: "snow" source: "../images/snowflake.png" - frames: 51 + frameCount: 51 frameDuration: 40 frameDurationVariation: 8 } diff --git a/examples/particles/imageparticle/allatonce.qml b/examples/particles/imageparticle/allatonce.qml index fbc634ec9a..b62735d7f9 100644 --- a/examples/particles/imageparticle/allatonce.qml +++ b/examples/particles/imageparticle/allatonce.qml @@ -54,7 +54,7 @@ Rectangle { Sprite { name: "bear" source: "../images/bear_tiles.png" - frames: 13 + frameCount: 13 frameDuration: 120 } ] diff --git a/examples/particles/imageparticle/sprites.qml b/examples/particles/imageparticle/sprites.qml index 0fe4f31ea3..45ff2ebbaf 100644 --- a/examples/particles/imageparticle/sprites.qml +++ b/examples/particles/imageparticle/sprites.qml @@ -47,11 +47,11 @@ Rectangle { height: 800 id: root - SpriteImage { + SpriteSequence { sprites: Sprite { name: "bear" source: "../images/bear_tiles.png" - frames: 13 + frameCount: 13 frameDuration: 120 } width: 250 @@ -71,25 +71,25 @@ Rectangle { sprites: [Sprite { name: "happy" source: "../images/starfish_1.png" - frames: 1 + frameCount: 1 frameDuration: 260 to: {"happy": 1, "silly": 1, "angry": 1} }, Sprite { name: "angry" source: "../images/starfish_0.png" - frames: 1 + frameCount: 1 frameDuration: 260 to: {"happy": 1, "silly": 1, "angry": 1} }, Sprite { name: "silly" source: "../images/starfish_2.png" - frames: 1 + frameCount: 1 frameDuration: 260 to: {"happy": 1, "silly": 1, "noticedbear": 0} }, Sprite { name: "noticedbear" source: "../images/starfish_3.png" - frames: 1 + frameCount: 1 frameDuration: 2600 }] } diff --git a/examples/qtquick/imageelements/spriteimage.qml b/examples/qtquick/imageelements/spriteimage.qml index 559bb10a50..372970d1d6 100644 --- a/examples/qtquick/imageelements/spriteimage.qml +++ b/examples/qtquick/imageelements/spriteimage.qml @@ -53,7 +53,7 @@ Item { ScriptAction { script: {image.goalSprite = ""; image.jumpTo("still");} } PropertyAction { target: image; property: "y"; value: 0 } } - SpriteImage { + SpriteSequence { id: image width: 256 height: 256 @@ -63,7 +63,7 @@ Item { Sprite{ name: "still" source: "content/BearSheet.png" - frames: 1 + frameCount: 1 frameWidth: 256 frameHeight: 256 frameDuration: 100 @@ -72,7 +72,7 @@ Item { Sprite{ name: "blink" source: "content/BearSheet.png" - frames: 3 + frameCount: 3 frameX: 256 frameY: 1536 frameWidth: 256 @@ -83,7 +83,7 @@ Item { Sprite{ name: "floating" source: "content/BearSheet.png" - frames: 9 + frameCount: 9 frameX: 0 frameY: 0 frameWidth: 256 @@ -94,7 +94,7 @@ Item { Sprite{ name: "flailing" source: "content/BearSheet.png" - frames: 8 + frameCount: 8 frameX: 0 frameY: 768 frameWidth: 256 @@ -105,7 +105,7 @@ Item { Sprite{ name: "falling" source: "content/BearSheet.png" - frames: 5 + frameCount: 5 frameY: 1280 frameWidth: 256 frameHeight: 256 diff --git a/examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml b/examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml index 05d74ab0ea..bed03e99aa 100644 --- a/examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml +++ b/examples/qtquick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml @@ -151,7 +151,7 @@ ParticleSystem { Sprite{ name: "floating" source: "Bear1.png" - frames: 9 + frameCount: 9 frameWidth: 256 frameHeight: 256 frameDuration: 80 @@ -160,7 +160,7 @@ ParticleSystem { Sprite{ name: "flailing" source: "Bear2.png" - frames: 8 + frameCount: 8 frameWidth: 256 frameHeight: 256 frameDuration: 80 @@ -169,7 +169,7 @@ ParticleSystem { Sprite{ name: "falling" source: "Bear3.png" - frames: 5 + frameCount: 5 frameWidth: 256 frameHeight: 256 frameDuration: 80 diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index bdd1692e85..21bf7cc8c1 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -65,7 +65,7 @@ HEADERS += \ $$PWD/qquickimplicitsizeitem_p_p.h \ $$PWD/qquickspriteengine_p.h \ $$PWD/qquicksprite_p.h \ - $$PWD/qquickspriteimage_p.h \ + $$PWD/qquickspritesequence_p.h \ $$PWD/qquickanimatedsprite_p.h \ $$PWD/qquickdrag_p.h \ $$PWD/qquickdroparea_p.h \ @@ -117,7 +117,7 @@ SOURCES += \ $$PWD/qquickimplicitsizeitem.cpp \ $$PWD/qquickspriteengine.cpp \ $$PWD/qquicksprite.cpp \ - $$PWD/qquickspriteimage.cpp \ + $$PWD/qquickspritesequence.cpp \ $$PWD/qquickanimatedsprite.cpp \ $$PWD/qquickaccessibleattached.cpp \ $$PWD/qquickdrag.cpp \ diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 2c74e3c91c..b9e401a231 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -77,7 +77,7 @@ #include #include #include "qquicksprite_p.h" -#include "qquickspriteimage_p.h" +#include "qquickspritesequence_p.h" #include "qquickanimatedsprite_p.h" #include "qquickdrag_p.h" #include "qquickdroparea_p.h" @@ -202,7 +202,8 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick", 2, 0, "Sprite"); qmlRegisterType("QtQuick", 2, 0, "AnimatedSprite"); - qmlRegisterType("QtQuick", 2, 0, "SpriteImage"); + qmlRegisterType("QtQuick", 2, 0, "SpriteSequence"); + qmlRegisterType("QtQuick", 2, 0, "SpriteImage");//Deprecation in progress qmlRegisterType(uri, major, minor,"ParentChange"); qmlRegisterType(uri, major, minor,"AnchorChanges"); diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp index 4de7880916..2a1bd08d59 100644 --- a/src/quick/items/qquicksprite.cpp +++ b/src/quick/items/qquicksprite.cpp @@ -145,7 +145,7 @@ QT_BEGIN_NAMESPACE will repeat itself after completing. */ /*! - \qmlproperty int QtQuick2::Sprite::frames + \qmlproperty int QtQuick2::Sprite::frameCount Number of frames in this sprite. */ diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 98cc90ad8c..dd6560f5ab 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -48,6 +48,7 @@ #include #include #include "qquickspriteengine_p.h" +#include QT_BEGIN_HEADER @@ -60,7 +61,8 @@ class QQuickSprite : public QQuickStochasticState //Renderers have to query this hint when advancing frames Q_PROPERTY(bool reverse READ reverse WRITE setReverse NOTIFY reverseChanged) Q_PROPERTY(bool frameSync READ frameSync WRITE setFrameSync NOTIFY frameSyncChanged) - Q_PROPERTY(int frames READ frames WRITE setFrames NOTIFY framesChanged) + Q_PROPERTY(int frames READ frames WRITE setFrames NOTIFY frameCountChanged) + Q_PROPERTY(int frameCount READ frameCount WRITE setFrameCount NOTIFY frameCountChanged) //If frame height or width is not specified, it is assumed to be a single long row of square frames. //Otherwise, it can be multiple contiguous rows, when one row runs out the next will be used. Q_PROPERTY(int frameHeight READ frameHeight WRITE setFrameHeight NOTIFY frameHeightChanged) @@ -101,6 +103,11 @@ class QQuickSprite : public QQuickStochasticState return m_frames; } + int frameCount() const + { + return m_frames; + } + int frameX() const { return m_frameX; @@ -158,7 +165,7 @@ class QQuickSprite : public QQuickStochasticState void reverseChanged(bool arg); - void framesChanged(int arg); + void frameCountChanged(int arg); void frameXChanged(int arg); @@ -210,10 +217,16 @@ public slots: } void setFrames(int arg) + { + qWarning() << "Sprite::frames has been renamed Sprite::frameCount"; + setFrameCount(arg); + } + + void setFrameCount(int arg) { if (m_frames != arg) { m_frames = arg; - emit framesChanged(arg); + emit frameCountChanged(arg); } } @@ -278,7 +291,7 @@ private slots: private: friend class QQuickImageParticle; - friend class QQuickSpriteImage; + friend class QQuickSpriteSequence; friend class QQuickAnimatedSprite; friend class QQuickSpriteEngine; friend class QQuickStochasticEngine; diff --git a/src/quick/items/qquickspriteimage.cpp b/src/quick/items/qquickspritesequence.cpp similarity index 85% rename from src/quick/items/qquickspriteimage.cpp rename to src/quick/items/qquickspritesequence.cpp index 1b3b57710a..a3a8a6ee8c 100644 --- a/src/quick/items/qquickspriteimage.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qquickspriteimage_p.h" +#include "qquickspritesequence_p.h" #include "qquicksprite_p.h" #include "qquickspriteengine_p.h" #include @@ -90,16 +90,16 @@ static const char fragmentShaderCode[] = " gl_FragColor = mix(texture2D(texture, fTexS.xy), texture2D(texture, fTexS.zw), progress) * qt_Opacity;\n" "}\n"; -class QQuickSpriteImageMaterial : public QSGMaterial +class QQuickSpriteSequenceMaterial : public QSGMaterial { public: - QQuickSpriteImageMaterial(); - ~QQuickSpriteImageMaterial(); + QQuickSpriteSequenceMaterial(); + ~QQuickSpriteSequenceMaterial(); virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; } virtual QSGMaterialShader *createShader() const; virtual int compare(const QSGMaterial *other) const { - return this - static_cast(other); + return this - static_cast(other); } QSGTexture *texture; @@ -115,7 +115,7 @@ class QQuickSpriteImageMaterial : public QSGMaterial float elementHeight; }; -QQuickSpriteImageMaterial::QQuickSpriteImageMaterial() +QQuickSpriteSequenceMaterial::QQuickSpriteSequenceMaterial() : animT(0.0f) , animX1(0.0f) , animY1(0.0f) @@ -129,15 +129,15 @@ QQuickSpriteImageMaterial::QQuickSpriteImageMaterial() setFlag(Blending, true); } -QQuickSpriteImageMaterial::~QQuickSpriteImageMaterial() +QQuickSpriteSequenceMaterial::~QQuickSpriteSequenceMaterial() { delete texture; } -class SpriteImageMaterialData : public QSGMaterialShader +class SpriteSequenceMaterialData : public QSGMaterialShader { public: - SpriteImageMaterialData(const char * /* vertexFile */ = 0, const char * /* fragmentFile */ = 0) + SpriteSequenceMaterialData(const char * /* vertexFile */ = 0, const char * /* fragmentFile */ = 0) { } @@ -151,7 +151,7 @@ class SpriteImageMaterialData : public QSGMaterialShader virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) { - QQuickSpriteImageMaterial *m = static_cast(newEffect); + QQuickSpriteSequenceMaterial *m = static_cast(newEffect); m->texture->bind(); program()->setUniformValue(m_opacity_id, state.opacity()); @@ -191,11 +191,11 @@ class SpriteImageMaterialData : public QSGMaterialShader static float chunkOfBytes[1024]; }; -float SpriteImageMaterialData::chunkOfBytes[1024]; +float SpriteSequenceMaterialData::chunkOfBytes[1024]; -QSGMaterialShader *QQuickSpriteImageMaterial::createShader() const +QSGMaterialShader *QQuickSpriteSequenceMaterial::createShader() const { - return new SpriteImageMaterialData; + return new SpriteSequenceMaterialData; } struct SpriteVertex { @@ -211,21 +211,21 @@ struct SpriteVertices { }; /*! - \qmlclass SpriteImage QQuickSpriteImage + \qmlclass SpriteSequence QQuickSpriteSequence \inqmlmodule QtQuick 2 \inherits Item - \brief The SpriteImage element draws a sprite animation + \brief The SpriteSequence element draws a sprite animation */ /*! - \qmlproperty bool QtQuick2::SpriteImage::running + \qmlproperty bool QtQuick2::SpriteSequence::running Whether the sprite is animating or not. Default is true */ /*! - \qmlproperty bool QtQuick2::SpriteImage::interpolate + \qmlproperty bool QtQuick2::SpriteSequence::interpolate If true, interpolation will occur between sprite frames to make the animation appear smoother. @@ -233,12 +233,12 @@ struct SpriteVertices { Default is true. */ /*! - \qmlproperty string QtQuick2::SpriteImage::goalSprite + \qmlproperty string QtQuick2::SpriteSequence::goalSprite The name of the Sprite which is currently animating. */ /*! - \qmlproperty string QtQuick2::SpriteImage::goalSprite + \qmlproperty string QtQuick2::SpriteSequence::goalSprite The name of the Sprite which the animation should move to. @@ -250,19 +250,19 @@ struct SpriteVertices { If it is possible to return to the goalState from the starting point of the goalState it will continue to do so until goalState is set to "" or an unreachable state. */ -/*! \qmlmethod void QtQuick2::SpriteImage::jumpTo(string sprite) +/*! \qmlmethod void QtQuick2::SpriteSequence::jumpTo(string sprite) This function causes the sprite to jump to the specified state immediately, intermediate states are not played. */ /*! - \qmlproperty list QtQuick2::SpriteImage::sprites + \qmlproperty list QtQuick2::SpriteSequence::sprites The sprite or sprites to draw. Sprites will be scaled to the size of this element. */ //TODO: Implicitly size element to size of first sprite? -QQuickSpriteImage::QQuickSpriteImage(QQuickItem *parent) : +QQuickSpriteSequence::QQuickSpriteSequence(QQuickItem *parent) : QQuickItem(parent) , m_node(0) , m_material(0) @@ -278,14 +278,14 @@ QQuickSpriteImage::QQuickSpriteImage(QQuickItem *parent) : this, SLOT(update())); } -void QQuickSpriteImage::jumpTo(const QString &sprite) +void QQuickSpriteSequence::jumpTo(const QString &sprite) { if (!m_spriteEngine) return; m_spriteEngine->setGoal(m_spriteEngine->stateIndex(sprite), 0, true); } -void QQuickSpriteImage::setGoalSprite(const QString &sprite) +void QQuickSpriteSequence::setGoalSprite(const QString &sprite) { if (m_goalState != sprite){ m_goalState = sprite; @@ -294,12 +294,12 @@ void QQuickSpriteImage::setGoalSprite(const QString &sprite) } } -QDeclarativeListProperty QQuickSpriteImage::sprites() +QDeclarativeListProperty QQuickSpriteSequence::sprites() { return QDeclarativeListProperty(this, &m_sprites, spriteAppend, spriteCount, spriteAt, spriteClear); } -void QQuickSpriteImage::createEngine() +void QQuickSpriteSequence::createEngine() { //TODO: delay until component complete if (m_spriteEngine) @@ -311,18 +311,18 @@ void QQuickSpriteImage::createEngine() reset(); } -static QSGGeometry::Attribute SpriteImage_Attributes[] = { +static QSGGeometry::Attribute SpriteSequence_Attributes[] = { QSGGeometry::Attribute::create(0, 2, GL_FLOAT), // tex }; -static QSGGeometry::AttributeSet SpriteImage_AttributeSet = +static QSGGeometry::AttributeSet SpriteSequence_AttributeSet = { 1, // Attribute Count 2 * sizeof(float), - SpriteImage_Attributes + SpriteSequence_Attributes }; -QSGGeometryNode* QQuickSpriteImage::buildNode() +QSGGeometryNode* QQuickSpriteSequence::buildNode() { if (!m_spriteEngine) { qmlInfo(this) << "No sprite engine..."; @@ -336,7 +336,7 @@ QSGGeometryNode* QQuickSpriteImage::buildNode() return 0; } - m_material = new QQuickSpriteImageMaterial(); + m_material = new QQuickSpriteSequenceMaterial(); QImage image = m_spriteEngine->assembledImage(); if (image.isNull()) @@ -359,7 +359,7 @@ QSGGeometryNode* QQuickSpriteImage::buildNode() int vCount = 4; int iCount = 6; - QSGGeometry *g = new QSGGeometry(SpriteImage_AttributeSet, vCount, iCount); + QSGGeometry *g = new QSGGeometry(SpriteSequence_AttributeSet, vCount, iCount); g->setDrawingMode(GL_TRIANGLES); SpriteVertices *p = (SpriteVertices *) g->vertexData(); @@ -393,12 +393,12 @@ QSGGeometryNode* QQuickSpriteImage::buildNode() return m_node; } -void QQuickSpriteImage::reset() +void QQuickSpriteSequence::reset() { m_pleaseReset = true; } -QSGNode *QQuickSpriteImage::updatePaintNode(QSGNode *, UpdatePaintNodeData *) +QSGNode *QQuickSpriteSequence::updatePaintNode(QSGNode *, UpdatePaintNodeData *) { if (m_pleaseReset) { delete m_node; @@ -419,7 +419,7 @@ QSGNode *QQuickSpriteImage::updatePaintNode(QSGNode *, UpdatePaintNodeData *) return m_node; } -void QQuickSpriteImage::prepareNextFrame() +void QQuickSpriteSequence::prepareNextFrame() { if (m_node == 0) m_node = buildNode(); diff --git a/src/quick/items/qquickspriteimage_p.h b/src/quick/items/qquickspritesequence_p.h similarity index 92% rename from src/quick/items/qquickspriteimage_p.h rename to src/quick/items/qquickspritesequence_p.h index 8017263bb1..8a95594f61 100644 --- a/src/quick/items/qquickspriteimage_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QQUICKSPRITEIMAGE_P_H -#define QQUICKSPRITEIMAGE_P_H +#ifndef QQUICKSPRITESEQUENCE_P_H +#define QQUICKSPRITESEQUENCE_P_H #include #include @@ -53,8 +53,8 @@ class QSGContext; class QQuickSprite; class QQuickSpriteEngine; class QSGGeometryNode; -class QQuickSpriteImageMaterial; -class Q_AUTOTEST_EXPORT QQuickSpriteImage : public QQuickItem +class QQuickSpriteSequenceMaterial; +class Q_AUTOTEST_EXPORT QQuickSpriteSequence : public QQuickItem { Q_OBJECT Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) @@ -66,7 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickSpriteImage : public QQuickItem Q_CLASSINFO("DefaultProperty", "sprites") public: - explicit QQuickSpriteImage(QQuickItem *parent = 0); + explicit QQuickSpriteSequence(QQuickItem *parent = 0); QDeclarativeListProperty sprites(); @@ -127,7 +127,7 @@ private slots: void prepareNextFrame(); QSGGeometryNode* buildNode(); QSGGeometryNode *m_node; - QQuickSpriteImageMaterial *m_material; + QQuickSpriteSequenceMaterial *m_material; QList m_sprites; QQuickSpriteEngine* m_spriteEngine; QTime m_timestamp; @@ -145,4 +145,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QQUICKSPRITEIMAGE_P_H +#endif // QQUICKSPRITESEQUENCE_P_H diff --git a/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml b/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml index f219e5fb81..2dd20630d9 100644 --- a/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml +++ b/tests/auto/qtquick2/qquickanimatedsprite/data/basic.qml @@ -50,7 +50,7 @@ Rectangle { objectName: "sprite" loops: 3 source: "squarefacesprite.png" - frames: 6 + frameCount: 6 frameDuration: 120 width: 160 height: 160 diff --git a/tests/auto/qtquick2/qquickspriteimage/data/advance.qml b/tests/auto/qtquick2/qquickspritesequence/data/advance.qml similarity index 96% rename from tests/auto/qtquick2/qquickspriteimage/data/advance.qml rename to tests/auto/qtquick2/qquickspritesequence/data/advance.qml index 46a49ca673..5866dcbfac 100644 --- a/tests/auto/qtquick2/qquickspriteimage/data/advance.qml +++ b/tests/auto/qtquick2/qquickspritesequence/data/advance.qml @@ -46,18 +46,18 @@ Rectangle { width: 320 height: 320 - SpriteImage { + SpriteSequence { objectName: "sprite" sprites: [Sprite { name: "firstState" source: "squarefacesprite.png" - frames: 3 + frameCount: 3 frameSync: true to: {"secondState":1} }, Sprite { name: "secondState" source: "squarefacesprite.png" - frames: 6 + frameCount: 6 frameSync: true } ] width: 160 diff --git a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml b/tests/auto/qtquick2/qquickspritesequence/data/basic.qml similarity index 97% rename from tests/auto/qtquick2/qquickspriteimage/data/basic.qml rename to tests/auto/qtquick2/qquickspritesequence/data/basic.qml index 2f2b1c96fa..5eb7475f11 100644 --- a/tests/auto/qtquick2/qquickspriteimage/data/basic.qml +++ b/tests/auto/qtquick2/qquickspritesequence/data/basic.qml @@ -46,12 +46,12 @@ Rectangle { width: 320 height: 320 - SpriteImage { + SpriteSequence { objectName: "sprite" sprites: Sprite { name: "happy" source: "squarefacesprite.png" - frames: 6 + frameCount: 6 frameDuration: 120 } width: 160 diff --git a/tests/auto/qtquick2/qquickspriteimage/data/squarefacesprite.png b/tests/auto/qtquick2/qquickspritesequence/data/squarefacesprite.png similarity index 100% rename from tests/auto/qtquick2/qquickspriteimage/data/squarefacesprite.png rename to tests/auto/qtquick2/qquickspritesequence/data/squarefacesprite.png diff --git a/tests/auto/qtquick2/qquickspriteimage/qquickspriteimage.pro b/tests/auto/qtquick2/qquickspritesequence/qquickspritesequence.pro similarity index 78% rename from tests/auto/qtquick2/qquickspriteimage/qquickspriteimage.pro rename to tests/auto/qtquick2/qquickspritesequence/qquickspritesequence.pro index 0d63007c65..16c20ef75b 100644 --- a/tests/auto/qtquick2/qquickspriteimage/qquickspriteimage.pro +++ b/tests/auto/qtquick2/qquickspritesequence/qquickspritesequence.pro @@ -1,6 +1,6 @@ CONFIG += testcase -TARGET = tst_qquickspriteimage -SOURCES += tst_qquickspriteimage.cpp +TARGET = tst_qquickspritesequence +SOURCES += tst_qquickspritesequence.cpp include (../../shared/util.pri) diff --git a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp b/tests/auto/qtquick2/qquickspritesequence/tst_qquickspritesequence.cpp similarity index 83% rename from tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp rename to tests/auto/qtquick2/qquickspritesequence/tst_qquickspritesequence.cpp index 37453521fa..848d6a343c 100644 --- a/tests/auto/qtquick2/qquickspriteimage/tst_qquickspriteimage.cpp +++ b/tests/auto/qtquick2/qquickspritesequence/tst_qquickspritesequence.cpp @@ -41,20 +41,20 @@ #include #include "../../shared/util.h" #include -#include +#include -class tst_qquickspriteimage : public QDeclarativeDataTest +class tst_qquickspritesequence : public QDeclarativeDataTest { Q_OBJECT public: - tst_qquickspriteimage(){} + tst_qquickspritesequence(){} private slots: void test_properties(); void test_framerateAdvance();//Separate codepath for QQuickSpriteEngine }; -void tst_qquickspriteimage::test_properties() +void tst_qquickspritesequence::test_properties() { QQuickView *canvas = new QQuickView(0); @@ -63,7 +63,7 @@ void tst_qquickspriteimage::test_properties() QTest::qWaitForWindowShown(canvas); QVERIFY(canvas->rootObject()); - QQuickSpriteImage* sprite = canvas->rootObject()->findChild("sprite"); + QQuickSpriteSequence* sprite = canvas->rootObject()->findChild("sprite"); QVERIFY(sprite); QVERIFY(sprite->running()); @@ -77,7 +77,7 @@ void tst_qquickspriteimage::test_properties() delete canvas; } -void tst_qquickspriteimage::test_framerateAdvance() +void tst_qquickspritesequence::test_framerateAdvance() { QQuickView *canvas = new QQuickView(0); @@ -86,13 +86,13 @@ void tst_qquickspriteimage::test_framerateAdvance() QTest::qWaitForWindowShown(canvas); QVERIFY(canvas->rootObject()); - QQuickSpriteImage* sprite = canvas->rootObject()->findChild("sprite"); + QQuickSpriteSequence* sprite = canvas->rootObject()->findChild("sprite"); QVERIFY(sprite); QTRY_COMPARE(sprite->currentSprite(), QLatin1String("secondState")); delete canvas; } -QTEST_MAIN(tst_qquickspriteimage) +QTEST_MAIN(tst_qquickspritesequence) -#include "tst_qquickspriteimage.moc" +#include "tst_qquickspritesequence.moc" diff --git a/tests/auto/qtquick2/qtquick2.pro b/tests/auto/qtquick2/qtquick2.pro index 60e302759e..9034cb445a 100644 --- a/tests/auto/qtquick2/qtquick2.pro +++ b/tests/auto/qtquick2/qtquick2.pro @@ -53,7 +53,7 @@ QUICKTESTS = \ qquickpositioners \ qquickrepeater \ qquickshadereffect \ - qquickspriteimage \ + qquickspritesequence \ qquicktext \ qquicktextedit \ qquicktextinput \ From 7d32bacfc574dabb469ad8c0a83c70bb0fc6d770 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 28 Feb 2012 11:33:51 +1000 Subject: [PATCH 40/82] Update drag and drop examples to new guidelines Change-Id: Ib09a50015eaf7e79f21ade5df3cbd3b58b89c83d Reviewed-by: Andrew den Exter --- examples/qtquick/draganddrop/draganddrop.pro | 10 +++ examples/qtquick/draganddrop/draganddrop.qml | 68 +++++++++++++++++++ ...rget.qmlproject => draganddrop.qmlproject} | 2 + examples/qtquick/draganddrop/main.cpp | 41 +++++++++++ .../qtquick/draganddrop/tiles/DragTile.qml | 15 ++-- .../qtquick/draganddrop/tiles/DropTile.qml | 2 +- examples/qtquick/draganddrop/tiles/tiles.qml | 20 +++--- .../qtquick/draganddrop/views/gridview.qml | 22 ++++-- examples/qtquick/qtquick.pro | 4 +- 9 files changed, 157 insertions(+), 27 deletions(-) create mode 100644 examples/qtquick/draganddrop/draganddrop.pro create mode 100644 examples/qtquick/draganddrop/draganddrop.qml rename examples/qtquick/draganddrop/{dragtarget.qmlproject => draganddrop.qmlproject} (88%) create mode 100644 examples/qtquick/draganddrop/main.cpp diff --git a/examples/qtquick/draganddrop/draganddrop.pro b/examples/qtquick/draganddrop/draganddrop.pro new file mode 100644 index 0000000000..f937039ca2 --- /dev/null +++ b/examples/qtquick/draganddrop/draganddrop.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += quick declarative +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/draganddrop +qml.files = draganddrop.qml tiles views +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/draganddrop +INSTALLS += target qml + diff --git a/examples/qtquick/draganddrop/draganddrop.qml b/examples/qtquick/draganddrop/draganddrop.qml new file mode 100644 index 0000000000..88e6d5e021 --- /dev/null +++ b/examples/qtquick/draganddrop/draganddrop.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../shared" as Examples + +/*! + \title QtQuick Examples - Drag and Drop + \example qtquick/draganddrop + \brief This is a collection of QML drag and drop examples + \image qml-draganddrop-example.png + + This is a collection of small QML examples relating to drag and drop functionality. + + Tiles adds drag and drog to simple rectangles, which you can drag into a specific grid. + + GridView adds drag and drog to a GridView, allowing you to reorder the list. +*/ + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Tiles", "", Qt.resolvedUrl("tiles/tiles.qml")); + addExample("GridView", "", Qt.resolvedUrl("views/gridview.qml")); + } + } +} diff --git a/examples/qtquick/draganddrop/dragtarget.qmlproject b/examples/qtquick/draganddrop/draganddrop.qmlproject similarity index 88% rename from examples/qtquick/draganddrop/dragtarget.qmlproject rename to examples/qtquick/draganddrop/draganddrop.qmlproject index 2bb4016996..b8b15c3444 100644 --- a/examples/qtquick/draganddrop/dragtarget.qmlproject +++ b/examples/qtquick/draganddrop/draganddrop.qmlproject @@ -1,7 +1,9 @@ import QmlProject 1.0 Project { + mainFile: "draganddrop.qml" /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { directory: "." } diff --git a/examples/qtquick/draganddrop/main.cpp b/examples/qtquick/draganddrop/main.cpp new file mode 100644 index 0000000000..0d74fbfe2e --- /dev/null +++ b/examples/qtquick/draganddrop/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(draganddrop) diff --git a/examples/qtquick/draganddrop/tiles/DragTile.qml b/examples/qtquick/draganddrop/tiles/DragTile.qml index 2813fa8caf..1f4a8c2bea 100644 --- a/examples/qtquick/draganddrop/tiles/DragTile.qml +++ b/examples/qtquick/draganddrop/tiles/DragTile.qml @@ -44,12 +44,12 @@ Item { id: root property string colorKey - width: 100; height: 100 + width: 64; height: 64 MouseArea { id: mouseArea - width: 100; height: 100 + width: 64; height: 64 anchors.centerIn: parent drag.target: tile @@ -59,20 +59,21 @@ Item { Rectangle { id: tile - width: 100; height: 100 + width: 64; height: 64 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter - anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter color: colorKey Drag.keys: [ colorKey ] Drag.active: mouseArea.drag.active - Drag.hotSpot.x: 50 - Drag.hotSpot.y: 50 + Drag.hotSpot.x: 32 + Drag.hotSpot.y: 32 Text { anchors.fill: parent color: "white" - font.pixelSize: 90 + font.pixelSize: 48 text: modelData + 1 horizontalAlignment:Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/examples/qtquick/draganddrop/tiles/DropTile.qml b/examples/qtquick/draganddrop/tiles/DropTile.qml index e8566f04cc..98fedeb775 100644 --- a/examples/qtquick/draganddrop/tiles/DropTile.qml +++ b/examples/qtquick/draganddrop/tiles/DropTile.qml @@ -46,7 +46,7 @@ DropArea { property string colorKey property alias dropProxy: dragTarget - width: 100; height: 100 + width: 64; height: 64 keys: [ colorKey ] Rectangle { diff --git a/examples/qtquick/draganddrop/tiles/tiles.qml b/examples/qtquick/draganddrop/tiles/tiles.qml index 31c87f8244..0b5647bc2b 100644 --- a/examples/qtquick/draganddrop/tiles/tiles.qml +++ b/examples/qtquick/draganddrop/tiles/tiles.qml @@ -43,8 +43,8 @@ import QtQuick 2.0 Rectangle { id: root - width: 620 - height: 410 + width: 320 + height: 480 color: "black" @@ -53,8 +53,8 @@ Rectangle { anchors.left: redSource.right; anchors.top: parent.top; anchors.margins: 5 - width: 300 - height: 300 + width: 64*3 + height: 64*3 opacity: 0.5 columns: 3 @@ -67,8 +67,8 @@ Rectangle { Grid { anchors.right: blueSource.left; anchors.bottom: parent.bottom; anchors.margins: 5 - width: 300 - height: 300 + width: 64*3 + height: 64*3 opacity: 0.5 @@ -85,8 +85,8 @@ Rectangle { anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.margins: 5 - width: 100 - spacing: -60 + width: 64 + spacing: -16 Repeater { model: 9 @@ -98,8 +98,8 @@ Rectangle { anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.margins: 5 - width: 100 - spacing: -60 + width: 64 + spacing: -16 Repeater { model: 9 diff --git a/examples/qtquick/draganddrop/views/gridview.qml b/examples/qtquick/draganddrop/views/gridview.qml index 375f3d2824..04d8dee463 100644 --- a/examples/qtquick/draganddrop/views/gridview.qml +++ b/examples/qtquick/draganddrop/views/gridview.qml @@ -42,8 +42,8 @@ import QtQuick 2.0 GridView { id: root - width: 360; height: 360 - cellWidth: 90; cellHeight: 90 + width: 320; height: 480 + cellWidth: 80; cellHeight: 80 model: VisualDataModel { id: visualModel @@ -61,10 +61,18 @@ GridView { ListElement { color: "aquamarine" } ListElement { color: "indigo" } ListElement { color: "black" } - ListElement { color: "chartreuse" } + ListElement { color: "lightsteelblue" } ListElement { color: "violet" } ListElement { color: "grey" } ListElement { color: "springgreen" } + ListElement { color: "salmon" } + ListElement { color: "blanchedalmond" } + ListElement { color: "forestgreen" } + ListElement { color: "pink" } + ListElement { color: "navy" } + ListElement { color: "goldenrod" } + ListElement { color: "crimson" } + ListElement { color: "teal" } } delegate: MouseArea { @@ -72,12 +80,12 @@ GridView { property int visualIndex: VisualDataModel.itemsIndex - width: 90; height: 90 + width: 80; height: 80 drag.target: icon Rectangle { id: icon - width: 80; height: 80 + width: 72; height: 72 anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter @@ -87,8 +95,8 @@ GridView { Drag.active: delegateRoot.pressed Drag.source: delegateRoot - Drag.hotSpot.x: 40 - Drag.hotSpot.y: 40 + Drag.hotSpot.x: 36 + Drag.hotSpot.y: 36 states: [ State { diff --git a/examples/qtquick/qtquick.pro b/examples/qtquick/qtquick.pro index 2ffc377f32..529f65ac25 100644 --- a/examples/qtquick/qtquick.pro +++ b/examples/qtquick/qtquick.pro @@ -1,8 +1,8 @@ TEMPLATE = subdirs SUBDIRS = accessibility \ - animation + animation \ + draganddrop #canvas \ - #draganddrop \ #imageelements \ #keyinteraction \ #modelviews \ From 01bfcfba0287fa7e9e051e2540ebbdb01fee5a9e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 28 Feb 2012 11:30:16 +1000 Subject: [PATCH 41/82] Move some toys back to examples tvtennis, corkboards and dynamicscene are more examples than demos. clocks and tic-tac-toe are remaining demos for now. Change-Id: I3d9501a4742349a9eb7efdad0d06aa6e7cb02c14 Reviewed-by: Michael Brasser --- .../{demos => qml}/dynamicscene/content/Button.qml | 0 .../dynamicscene/content/GenericSceneItem.qml | 0 .../dynamicscene/content/PaletteItem.qml | 0 .../dynamicscene/content/PerspectiveItem.qml | 0 .../{demos => qml}/dynamicscene/content/Sun.qml | 0 .../{demos => qml}/dynamicscene/content/images/NOTE | 0 .../dynamicscene/content/images/face-smile.png | Bin .../dynamicscene/content/images/moon.png | Bin .../dynamicscene/content/images/rabbit_brown.png | Bin .../dynamicscene/content/images/rabbit_bw.png | Bin .../dynamicscene/content/images/star.png | Bin .../dynamicscene/content/images/sun.png | Bin .../dynamicscene/content/images/tree_s.png | Bin .../dynamicscene/content/itemCreation.js | 0 .../{demos => qml}/dynamicscene/dynamicscene.qml | 0 examples/qtquick/animation/animation.qml | 3 +++ .../animation/behaviors}/tvtennis.qml | 2 +- .../touchinteraction/flickable}/content/Day.qml | 0 .../touchinteraction/flickable}/content/cork.jpg | Bin .../flickable}/content/note-yellow.png | Bin .../touchinteraction/flickable}/content/tack.png | Bin .../touchinteraction/flickable}/corkboards.qml | 0 22 files changed, 4 insertions(+), 1 deletion(-) rename examples/{demos => qml}/dynamicscene/content/Button.qml (100%) rename examples/{demos => qml}/dynamicscene/content/GenericSceneItem.qml (100%) rename examples/{demos => qml}/dynamicscene/content/PaletteItem.qml (100%) rename examples/{demos => qml}/dynamicscene/content/PerspectiveItem.qml (100%) rename examples/{demos => qml}/dynamicscene/content/Sun.qml (100%) rename examples/{demos => qml}/dynamicscene/content/images/NOTE (100%) rename examples/{demos => qml}/dynamicscene/content/images/face-smile.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/moon.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/rabbit_brown.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/rabbit_bw.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/star.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/sun.png (100%) rename examples/{demos => qml}/dynamicscene/content/images/tree_s.png (100%) rename examples/{demos => qml}/dynamicscene/content/itemCreation.js (100%) rename examples/{demos => qml}/dynamicscene/dynamicscene.qml (100%) rename examples/{demos/tvtennis => qtquick/animation/behaviors}/tvtennis.qml (99%) rename examples/{demos/corkboards => qtquick/touchinteraction/flickable}/content/Day.qml (100%) rename examples/{demos/corkboards => qtquick/touchinteraction/flickable}/content/cork.jpg (100%) rename examples/{demos/corkboards => qtquick/touchinteraction/flickable}/content/note-yellow.png (100%) rename examples/{demos/corkboards => qtquick/touchinteraction/flickable}/content/tack.png (100%) rename examples/{demos/corkboards => qtquick/touchinteraction/flickable}/corkboards.qml (100%) diff --git a/examples/demos/dynamicscene/content/Button.qml b/examples/qml/dynamicscene/content/Button.qml similarity index 100% rename from examples/demos/dynamicscene/content/Button.qml rename to examples/qml/dynamicscene/content/Button.qml diff --git a/examples/demos/dynamicscene/content/GenericSceneItem.qml b/examples/qml/dynamicscene/content/GenericSceneItem.qml similarity index 100% rename from examples/demos/dynamicscene/content/GenericSceneItem.qml rename to examples/qml/dynamicscene/content/GenericSceneItem.qml diff --git a/examples/demos/dynamicscene/content/PaletteItem.qml b/examples/qml/dynamicscene/content/PaletteItem.qml similarity index 100% rename from examples/demos/dynamicscene/content/PaletteItem.qml rename to examples/qml/dynamicscene/content/PaletteItem.qml diff --git a/examples/demos/dynamicscene/content/PerspectiveItem.qml b/examples/qml/dynamicscene/content/PerspectiveItem.qml similarity index 100% rename from examples/demos/dynamicscene/content/PerspectiveItem.qml rename to examples/qml/dynamicscene/content/PerspectiveItem.qml diff --git a/examples/demos/dynamicscene/content/Sun.qml b/examples/qml/dynamicscene/content/Sun.qml similarity index 100% rename from examples/demos/dynamicscene/content/Sun.qml rename to examples/qml/dynamicscene/content/Sun.qml diff --git a/examples/demos/dynamicscene/content/images/NOTE b/examples/qml/dynamicscene/content/images/NOTE similarity index 100% rename from examples/demos/dynamicscene/content/images/NOTE rename to examples/qml/dynamicscene/content/images/NOTE diff --git a/examples/demos/dynamicscene/content/images/face-smile.png b/examples/qml/dynamicscene/content/images/face-smile.png similarity index 100% rename from examples/demos/dynamicscene/content/images/face-smile.png rename to examples/qml/dynamicscene/content/images/face-smile.png diff --git a/examples/demos/dynamicscene/content/images/moon.png b/examples/qml/dynamicscene/content/images/moon.png similarity index 100% rename from examples/demos/dynamicscene/content/images/moon.png rename to examples/qml/dynamicscene/content/images/moon.png diff --git a/examples/demos/dynamicscene/content/images/rabbit_brown.png b/examples/qml/dynamicscene/content/images/rabbit_brown.png similarity index 100% rename from examples/demos/dynamicscene/content/images/rabbit_brown.png rename to examples/qml/dynamicscene/content/images/rabbit_brown.png diff --git a/examples/demos/dynamicscene/content/images/rabbit_bw.png b/examples/qml/dynamicscene/content/images/rabbit_bw.png similarity index 100% rename from examples/demos/dynamicscene/content/images/rabbit_bw.png rename to examples/qml/dynamicscene/content/images/rabbit_bw.png diff --git a/examples/demos/dynamicscene/content/images/star.png b/examples/qml/dynamicscene/content/images/star.png similarity index 100% rename from examples/demos/dynamicscene/content/images/star.png rename to examples/qml/dynamicscene/content/images/star.png diff --git a/examples/demos/dynamicscene/content/images/sun.png b/examples/qml/dynamicscene/content/images/sun.png similarity index 100% rename from examples/demos/dynamicscene/content/images/sun.png rename to examples/qml/dynamicscene/content/images/sun.png diff --git a/examples/demos/dynamicscene/content/images/tree_s.png b/examples/qml/dynamicscene/content/images/tree_s.png similarity index 100% rename from examples/demos/dynamicscene/content/images/tree_s.png rename to examples/qml/dynamicscene/content/images/tree_s.png diff --git a/examples/demos/dynamicscene/content/itemCreation.js b/examples/qml/dynamicscene/content/itemCreation.js similarity index 100% rename from examples/demos/dynamicscene/content/itemCreation.js rename to examples/qml/dynamicscene/content/itemCreation.js diff --git a/examples/demos/dynamicscene/dynamicscene.qml b/examples/qml/dynamicscene/dynamicscene.qml similarity index 100% rename from examples/demos/dynamicscene/dynamicscene.qml rename to examples/qml/dynamicscene/dynamicscene.qml diff --git a/examples/qtquick/animation/animation.qml b/examples/qtquick/animation/animation.qml index 62a85a9cfa..bca68457d9 100644 --- a/examples/qtquick/animation/animation.qml +++ b/examples/qtquick/animation/animation.qml @@ -58,6 +58,8 @@ import "../../shared" as Examples Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it. + Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game. + Easing Curves shows off all the easing curves available in Qt Quick animations. States demonstrates how the properties of an item can vary between states. @@ -80,6 +82,7 @@ Item { addExample("PropertyAnimation", "Interpolates between numbers", Qt.resolvedUrl("basics/property-animation.qml")); addExample("Behaviors", "Animates procedural movement", Qt.resolvedUrl("behaviors/behavior-example.qml")); addExample("Wiggly Text", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml")); + addExample("Tv Tennis", "Paddles that follow a ball", Qt.resolvedUrl("behaviors/tvtennis.qml")); addExample("Easing Curves", "Compare available easing curves", Qt.resolvedUrl("easing/easing.qml")); addExample("States", "Simple states", Qt.resolvedUrl("states/states.qml")); addExample("Transitions", "Simple states with animated transitions", Qt.resolvedUrl("states/transitions.qml")); diff --git a/examples/demos/tvtennis/tvtennis.qml b/examples/qtquick/animation/behaviors/tvtennis.qml similarity index 99% rename from examples/demos/tvtennis/tvtennis.qml rename to examples/qtquick/animation/behaviors/tvtennis.qml index 63866e3ce6..108f19a11d 100644 --- a/examples/demos/tvtennis/tvtennis.qml +++ b/examples/qtquick/animation/behaviors/tvtennis.qml @@ -42,7 +42,7 @@ import QtQuick 2.0 Rectangle { id: page - width: 640; height: 480 + width: 320; height: 480; color: "Black" // Make a ball to bounce diff --git a/examples/demos/corkboards/content/Day.qml b/examples/qtquick/touchinteraction/flickable/content/Day.qml similarity index 100% rename from examples/demos/corkboards/content/Day.qml rename to examples/qtquick/touchinteraction/flickable/content/Day.qml diff --git a/examples/demos/corkboards/content/cork.jpg b/examples/qtquick/touchinteraction/flickable/content/cork.jpg similarity index 100% rename from examples/demos/corkboards/content/cork.jpg rename to examples/qtquick/touchinteraction/flickable/content/cork.jpg diff --git a/examples/demos/corkboards/content/note-yellow.png b/examples/qtquick/touchinteraction/flickable/content/note-yellow.png similarity index 100% rename from examples/demos/corkboards/content/note-yellow.png rename to examples/qtquick/touchinteraction/flickable/content/note-yellow.png diff --git a/examples/demos/corkboards/content/tack.png b/examples/qtquick/touchinteraction/flickable/content/tack.png similarity index 100% rename from examples/demos/corkboards/content/tack.png rename to examples/qtquick/touchinteraction/flickable/content/tack.png diff --git a/examples/demos/corkboards/corkboards.qml b/examples/qtquick/touchinteraction/flickable/corkboards.qml similarity index 100% rename from examples/demos/corkboards/corkboards.qml rename to examples/qtquick/touchinteraction/flickable/corkboards.qml From 60cae093d7e27e92198d626dc3df19dea9799faf Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 28 Feb 2012 11:41:50 +1000 Subject: [PATCH 42/82] Examples guidelines have changes slightly Update docs to current thinking. Change-Id: Ide00240f4d779549eebdc81592f3f2104dfd759a Reviewed-by: Michael Brasser --- examples/HACKING | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/HACKING b/examples/HACKING index a3aa3e9a77..7eea4975ac 100644 --- a/examples/HACKING +++ b/examples/HACKING @@ -7,13 +7,13 @@ Snippets are snatches of QML code that won't even run on their own. They don't b Examples --- -Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements). The code should be held to a high level of quality, and should be understandable by people new to QML. +Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements. The code should be held to a high level of quality, and should be understandable by people new to QML. Unless the demonstrated feature uses it, assume no interface devices other than a screen that can show a 320x480 rectangle and a generic pointing device (with the shared subset of mouse/touch functionality). -Groups of similar examples should be placed in one folder with a single launcher application, which uses the QtQuick.Examples module for common components. +Groups of similar examples should be placed in one folder with a single launcher application, which uses the shared folder of common components. -The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher. +The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher. Usually this will consist primarily of using the macro found in shared.h. Demos --- From 328c100ab3fc4d5ddccb0d19af9d7e87bd849f0b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 21 Feb 2012 14:44:21 +1000 Subject: [PATCH 43/82] Separate view transition functionality into new file Move most of the view transition functionality from qquickitemview* into qquickitemviewtransition*. - Move QQuickViewTransitionAttached - Move QQuickItemViewTransitionManager, rename to QQuickItemViewTransitionJob - Move FxViewItem transition-specific features into new QQuickViewItem - Move transition-specific functions like transitionNextReposition() and canTransition() into QQuickItemViewTransitioner which holds all the transition objects now Also mention in docs that there's no defined order for choosing between multiple matching displaced transitions. Change-Id: I8701c0d40d2af152c5d432a4c8de646854c76ea2 Reviewed-by: Martin Jones --- src/quick/items/items.pri | 2 + src/quick/items/qquickgridview.cpp | 42 +- src/quick/items/qquickitemsmodule.cpp | 1 + src/quick/items/qquickitemview.cpp | 890 +++---------------- src/quick/items/qquickitemview_p.h | 44 - src/quick/items/qquickitemview_p_p.h | 88 +- src/quick/items/qquickitemviewtransition.cpp | 770 ++++++++++++++++ src/quick/items/qquickitemviewtransition_p.h | 201 +++++ src/quick/items/qquicklistview.cpp | 42 +- 9 files changed, 1159 insertions(+), 921 deletions(-) create mode 100644 src/quick/items/qquickitemviewtransition.cpp create mode 100644 src/quick/items/qquickitemviewtransition_p.h diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index 21bf7cc8c1..54220434b4 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -72,6 +72,7 @@ HEADERS += \ $$PWD/qquickmultipointtoucharea_p.h \ $$PWD/qquickitemview_p.h \ $$PWD/qquickitemview_p_p.h \ + $$PWD/qquickitemviewtransition_p.h \ $$PWD/qquickscreen_p.h \ $$PWD/qquickwindowmodule_p.h \ $$PWD/qquickwindowmanager_p.h @@ -124,6 +125,7 @@ SOURCES += \ $$PWD/qquickdroparea.cpp \ $$PWD/qquickmultipointtoucharea.cpp \ $$PWD/qquickitemview.cpp \ + $$PWD/qquickitemviewtransition.cpp \ $$PWD/qquickwindowmodule.cpp \ $$PWD/qquickscreen.cpp \ $$PWD/qquickwindowmanager.cpp diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index a7e0af487f..fbce0af0c3 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -127,9 +127,6 @@ class FxGridItemSG : public FxViewItem return (x >= itemX() && x < itemX() + view->cellWidth() && y >= itemY() && y < itemY() + view->cellHeight()); } - QQuickItemView *itemView() const { - return view; - } QQuickGridView *view; @@ -485,7 +482,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d #endif if (!(item = static_cast(createItem(modelIndex, doBuffer)))) break; - if (!canTransition(FxViewItemTransitionManager::PopulateTransition, true)) // pos will be set by layoutVisibleItems() + if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems() item->setPosition(colPos, rowPos); item->item->setVisible(!doBuffer); visibleItems.append(item); @@ -523,7 +520,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d if (!(item = static_cast(createItem(visibleIndex-1, doBuffer)))) break; --visibleIndex; - if (!canTransition(FxViewItemTransitionManager::PopulateTransition, true)) // pos will be set by layoutVisibleItems() + if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems() item->setPosition(colPos, rowPos); item->item->setVisible(!doBuffer); visibleItems.prepend(item); @@ -1674,6 +1671,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) the new item that has been added to the view; to animate the added items, set the \l add property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1737,6 +1738,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) the items that are the actual subjects of the move operation; to animate the moved items, set the \l move property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1804,6 +1809,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) the item that has actually been removed from the view; to animate the removed items, set the \l remove property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2112,10 +2121,12 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In FxViewItem *item = visibleItems.at(i); if (item->index != -1 && item->index >= modelIndex) { item->index += count; - if (change.isMove()) - transitionNextReposition(item, FxViewItemTransitionManager::MoveTransition, false); - else - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, false); + if (transitioner) { + if (change.isMove()) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false); + else + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, false); + } } } @@ -2146,7 +2157,8 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In insertResult->changedFirstItem = true; if (!change.isMove()) { addedItems->append(item); - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, true); + if (transitioner) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true); } insertResult->sizeChangesBeforeVisiblePos += rowSize(); } @@ -2179,11 +2191,12 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In if (change.isMove()) { // we know this is a move target, since move displaced items that are // shuffled into view due to a move would be added in refill() - if (canTransition(FxViewItemTransitionManager::MoveTransition, true) && newItem) + if (newItem && transitioner && transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, true)) movingIntoView->append(MovedItem(item, change.moveKey(item->index))); } else { addedItems->append(item); - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, true); + if (transitioner) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true); } insertResult->sizeChangesAfterVisiblePos += rowSize(); @@ -2204,6 +2217,9 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) { + if (!transitioner) + return; + int markerItemIndex = -1; for (int i=0; iindex == afterModelIndex) { @@ -2231,7 +2247,7 @@ void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex qreal origColPos = gridItem->rowPos(); int indexDiff = gridItem->index - countItemsRemoved; gridItem->setPosition((indexDiff % columns) * colSize(), (indexDiff / columns) * rowSize()); - transitionNextReposition(gridItem, FxViewItemTransitionManager::RemoveTransition, false); + transitioner->transitionNextReposition(gridItem, QQuickItemViewTransitioner::RemoveTransition, false); gridItem->setPosition(origRowPos, origColPos); } } diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index b9e401a231..f50237427b 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -61,6 +61,7 @@ #include "qquickvisualdatamodel_p.h" #include "qquickgridview_p.h" #include "qquickpathview_p.h" +#include "qquickitemviewtransition_p.h" #include #include #include "qquickpositioners_p.h" diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index d5ce567590..481a0d4360 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -46,21 +46,12 @@ QT_BEGIN_NAMESPACE FxViewItem::FxViewItem(QQuickItem *i, bool own) - : item(i), ownItem(own), releaseAfterTransition(false) - , isTransitionTarget(false) - , nextTransitionToSet(false) - , index(-1) - , transition(0) - , nextTransitionType(FxViewItemTransitionManager::NoTransition) + : QQuickViewItem(i), ownItem(own), releaseAfterTransition(false) { } FxViewItem::~FxViewItem() { - if (transition) - transition->m_item = 0; - delete transition; - if (ownItem && item) { item->setParentItem(0); item->deleteLater(); @@ -68,273 +59,6 @@ FxViewItem::~FxViewItem() } } -qreal FxViewItem::itemX() const -{ - if (nextTransitionType != FxViewItemTransitionManager::NoTransition) - return nextTransitionToSet ? nextTransitionTo.x() : item->x(); - else if (transition && transition->isActive()) - return transition->m_toPos.x(); - else - return item->x(); -} - -qreal FxViewItem::itemY() const -{ - // If item is transitioning to some pos, return that dest pos. - // If item was redirected to some new pos before the current transition finished, - // return that new pos. - if (nextTransitionType != FxViewItemTransitionManager::NoTransition) - return nextTransitionToSet ? nextTransitionTo.y() : item->y(); - else if (transition && transition->isActive()) - return transition->m_toPos.y(); - else - return item->y(); -} - -void FxViewItem::setVisible(bool visible) -{ - if (!visible && transitionScheduledOrRunning()) - return; - item->setVisible(visible); -} - -void FxViewItem::setNextTransition(FxViewItemTransitionManager::TransitionType type, bool isTargetItem) -{ - // Don't reset nextTransitionToSet - once it is set, it cannot be changed - // until the animation finishes since the itemX() and itemY() may be used - // to calculate positions for transitions for other items in the view. - nextTransitionType = type; - isTransitionTarget = isTargetItem; -} - -bool FxViewItem::transitionScheduledOrRunning() const -{ - return (transition && transition->isActive()) - || nextTransitionType != FxViewItemTransitionManager::NoTransition; -} - -bool FxViewItem::prepareTransition(const QRectF &viewBounds) -{ - bool doTransition = false; - - switch (nextTransitionType) { - case FxViewItemTransitionManager::NoTransition: - { - return false; - } - case FxViewItemTransitionManager::PopulateTransition: - { - return true; - } - case FxViewItemTransitionManager::AddTransition: - case FxViewItemTransitionManager::RemoveTransition: - // For Add targets, do transition if item is moving into visible area - // For Remove targets, do transition if item is currently in visible area - if (isTransitionTarget) { - doTransition = (nextTransitionType == FxViewItemTransitionManager::AddTransition) - ? viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())) - : viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())); - if (!doTransition) - item->setPos(nextTransitionTo); - } else { - if (viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) - || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height()))) { - doTransition = (nextTransitionTo != item->pos()); - } else { - item->setPos(nextTransitionTo); - } - } - break; - case FxViewItemTransitionManager::MoveTransition: - // do transition if moving from or into visible area - if (nextTransitionTo != item->pos()) { - doTransition = viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) - || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())); - if (!doTransition) - item->setPos(nextTransitionTo); - } - break; - } - - if (!doTransition) - resetTransitionData(); - return doTransition; -} - -void FxViewItem::startTransition() -{ - if (nextTransitionType == FxViewItemTransitionManager::NoTransition) - return; - - if (!transition || transition->m_type != nextTransitionType || transition->m_isTarget != isTransitionTarget) { - delete transition; - transition = new FxViewItemTransitionManager; - } - - // if item is not already moving somewhere, set it to not move anywhere - // so that removed items do not move to the default (0,0) - if (!nextTransitionToSet) - moveTo(item->pos()); - - transition->startTransition(this, nextTransitionType, nextTransitionTo, isTransitionTarget); - nextTransitionType = FxViewItemTransitionManager::NoTransition; -} - -void FxViewItem::stopTransition() -{ - if (transition) { - transition->cancel(); - delete transition; - transition = 0; - } - resetTransitionData(); - finishedTransition(); -} - -void FxViewItem::finishedTransition() -{ - nextTransitionToSet = false; - nextTransitionTo = QPointF(); - - if (releaseAfterTransition) { - QQuickItemViewPrivate *vp = static_cast(QObjectPrivate::get(itemView())); - vp->releasePendingTransition.removeOne(this); - vp->releaseItem(this); - } -} - -void FxViewItem::resetTransitionData() -{ - nextTransitionType = FxViewItemTransitionManager::NoTransition; - isTransitionTarget = false; - nextTransitionTo = QPointF(); - nextTransitionToSet = false; -} - -bool FxViewItem::isPendingRemoval() const -{ - if (nextTransitionType == FxViewItemTransitionManager::RemoveTransition) - return isTransitionTarget; - if (transition && transition->isActive() && transition->m_type == FxViewItemTransitionManager::RemoveTransition) - return transition->m_isTarget; - return false; -} - -void FxViewItem::moveTo(const QPointF &pos) -{ - if (transitionScheduledOrRunning()) { - nextTransitionTo = pos; - nextTransitionToSet = true; - } else { - item->setPos(pos); - } -} - - -FxViewItemTransitionManager::FxViewItemTransitionManager() - : m_active(false), m_item(0), m_type(FxViewItemTransitionManager::NoTransition), m_isTarget(false) -{ -} - -FxViewItemTransitionManager::~FxViewItemTransitionManager() -{ -} - -bool FxViewItemTransitionManager::isActive() const -{ - return m_active; -} - -void FxViewItemTransitionManager::startTransition(FxViewItem *item, FxViewItemTransitionManager::TransitionType type, const QPointF &to, bool isTargetItem) -{ - if (!item) { - qWarning("startTransition(): invalid item"); - return; - } - - QQuickItemViewPrivate *vp = static_cast(QObjectPrivate::get(item->itemView())); - - QDeclarativeTransition *trans = 0; - switch (type) { - case NoTransition: - break; - case PopulateTransition: - trans = vp->populateTransition; - break; - case AddTransition: - trans = isTargetItem ? vp->addTransition : vp->addDisplacedTransition; - break; - case MoveTransition: - trans = isTargetItem ? vp->moveTransition : vp->moveDisplacedTransition; - break; - case RemoveTransition: - trans = isTargetItem ? vp->removeTransition : vp->removeDisplacedTransition; - break; - } - - if (!trans) { - qWarning("QQuickItemView: invalid view transition!"); - return; - } - - m_active = true; - m_item = item; - m_toPos = to; - m_type = type; - m_isTarget = isTargetItem; - - QQuickViewTransitionAttached *attached = - static_cast(qmlAttachedPropertiesObject(trans)); - if (attached) { - attached->m_index = item->index; - attached->m_item = item->item; - attached->m_destination = to; - switch (type) { - case NoTransition: - break; - case PopulateTransition: - case AddTransition: - attached->m_targetIndexes = vp->addTransitionIndexes; - attached->m_targetItems = vp->addTransitionTargets; - break; - case MoveTransition: - attached->m_targetIndexes = vp->moveTransitionIndexes; - attached->m_targetItems = vp->moveTransitionTargets; - break; - case RemoveTransition: - attached->m_targetIndexes = vp->removeTransitionIndexes; - attached->m_targetItems = vp->removeTransitionTargets; - break; - } - emit attached->indexChanged(); - emit attached->itemChanged(); - emit attached->destinationChanged(); - emit attached->targetIndexesChanged(); - emit attached->targetItemsChanged(); - } - - QDeclarativeStateOperation::ActionList actions; - actions << QDeclarativeAction(item->item, QLatin1String("x"), QVariant(to.x())); - actions << QDeclarativeAction(item->item, QLatin1String("y"), QVariant(to.y())); - - QDeclarativeTransitionManager::transition(actions, trans, item->item); -} - -void FxViewItemTransitionManager::finished() -{ - QDeclarativeTransitionManager::finished(); - - m_active = false; - - if (m_item) - m_item->finishedTransition(); - m_item = 0; - m_toPos.setX(0); - m_toPos.setY(0); - m_type = NoTransition; - m_isTarget = false; -} - QQuickItemViewChangeSet::QQuickItemViewChangeSet() : active(false) @@ -413,363 +137,6 @@ void QQuickItemViewChangeSet::reset() currentRemoved = false; } - -QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) - : QObject(parent), m_index(-1), m_item(0) -{ -} -/*! - \qmlclass ViewTransition QQuickViewTransitionAttached - \inqmlmodule QtQuick 2 - \ingroup qml-view-elements - \brief The ViewTransition attached property provides details on items under transition in a view. - - With ListView and GridView, it is possible to specify transitions that should be applied whenever - the items in the view change as a result of modifications to the view's model. They both have the - following properties that can be set to the appropriate transitions to be run for various - operations: - - \list - \o \c add and \c addDisplaced - the transitions to run when items are added to the view - \o \c remove and \c removeDisplaced - the transitions to run when items are removed from the view - \o \c move and \c moveDisplaced - the transitions to run when items are moved within the view - (i.e. as a result of a move operation in the model) - \o \c populate - the transition to run when a view is created, or when the model changes - \endlist - - Such view transitions additionally have access to a ViewTransition attached property that - provides details of the items that are under transition and the operation that triggered the - transition. Since view transitions are run once per item, these details can be used to customise - each transition for each individual item. - - The ViewTransition attached property provides the following properties specific to the item to - which the transition is applied: - - \list - \o ViewTransition.item - the item that is under transition - \o ViewTransition.index - the index of this item - \o ViewTransition.destination - the (x,y) point to which this item is moving for the relevant view operation - \endlist - - In addition, ViewTransition provides properties specific to the items which are the target - of the operation that triggered the transition: - - \list - \o ViewTransition.targetIndexes - the indexes of the target items - \o ViewTransition.targetItems - the target items themselves - \endlist - - View transitions can be written without referring to any of the attributes listed - above. These attributes merely provide extra details that are useful for customising view - transitions. - - Following is an introduction to view transitions and the ways in which the ViewTransition - attached property can be used to augment view transitions. - - - \section2 View transitions: a simple example - - Here is a basic example of the use of view transitions. The view below specifies transitions for - the \c add and \c addDisplaced properties, which will be run when items are added to the view: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml 0 - - When the space key is pressed, adding an item to the model, the new item will fade in and - increase in scale over 400 milliseconds as it is added to the view. Also, any item that is - displaced by the addition of a new item will animate to its new position in the view over - 400 milliseconds, as specified by the \c addDisplaced transition. - - If five items were inserted in succession at index 0, the effect would be this: - - \image viewtransitions-basic.gif - - Notice that the NumberAnimation objects above do not need to specify a \c target to animate - the appropriate item. Also, the NumberAnimation in the \c addTransition does not need to specify - the \c to value to move the item to its correct position in the view. This is because the view - implicitly sets the \c target and \c to values with the correct item and final item position - values if these properties are not explicitly defined. - - At its simplest, a view transition may just animate an item to its new position following a - view operation, just as the \c addDisplaced transition does above, or animate some item properties, - as in the \c add transition above. Additionally, a view transition may make use of the - ViewTransition attached property to customise animation behavior for different items. Following - are some examples of how this can be achieved. - - - \section2 Using the ViewTransition attached property - - As stated, the various ViewTransition properties provide details specific to the individual item - being transitioned as well as the operation that triggered the transition. In the animation above, - five items are inserted in succession at index 0. When the fifth and final insertion takes place, - adding "Item 4" to the view, the \c add transition is run once (for the inserted item) and the - \c addDisplaced transition is run four times (once for each of the four existing items in the view). - - At this point, if we examined the \c addDisplaced transition that was run for the bottom displaced - item ("Item 0"), the ViewTransition property values provided to this transition would be as follows: - - \table - \header - \o Property - \o Value - \o Explanation - \row - \o ViewTransition.item - \o "Item 0" delegate instance - \o The "Item 0" \l Rectangle object itself - \row - \o ViewTransition.index - \o \c int value of 4 - \o The index of "Item 0" within the model following the add operation - \row - \o ViewTransition.destination - \o \l point value of (0, 120) - \o The position that "Item 0" is moving to - \row - \o ViewTransition.targetIndexes - \o \c int array, just contains the integer "0" (zero) - \o The index of "Item 4", the new item added to the view - \row - \o ViewTransition.targetItems - \o object array, just contains the "Item 4" delegate instance - \o The "Item 4" \l Rectangle object - the new item added to the view - \endtable - - The ViewTransition.targetIndexes and ViewTransition.targetItems lists provide the items and - indexes of all delegate instances that are the targets of the relevant operation. For an add - operation, these are all the items that are added into the view; for a remove, these are all - the items removed from the view, and so on. (Note these lists will only contain references to - items that have been created within the view or its cached items; targets that are not within - the visible area of the view or within the item cache will not be accessible.) - - So, while the ViewTransition.item, ViewTransition.index and ViewTransition.destination values - vary for each individual transition that is run, the ViewTransition.targetIndexes and - ViewTransition.targetItems values are the same for every \c add and \c addDisplaced transition - that is triggered by a particular add operation. - - - \section3 Delaying animations based on index - - Since each view transition is run once for each item affected by the transition, the ViewTransition - properties can be used within a transition to define custom behavior for each item's transition. - For example, the ListView in the previous example could use this information to create a ripple-type - effect on the movement of the displaced items. - - This can be achieved by modifying the \c addDisplaced transition so that it delays the animation of - each displaced item based on the difference between its index (provided by ViewTransition.index) - and the first removed index (provided by ViewTransition.targetIndexes): - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml 0 - - Each displaced item delays its animation by an additional 100 milliseconds, producing a subtle - ripple-type effect when items are displaced by the add, like this: - - \image viewtransitions-delayedbyindex.gif - - - \section3 Animating items to intermediate positions - - The ViewTransition.item property gives a reference to the item to which the transition is being - applied. This can be used to access any of the item's attributes, custom \c property values, - and so on. - - Below is a modification of the \c addDisplaced transition from the previous example. It adds a - ParallelAnimation with nested NumberAnimation objects that reference ViewTransition.item to access - each item's \c x and \c y values at the start of their transitions. This allows each item to - animate to an intermediate position relative to its starting point for the transition, before - animating to its final position in the view: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml 0 - - Now, a displaced item will first move to a position of (20, 50) relative to its starting - position, and then to its final, correct position in the view: - - \image viewtransitions-intermediatemove.gif - - Since the final NumberAnimation does not specify a \c to value, the view implicitly sets this - value to the item's final position in the view, and so this last animation will move this item - to the correct place. If the transition requires the final position of the item for some calculation, - this is accessible through ViewTransition.destination. - - Instead of using multiple NumberAnimations, you could use a PathAnimation to animate an item over - a curved path. For example, the \c add transition in the previous example could be augmented with - a PathAnimation as follows: to animate newly added items along a path: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml 0 - - This animates newly added items along a path. Notice that each path is specified relative to - each item's final destination point, so that items inserted at different indexes start their - paths from different positions: - - \image viewtransitions-pathanim.gif - - - \section2 Handling interrupted animations - - A view transition may be interrupted at any time if a different view transition needs to be - applied while the original transition is in progress. For example, say Item A is inserted at index 0 - and undergoes an "add" transition; then, Item B is inserted at index 0 in quick succession before - Item A's transition has finished. Since Item B is inserted before Item A, it will displace Item - A, causing the view to interrupt Item A's "add" transition mid-way and start an "addDisplaced" - transition on Item A instead. - - For simple animations that simply animate an item's movement to its final destination, this - interruption is unlikely to require additional consideration. However, if a transition changes other - properties, this interruption may cause unwanted side effects. Consider the first example on this - page, repeated below for convenience: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml 0 - - If multiple items are added in rapid succession, without waiting for a previous transition - to finish, this is the result: - - \image viewtransitions-interruptedbad.gif - - Each newly added item undergoes an \c add transition, but before the transition can finish, - another item is added, displacing the previously added item. Because of this, the \c add - transition on the previously added item is interrupted and an \c addDisplaced transition is - started on the item instead. Due to the interruption, the \c opacity and \c scale animations - have not completed, thus producing items with opacity and scale that are below 1.0. - - To fix this, the \c addDisplaced transition should additionally ensure the item properties are - set to the end values specified in the \c add transition, effectively resetting these values - whenever an item is displaced. In this case, it means setting the item opacity and scale to 1.0: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml 0 - - Now, when an item's \c add transition is interrupted, its opacity and scale are animated to 1.0 - upon displacement, avoiding the erroneous visual effects from before: - - \image viewtransitions-interruptedgood.gif - - The same principle applies to any combination of view transitions. An added item may be moved - before its add transition finishes, or a moved item may be removed before its moved transition - finishes, and so on; so, the rule of thumb is that every transition should handle the same set of - properties. - - - \section2 Restrictions regarding ScriptAction - - When a view transition is initialized, any property bindings that refer to the ViewTransition - attached property are evaluated in preparation for the transition. Due to the nature of the - internal construction of a view transition, the attributes of the ViewTransition attached - property are only valid for the relevant item when the transition is initialized, and may not be - valid when the transition is actually run. - - Therefore, a ScriptAction within a view transition should not refer to the ViewTransition - attached property, as it may not refer to the expected values at the time that the ScriptAction - is actually invoked. Consider the following example: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml 0 - - When the space key is pressed, three items are moved from index 5 to index 1. For each moved - item, the \c moveTransition sequence presumably animates the item's color to "yellow", then - animates it to its final position, then changes the item color back to "lightsteelblue" using a - ScriptAction. However, when run, the transition does not produce the intended result: - - \image viewtransitions-scriptactionbad.gif - - Only the last moved item is returned to the "lightsteelblue" color; the others remain yellow. This - is because the ScriptAction is not run until after the transition has already been initialized, by - which time the ViewTransition.item value has changed to refer to a different item; the item that - the script had intended to refer to is not the one held by ViewTransition.item at the time the - ScriptAction is actually invoked. - - In this instance, to avoid this issue, the view could set the property using a PropertyAction - instead: - - \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml 0 - - When the transition is initialized, the PropertyAction \c target will be set to the respective - ViewTransition.item for the transition and will later run with the correct item target as - expected. - */ - -/*! - \qmlattachedproperty list QtQuick2::ViewTransition::index - - This attached property holds the index of the item that is being - transitioned. - - Note that if the item is being moved, this property holds the index that - the item is moving to, not from. -*/ - -/*! - \qmlattachedproperty list QtQuick2::ViewTransition::item - - This attached property holds the the item that is being transitioned. - - \warning This item should not be kept and referred to outside of the transition - as it may become invalid as the view changes. -*/ - -/*! - \qmlattachedproperty list QtQuick2::ViewTransition::destination - - This attached property holds the final destination position for the transitioned - item within the view. - - This property value is a \l point with \c x and \c y properties. -*/ - -/*! - \qmlattachedproperty list QtQuick2::ViewTransition::targetIndexes - - This attached property holds a list of the indexes of the items in view - that are the target of the relevant operation. - - The targets are the items that are the subject of the operation. For - an add operation, these are the items being added; for a remove, these - are the items being removed; for a move, these are the items being - moved. - - For example, if the transition was triggered by an insert operation - that added two items at index 1 and 2, this targetIndexes list would - have the value [1,2]. - - \note The targetIndexes list only contains the indexes of items that are actually - in view, or will be in the view once the relevant operation completes. - - \sa QtQuick2::ViewTransition::targetIndexes -*/ - -/*! - \qmlattachedproperty list QtQuick2::ViewTransition::targetItems - - This attached property holds the list of items in view that are the - target of the relevant operation. - - The targets are the items that are the subject of the operation. For - an add operation, these are the items being added; for a remove, these - are the items being removed; for a move, these are the items being - moved. - - For example, if the transition was triggered by an insert operation - that added two items at index 1 and 2, this targetItems list would - contain these two items. - - \note The targetItems list only contains items that are actually - in view, or will be in the view once the relevant operation completes. - - \warning The objects in this list should not be kept and referred to - outside of the transition as the items may become invalid. The targetItems - are only valid when the Transition is initially created; this also means - they should not be used by ScriptAction objects in the Transition, which are - not evaluated until the transition is run. - - \sa QtQuick2::ViewTransition::targetIndexes -*/ -QDeclarativeListProperty QQuickViewTransitionAttached::targetItems() -{ - return QDeclarativeListProperty(this, m_targetItems); -} - -QQuickViewTransitionAttached *QQuickViewTransitionAttached::qmlAttachedProperties(QObject *obj) -{ - return new QQuickViewTransitionAttached(obj); -} - - //----------------------------------- QQuickItemView::QQuickItemView(QQuickFlickablePrivate &dd, QQuickItem *parent) @@ -868,9 +235,9 @@ void QQuickItemView::setModel(const QVariant &model) } d->updateViewport(); - if (d->populateTransition) { + if (d->transitioner && d->transitioner->populateTransition) { d->forceLayout = true; - d->usePopulateTransition = true; + d->transitioner->setPopulateTransitionEnabled(true); polish(); } } @@ -1229,14 +596,15 @@ void QQuickItemView::setHighlightMoveDuration(int duration) QDeclarativeTransition *QQuickItemView::populateTransition() const { Q_D(const QQuickItemView); - return d->populateTransition; + return d->transitioner ? d->transitioner->populateTransition : 0; } void QQuickItemView::setPopulateTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->populateTransition != transition) { - d->populateTransition = transition; + d->createTransitioner(); + if (d->transitioner->populateTransition != transition) { + d->transitioner->populateTransition = transition; emit populateTransitionChanged(); } } @@ -1244,14 +612,15 @@ void QQuickItemView::setPopulateTransition(QDeclarativeTransition *transition) QDeclarativeTransition *QQuickItemView::addTransition() const { Q_D(const QQuickItemView); - return d->addTransition; + return d->transitioner ? d->transitioner->addTransition : 0; } void QQuickItemView::setAddTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->addTransition != transition) { - d->addTransition = transition; + d->createTransitioner(); + if (d->transitioner->addTransition != transition) { + d->transitioner->addTransition = transition; emit addTransitionChanged(); } } @@ -1259,14 +628,15 @@ void QQuickItemView::setAddTransition(QDeclarativeTransition *transition) QDeclarativeTransition *QQuickItemView::addDisplacedTransition() const { Q_D(const QQuickItemView); - return d->addDisplacedTransition; + return d->transitioner ? d->transitioner->addDisplacedTransition : 0; } void QQuickItemView::setAddDisplacedTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->addDisplacedTransition != transition) { - d->addDisplacedTransition = transition; + d->createTransitioner(); + if (d->transitioner->addDisplacedTransition != transition) { + d->transitioner->addDisplacedTransition = transition; emit addDisplacedTransitionChanged(); } } @@ -1274,14 +644,15 @@ void QQuickItemView::setAddDisplacedTransition(QDeclarativeTransition *transitio QDeclarativeTransition *QQuickItemView::moveTransition() const { Q_D(const QQuickItemView); - return d->moveTransition; + return d->transitioner ? d->transitioner->moveTransition : 0; } void QQuickItemView::setMoveTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->moveTransition != transition) { - d->moveTransition = transition; + d->createTransitioner(); + if (d->transitioner->moveTransition != transition) { + d->transitioner->moveTransition = transition; emit moveTransitionChanged(); } } @@ -1289,14 +660,15 @@ void QQuickItemView::setMoveTransition(QDeclarativeTransition *transition) QDeclarativeTransition *QQuickItemView::moveDisplacedTransition() const { Q_D(const QQuickItemView); - return d->moveDisplacedTransition; + return d->transitioner ? d->transitioner->moveDisplacedTransition : 0; } void QQuickItemView::setMoveDisplacedTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->moveDisplacedTransition != transition) { - d->moveDisplacedTransition = transition; + d->createTransitioner(); + if (d->transitioner->moveDisplacedTransition != transition) { + d->transitioner->moveDisplacedTransition = transition; emit moveDisplacedTransitionChanged(); } } @@ -1304,14 +676,15 @@ void QQuickItemView::setMoveDisplacedTransition(QDeclarativeTransition *transiti QDeclarativeTransition *QQuickItemView::removeTransition() const { Q_D(const QQuickItemView); - return d->removeTransition; + return d->transitioner ? d->transitioner->removeTransition : 0; } void QQuickItemView::setRemoveTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->removeTransition != transition) { - d->removeTransition = transition; + d->createTransitioner(); + if (d->transitioner->removeTransition != transition) { + d->transitioner->removeTransition = transition; emit removeTransitionChanged(); } } @@ -1319,14 +692,15 @@ void QQuickItemView::setRemoveTransition(QDeclarativeTransition *transition) QDeclarativeTransition *QQuickItemView::removeDisplacedTransition() const { Q_D(const QQuickItemView); - return d->removeDisplacedTransition; + return d->transitioner ? d->transitioner->removeDisplacedTransition : 0; } void QQuickItemView::setRemoveDisplacedTransition(QDeclarativeTransition *transition) { Q_D(QQuickItemView); - if (d->removeDisplacedTransition != transition) { - d->removeDisplacedTransition = transition; + d->createTransitioner(); + if (d->transitioner->removeDisplacedTransition != transition) { + d->transitioner->removeDisplacedTransition = transition; emit removeDisplacedTransitionChanged(); } } @@ -1465,64 +839,6 @@ void QQuickItemViewPrivate::applyPendingChanges() layout(); } -bool QQuickItemViewPrivate::canTransition(FxViewItemTransitionManager::TransitionType type, bool asTarget) const -{ - switch (type) { - case FxViewItemTransitionManager::NoTransition: - break; - case FxViewItemTransitionManager::PopulateTransition: - return usePopulateTransition - && populateTransition && populateTransition->enabled(); - case FxViewItemTransitionManager::AddTransition: - if (asTarget) - return addTransition && addTransition->enabled(); - else - return addDisplacedTransition && addDisplacedTransition->enabled(); - case FxViewItemTransitionManager::MoveTransition: - if (asTarget) - return moveTransition && moveTransition->enabled(); - else - return moveDisplacedTransition && moveDisplacedTransition->enabled(); - case FxViewItemTransitionManager::RemoveTransition: - if (asTarget) - return removeTransition && removeTransition->enabled(); - else - return removeDisplacedTransition && removeDisplacedTransition->enabled(); - } - return false; -} - -bool QQuickItemViewPrivate::hasItemTransitions() const -{ - return canTransition(FxViewItemTransitionManager::PopulateTransition, true) - || canTransition(FxViewItemTransitionManager::AddTransition, true) - || canTransition(FxViewItemTransitionManager::AddTransition, false) - || canTransition(FxViewItemTransitionManager::MoveTransition, true) - || canTransition(FxViewItemTransitionManager::MoveTransition, false) - || canTransition(FxViewItemTransitionManager::RemoveTransition, true) - || canTransition(FxViewItemTransitionManager::RemoveTransition, false); -} - -void QQuickItemViewPrivate::transitionNextReposition(FxViewItem *item, FxViewItemTransitionManager::TransitionType type, bool isTarget) -{ - bool matchedTransition = false; - if (type == FxViewItemTransitionManager::AddTransition) { - // don't run add transitions for added items while populating - matchedTransition = !usePopulateTransition && canTransition(type, isTarget); - } else { - matchedTransition = canTransition(type, isTarget); - } - - if (matchedTransition) { - item->setNextTransition(type, isTarget); - } else { - // the requested transition type is not valid, but the item is scheduled/in another - // transition, so cancel it to allow the item to move directly to the correct pos - if (item->transitionScheduledOrRunning()) - item->stopTransition(); - } -} - int QQuickItemViewPrivate::findMoveKeyIndex(QDeclarativeChangeSet::MoveKey key, const QVector &changes) const { for (int i=0; itransition && actualItem->transition->isRunning()) + FxViewItem *actualItem = transitioner ? visibleItem(currentIndex) : 0; + if (actualItem && actualItem->transitionRunning()) disableLayout = true; } updateHighlight(); @@ -1602,7 +918,7 @@ void QQuickItemView::destroyRemoved() it != d->visibleItems.end();) { FxViewItem *item = *it; if (item->index == -1 && item->attached->delayRemove() == false) { - if (d->canTransition(FxViewItemTransitionManager::RemoveTransition, true)) { + if (d->transitioner && d->transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, true)) { // don't remove from visibleItems until next layout() d->runDelayedRemoveTransition = true; QObject::disconnect(item->attached, SIGNAL(delayRemoveChanged()), this, SLOT(destroyRemoved())); @@ -1626,7 +942,8 @@ void QQuickItemView::modelUpdated(const QDeclarativeChangeSet &changeSet, bool r { Q_D(QQuickItemView); if (reset) { - d->usePopulateTransition = true; + if (d->transitioner) + d->transitioner->setPopulateTransitionEnabled(true); d->moveReason = QQuickItemViewPrivate::SetIndex; d->regenerate(); if (d->highlight && d->currentItem) { @@ -1636,7 +953,7 @@ void QQuickItemView::modelUpdated(const QDeclarativeChangeSet &changeSet, bool r } d->moveReason = QQuickItemViewPrivate::Other; emit countChanged(); - if (d->populateTransition) { + if (d->transitioner && d->transitioner->populateTransition) { d->forceLayout = true; polish(); } @@ -1936,7 +1253,8 @@ void QQuickItemView::componentComplete() d->updateFooter(); d->updateViewport(); d->setPosition(d->contentStartOffset()); - d->usePopulateTransition = true; + if (d->transitioner) + d->transitioner->setPopulateTransitionEnabled(true); if (d->isValid()) { d->refill(); @@ -1972,19 +1290,21 @@ QQuickItemViewPrivate::QQuickItemViewPrivate() , highlightRangeStart(0), highlightRangeEnd(0) , highlightMoveDuration(150) , headerComponent(0), header(0), footerComponent(0), footer(0) - , populateTransition(0) - , addTransition(0), addDisplacedTransition(0) - , moveTransition(0), moveDisplacedTransition(0) - , removeTransition(0), removeDisplacedTransition(0) + , transitioner(0) , minExtent(0), maxExtent(0) , ownModel(false), wrap(false) , disableLayout(false), inViewportMoved(false), forceLayout(false), currentIndexCleared(false) , haveHighlightRange(false), autoHighlight(true), highlightRangeStartValid(false), highlightRangeEndValid(false) , fillCacheBuffer(false), inRequest(false), requestedAsync(false) - , usePopulateTransition(false), runDelayedRemoveTransition(false) + , runDelayedRemoveTransition(false) { } +QQuickItemViewPrivate::~QQuickItemViewPrivate() +{ + delete transitioner; +} + bool QQuickItemViewPrivate::isValid() const { return model && model->count() && model->isValid(); @@ -2267,15 +1587,17 @@ void QQuickItemViewPrivate::layout() if (!isValid() && !visibleItems.count()) { clear(); setPosition(contentStartOffset()); - usePopulateTransition = false; + if (transitioner) + transitioner->setPopulateTransitionEnabled(false); return; } - if (runDelayedRemoveTransition && canTransition(FxViewItemTransitionManager::RemoveTransition, false)) { + if (runDelayedRemoveTransition && transitioner + && transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, false)) { // assume that any items moving now are moving due to the remove - if they schedule // a different transition, that will override this one anyway for (int i=0; itransitionNextReposition(visibleItems[i], QQuickItemViewTransitioner::RemoveTransition, false); } ChangeResult insertionPosChanges; @@ -2289,9 +1611,9 @@ void QQuickItemViewPrivate::layout() } forceLayout = false; - if (canTransition(FxViewItemTransitionManager::PopulateTransition, true)) { + if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) { for (int i=0; itransitionNextReposition(visibleItems.at(i), QQuickItemViewTransitioner::PopulateTransition, true); } layoutVisibleItems(); @@ -2310,11 +1632,11 @@ void QQuickItemViewPrivate::layout() updateViewport(); updateUnrequestedPositions(); - if (hasItemTransitions()) { + if (transitioner) { // items added in the last refill() may need to be transitioned in - e.g. a remove // causes items to slide up into view - if (canTransition(FxViewItemTransitionManager::MoveTransition, false) - || canTransition(FxViewItemTransitionManager::RemoveTransition, false)) { + if (transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, false) + || transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, false)) { translateAndTransitionItemsAfter(lastIndexInView, insertionPosChanges, removalPosChanges); } @@ -2324,8 +1646,7 @@ void QQuickItemViewPrivate::layout() for (QList::Iterator it = releasePendingTransition.begin(); it != releasePendingTransition.end(); ) { FxViewItem *item = *it; - if ( (item->transition && item->transition->isActive()) - || prepareNonVisibleItemTransition(item, viewBounds)) { + if (item->transitionRunning() || prepareNonVisibleItemTransition(item, viewBounds)) { ++it; } else { releaseItem(item); @@ -2334,11 +1655,12 @@ void QQuickItemViewPrivate::layout() } for (int i=0; istartTransition(); + visibleItems[i]->startTransition(transitioner); for (int i=0; istartTransition(); + releasePendingTransition[i]->startTransition(transitioner); + transitioner->setPopulateTransitionEnabled(false); } - usePopulateTransition = false; + runDelayedRemoveTransition = false; } @@ -2441,7 +1763,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult // for each item that was moved directly into the view as a result of a move(), // find the index it was moved from in order to set its initial position, so that we // can transition it from this "original" position to its new position in the view - if (canTransition(FxViewItemTransitionManager::MoveTransition, true)) { + if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, true)) { for (int i=0; i= 0) { @@ -2449,7 +1771,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult repositionItemAt(movingIntoView[i].item, fromIndex, -totalInsertionResult->sizeChangesAfterVisiblePos); else repositionItemAt(movingIntoView[i].item, fromIndex, totalInsertionResult->sizeChangesAfterVisiblePos); - transitionNextReposition(movingIntoView[i].item, FxViewItemTransitionManager::MoveTransition, true); + transitioner->transitionNextReposition(movingIntoView[i].item, QQuickItemViewTransitioner::MoveTransition, true); } } } @@ -2513,10 +1835,12 @@ bool QQuickItemViewPrivate::applyRemovalChange(const QDeclarativeChangeSet::Remo } else if (item->index >= removal.index + removal.count) { // after removed items item->index -= removal.count; - if (removal.isMove()) - transitionNextReposition(item, FxViewItemTransitionManager::MoveTransition, false); - else - transitionNextReposition(item, FxViewItemTransitionManager::RemoveTransition, false); + if (transitioner) { + if (removal.isMove()) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false); + else + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::RemoveTransition, false); + } ++it; } else { // removed item @@ -2550,7 +1874,8 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QDeclarativeChang } if (removal.isMove()) { currentChanges.removedItems.insert(removal.moveKey(item->index), item); - transitionNextReposition(item, FxViewItemTransitionManager::MoveTransition, true); + if (transitioner) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, true); } else { // track item so it is released later currentChanges.removedItems.insertMulti(QDeclarativeChangeSet::MoveKey(), item); @@ -2598,16 +1923,24 @@ void QQuickItemViewPrivate::repositionFirstItem(FxViewItem *prevVisibleItemsFirs } } +void QQuickItemViewPrivate::createTransitioner() +{ + if (!transitioner) { + transitioner = new QQuickItemViewTransitioner; + transitioner->setChangeListener(this); + } +} + void QQuickItemViewPrivate::prepareVisibleItemTransitions() { Q_Q(QQuickItemView); - if (!hasItemTransitions()) + if (!transitioner) return; - addTransitionIndexes.clear(); - addTransitionTargets.clear(); - moveTransitionIndexes.clear(); - moveTransitionTargets.clear(); + transitioner->addTransitionIndexes.clear(); + transitioner->addTransitionTargets.clear(); + transitioner->moveTransitionIndexes.clear(); + transitioner->moveTransitionTargets.clear(); QRectF viewBounds(0, position(), q->width(), q->height()); for (int i=0; iisTransitionTarget) { switch (visibleItems[i]->nextTransitionType) { - case FxViewItemTransitionManager::NoTransition: + case QQuickItemViewTransitioner::NoTransition: break; - case FxViewItemTransitionManager::PopulateTransition: - case FxViewItemTransitionManager::AddTransition: - addTransitionIndexes.append(visibleItems[i]->index); - addTransitionTargets.append(visibleItems[i]->item); + case QQuickItemViewTransitioner::PopulateTransition: + case QQuickItemViewTransitioner::AddTransition: + transitioner->addTransitionIndexes.append(visibleItems[i]->index); + transitioner->addTransitionTargets.append(visibleItems[i]->item); break; - case FxViewItemTransitionManager::MoveTransition: - moveTransitionIndexes.append(visibleItems[i]->index); - moveTransitionTargets.append(visibleItems[i]->item); + case QQuickItemViewTransitioner::MoveTransition: + transitioner->moveTransitionIndexes.append(visibleItems[i]->index); + transitioner->moveTransitionTargets.append(visibleItems[i]->item); break; - case FxViewItemTransitionManager::RemoveTransition: + case QQuickItemViewTransitioner::RemoveTransition: // removed targets won't be in visibleItems, handle these // in prepareNonVisibleItemTransition() break; @@ -2638,10 +1971,13 @@ void QQuickItemViewPrivate::prepareVisibleItemTransitions() void QQuickItemViewPrivate::prepareRemoveTransitions(QHash *removedItems) { - removeTransitionIndexes.clear(); - removeTransitionTargets.clear(); + if (!transitioner) + return; - if (canTransition(FxViewItemTransitionManager::RemoveTransition, true)) { + transitioner->removeTransitionIndexes.clear(); + transitioner->removeTransitionTargets.clear(); + + if (transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, true)) { for (QHash::Iterator it = removedItems->begin(); it != removedItems->end(); ) { bool isRemove = it.key().moveId < 0; @@ -2649,7 +1985,7 @@ void QQuickItemViewPrivate::prepareRemoveTransitions(QHashreleaseAfterTransition = true; releasePendingTransition.append(item); - transitionNextReposition(item, FxViewItemTransitionManager::RemoveTransition, true); + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::RemoveTransition, true); it = removedItems->erase(it); } else { ++it; @@ -2665,18 +2001,21 @@ bool QQuickItemViewPrivate::prepareNonVisibleItemTransition(FxViewItem *item, co // removed, or moved to outside of the view, as well as those that are // displaced to a position outside of the view due to an insert or move. - if (item->nextTransitionType == FxViewItemTransitionManager::MoveTransition) + if (!transitioner) + return false; + + if (item->nextTransitionType == QQuickItemViewTransitioner::MoveTransition) repositionItemAt(item, item->index, 0); if (!item->prepareTransition(viewBounds)) return false; if (item->isTransitionTarget) { - if (item->nextTransitionType == FxViewItemTransitionManager::MoveTransition) { - moveTransitionIndexes.append(item->index); - moveTransitionTargets.append(item->item); - } else if (item->nextTransitionType == FxViewItemTransitionManager::RemoveTransition) { - removeTransitionIndexes.append(item->index); - removeTransitionTargets.append(item->item); + if (item->nextTransitionType == QQuickItemViewTransitioner::MoveTransition) { + transitioner->moveTransitionIndexes.append(item->index); + transitioner->moveTransitionTargets.append(item->item); + } else if (item->nextTransitionType == QQuickItemViewTransitioner::RemoveTransition) { + transitioner->removeTransitionIndexes.append(item->index); + transitioner->removeTransitionTargets.append(item->item); } } @@ -2684,6 +2023,15 @@ bool QQuickItemViewPrivate::prepareNonVisibleItemTransition(FxViewItem *item, co return true; } +void QQuickItemViewPrivate::viewItemTransitionFinished(QQuickViewItem *i) +{ + FxViewItem *item = static_cast(i); + if (item->releaseAfterTransition) { + releasePendingTransition.removeOne(item); + releaseItem(item); + } +} + /* This may return 0 if the item is being created asynchronously. When the item becomes available, refill() will be called and the item diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 0d3cd1c3ce..63262f32ab 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -324,53 +324,9 @@ class Q_AUTOTEST_EXPORT QQuickItemViewAttached : public QObject QString m_nextSection; }; -class QQuickViewTransitionAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int index READ index NOTIFY indexChanged) - Q_PROPERTY(QQuickItem* item READ item NOTIFY itemChanged) - Q_PROPERTY(QPointF destination READ destination NOTIFY destinationChanged) - - Q_PROPERTY(QList targetIndexes READ targetIndexes NOTIFY targetIndexesChanged) - Q_PROPERTY(QDeclarativeListProperty targetItems READ targetItems NOTIFY targetItemsChanged) - -public: - QQuickViewTransitionAttached(QObject *parent); - - int index() const { return m_index; } - QQuickItem *item() const { return m_item; } - QPointF destination() const { return m_destination; } - - QList targetIndexes() const { return m_targetIndexes; } - QDeclarativeListProperty targetItems(); - - static QQuickViewTransitionAttached *qmlAttachedProperties(QObject *); - -signals: - void indexChanged(); - void itemChanged(); - void destinationChanged(); - - void targetIndexesChanged(); - void targetItemsChanged(); - -private: - friend class FxViewItemTransitionManager; - int m_index; - QQuickItem *m_item; - QPointF m_destination; - - QList m_targetIndexes; - QList m_targetItems; -}; - QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickViewTransitionAttached) -QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES) - QT_END_HEADER #endif // QQUICKITEMVIEW_P_H diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index fce6e4eba5..57860a43c6 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -43,10 +43,10 @@ #define QQUICKITEMVIEW_P_P_H #include "qquickitemview_p.h" +#include "qquickitemviewtransition_p.h" #include "qquickflickable_p_p.h" #include "qquickvisualdatamodel_p.h" #include "qquickvisualitemmodel_p.h" -#include #include @@ -57,55 +57,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class FxViewItem; -class FxViewItemTransitionManager : public QDeclarativeTransitionManager -{ -public: - enum TransitionType { - NoTransition, - PopulateTransition, - AddTransition, - MoveTransition, - RemoveTransition - }; - - FxViewItemTransitionManager(); - ~FxViewItemTransitionManager(); - - bool isActive() const; - void startTransition(FxViewItem *item, FxViewItemTransitionManager::TransitionType type, const QPointF &to, bool isTargetItem); - - bool m_active; - FxViewItem *m_item; - QPointF m_toPos; - FxViewItemTransitionManager::TransitionType m_type; - bool m_isTarget; - -protected: - virtual void finished(); -}; - - -class FxViewItem +class FxViewItem : public QQuickViewItem { public: FxViewItem(QQuickItem *, bool own); virtual ~FxViewItem(); - qreal itemX() const; - qreal itemY() const; - - void setVisible(bool visible); - - void setNextTransition(FxViewItemTransitionManager::TransitionType, bool isTargetItem); - bool transitionScheduledOrRunning() const; - bool isPendingRemoval() const; - - bool prepareTransition(const QRectF &viewBounds); - void startTransition(); - void stopTransition(); - void finishedTransition(); - // these are positions and sizes along the current direction of scrolling/flicking virtual qreal position() const = 0; virtual qreal endPosition() const = 0; @@ -113,23 +70,10 @@ class FxViewItem virtual qreal sectionSize() const = 0; virtual bool contains(qreal x, qreal y) const = 0; - virtual QQuickItemView *itemView() const = 0; - QQuickItem *item; + QQuickItemViewAttached *attached; bool ownItem; bool releaseAfterTransition; - bool isTransitionTarget; - bool nextTransitionToSet; - int index; - QQuickItemViewAttached *attached; - - FxViewItemTransitionManager *transition; - QPointF nextTransitionTo; - FxViewItemTransitionManager::TransitionType nextTransitionType; - -protected: - void moveTo(const QPointF &pos); - void resetTransitionData(); }; @@ -155,11 +99,12 @@ class QQuickItemViewChangeSet }; -class QQuickItemViewPrivate : public QQuickFlickablePrivate +class QQuickItemViewPrivate : public QQuickFlickablePrivate, public QQuickItemViewTransitionChangeListener { Q_DECLARE_PUBLIC(QQuickItemView) public: QQuickItemViewPrivate(); + ~QQuickItemViewPrivate(); struct ChangeResult { QDeclarativeNullableValue visiblePos; @@ -243,13 +188,12 @@ class QQuickItemViewPrivate : public QQuickFlickablePrivate void repositionFirstItem(FxViewItem *prevVisibleItemsFirst, qreal prevVisibleItemsFirstPos, FxViewItem *prevFirstVisible, ChangeResult *insertionResult, ChangeResult *removalResult); + void createTransitioner(); void prepareVisibleItemTransitions(); void prepareRemoveTransitions(QHash *removedItems); bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds); + virtual void viewItemTransitionFinished(QQuickViewItem *item); - bool canTransition(FxViewItemTransitionManager::TransitionType type, bool asTarget) const; - bool hasItemTransitions() const; - void transitionNextReposition(FxViewItem *item, FxViewItemTransitionManager::TransitionType type, bool isTarget); int findMoveKeyIndex(QDeclarativeChangeSet::MoveKey key, const QVector &changes) const; void checkVisible() const; @@ -281,7 +225,6 @@ class QQuickItemViewPrivate : public QQuickFlickablePrivate FxViewItem *requestedItem; QQuickItemViewChangeSet currentChanges; - // XXX split into struct QDeclarativeComponent *highlightComponent; FxViewItem *highlight; int highlightRange; // enum value @@ -294,27 +237,13 @@ class QQuickItemViewPrivate : public QQuickFlickablePrivate QDeclarativeComponent *footerComponent; FxViewItem *footer; - QDeclarativeTransition *populateTransition; - QDeclarativeTransition *addTransition; - QDeclarativeTransition *addDisplacedTransition; - QDeclarativeTransition *moveTransition; - QDeclarativeTransition *moveDisplacedTransition; - QDeclarativeTransition *removeTransition; - QDeclarativeTransition *removeDisplacedTransition; - - QList addTransitionIndexes; - QList moveTransitionIndexes; - QList removeTransitionIndexes; - QList addTransitionTargets; - QList moveTransitionTargets; - QList removeTransitionTargets; - struct MovedItem { FxViewItem *item; QDeclarativeChangeSet::MoveKey moveKey; MovedItem(FxViewItem *i, QDeclarativeChangeSet::MoveKey k) : item(i), moveKey(k) {} }; + QQuickItemViewTransitioner *transitioner; QList releasePendingTransition; mutable qreal minExtent; @@ -333,7 +262,6 @@ class QQuickItemViewPrivate : public QQuickFlickablePrivate bool fillCacheBuffer : 1; bool inRequest : 1; bool requestedAsync : 1; - bool usePopulateTransition : 1; bool runDelayedRemoveTransition : 1; protected: diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp new file mode 100644 index 0000000000..3e3a99f553 --- /dev/null +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -0,0 +1,770 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickitemviewtransition_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + + +class QQuickItemViewTransitionJob : public QDeclarativeTransitionManager +{ +public: + QQuickItemViewTransitionJob(QQuickItemViewTransitioner *transitioner); + ~QQuickItemViewTransitionJob(); + + void startTransition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem); + + QQuickItemViewTransitioner *m_transitioner; + QQuickViewItem *m_item; + QPointF m_toPos; + QQuickItemViewTransitioner::TransitionType m_type; + bool m_isTarget; + +protected: + virtual void finished(); +}; + + +QQuickItemViewTransitionJob::QQuickItemViewTransitionJob(QQuickItemViewTransitioner *transitioner) + : m_transitioner(transitioner) + , m_item(0), m_type(QQuickItemViewTransitioner::NoTransition), m_isTarget(false) +{ +} + +QQuickItemViewTransitionJob::~QQuickItemViewTransitionJob() +{ +} + +void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem) +{ + if (!item) { + qWarning("startTransition(): invalid item"); + return; + } + + QDeclarativeTransition *trans = 0; + switch (type) { + case QQuickItemViewTransitioner::NoTransition: + break; + case QQuickItemViewTransitioner::PopulateTransition: + trans = m_transitioner->populateTransition; + break; + case QQuickItemViewTransitioner::AddTransition: + trans = isTargetItem ? m_transitioner->addTransition : m_transitioner->addDisplacedTransition; + break; + case QQuickItemViewTransitioner::MoveTransition: + trans = isTargetItem ? m_transitioner->moveTransition : m_transitioner->moveDisplacedTransition; + break; + case QQuickItemViewTransitioner::RemoveTransition: + trans = isTargetItem ? m_transitioner->removeTransition : m_transitioner->removeDisplacedTransition; + break; + } + + if (!trans) { + qWarning("QQuickItemView: invalid view transition!"); + return; + } + + m_item = item; + m_toPos = to; + m_type = type; + m_isTarget = isTargetItem; + + QQuickViewTransitionAttached *attached = + static_cast(qmlAttachedPropertiesObject(trans)); + if (attached) { + attached->m_index = item->index; + attached->m_item = item->item; + attached->m_destination = to; + switch (type) { + case QQuickItemViewTransitioner::NoTransition: + break; + case QQuickItemViewTransitioner::PopulateTransition: + case QQuickItemViewTransitioner::AddTransition: + attached->m_targetIndexes = m_transitioner->addTransitionIndexes; + attached->m_targetItems = m_transitioner->addTransitionTargets; + break; + case QQuickItemViewTransitioner::MoveTransition: + attached->m_targetIndexes = m_transitioner->moveTransitionIndexes; + attached->m_targetItems = m_transitioner->moveTransitionTargets; + break; + case QQuickItemViewTransitioner::RemoveTransition: + attached->m_targetIndexes = m_transitioner->removeTransitionIndexes; + attached->m_targetItems = m_transitioner->removeTransitionTargets; + break; + } + emit attached->indexChanged(); + emit attached->itemChanged(); + emit attached->destinationChanged(); + emit attached->targetIndexesChanged(); + emit attached->targetItemsChanged(); + } + + QDeclarativeStateOperation::ActionList actions; + actions << QDeclarativeAction(item->item, QLatin1String("x"), QVariant(to.x())); + actions << QDeclarativeAction(item->item, QLatin1String("y"), QVariant(to.y())); + + QDeclarativeTransitionManager::transition(actions, trans, item->item); +} + +void QQuickItemViewTransitionJob::finished() +{ + QDeclarativeTransitionManager::finished(); + + if (m_item) + m_item->finishedTransition(); + if (m_transitioner) + m_transitioner->finishedTransition(m_item); + + m_item = 0; + m_toPos.setX(0); + m_toPos.setY(0); + m_type = QQuickItemViewTransitioner::NoTransition; + m_isTarget = false; +} + + +QQuickItemViewTransitioner::QQuickItemViewTransitioner() + : populateTransition(0) + , addTransition(0), addDisplacedTransition(0) + , moveTransition(0), moveDisplacedTransition(0) + , removeTransition(0), removeDisplacedTransition(0) + , changeListener(0) + , usePopulateTransition(false) +{ +} + +bool QQuickItemViewTransitioner::canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const +{ + switch (type) { + case QQuickItemViewTransitioner::NoTransition: + break; + case QQuickItemViewTransitioner::PopulateTransition: + return usePopulateTransition + && populateTransition && populateTransition->enabled(); + case QQuickItemViewTransitioner::AddTransition: + if (asTarget) + return addTransition && addTransition->enabled(); + else + return addDisplacedTransition && addDisplacedTransition->enabled(); + case QQuickItemViewTransitioner::MoveTransition: + if (asTarget) + return moveTransition && moveTransition->enabled(); + else + return moveDisplacedTransition && moveDisplacedTransition->enabled(); + case QQuickItemViewTransitioner::RemoveTransition: + if (asTarget) + return removeTransition && removeTransition->enabled(); + else + return removeDisplacedTransition && removeDisplacedTransition->enabled(); + } + return false; +} + +void QQuickItemViewTransitioner::transitionNextReposition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget) +{ + bool matchedTransition = false; + if (type == QQuickItemViewTransitioner::AddTransition) { + // don't run add transitions for added items while populating + if (usePopulateTransition) + matchedTransition = false; + else + matchedTransition = canTransition(type, isTarget); + } else { + matchedTransition = canTransition(type, isTarget); + } + + if (matchedTransition) { + item->setNextTransition(type, isTarget); + } else { + // the requested transition type is not valid, but the item is scheduled/in another + // transition, so cancel it to allow the item to move directly to the correct pos + if (item->transitionScheduledOrRunning()) + item->stopTransition(); + } +} + +void QQuickItemViewTransitioner::finishedTransition(QQuickViewItem *item) +{ + if (changeListener) + changeListener->viewItemTransitionFinished(item); +} + + +QQuickViewItem::QQuickViewItem(QQuickItem *i) + : item(i) + , transition(0) + , nextTransitionType(QQuickItemViewTransitioner::NoTransition) + , index(-1) + , isTransitionTarget(false) + , nextTransitionToSet(false) +{ +} + +QQuickViewItem::~QQuickViewItem() +{ + if (transition) { + transition->m_item = 0; + transition->m_transitioner = 0; + } + delete transition; +} + +qreal QQuickViewItem::itemX() const +{ + if (nextTransitionType != QQuickItemViewTransitioner::NoTransition) + return nextTransitionToSet ? nextTransitionTo.x() : item->x(); + else if (transition && transition->isRunning()) + return transition->m_toPos.x(); + else + return item->x(); +} + +qreal QQuickViewItem::itemY() const +{ + // If item is transitioning to some pos, return that dest pos. + // If item was redirected to some new pos before the current transition finished, + // return that new pos. + if (nextTransitionType != QQuickItemViewTransitioner::NoTransition) + return nextTransitionToSet ? nextTransitionTo.y() : item->y(); + else if (transition && transition->isRunning()) + return transition->m_toPos.y(); + else + return item->y(); +} + +void QQuickViewItem::moveTo(const QPointF &pos) +{ + if (transitionScheduledOrRunning()) { + nextTransitionTo = pos; + nextTransitionToSet = true; + } else { + item->setPos(pos); + } +} + +void QQuickViewItem::setVisible(bool visible) +{ + if (!visible && transitionScheduledOrRunning()) + return; + item->setVisible(visible); +} + +bool QQuickViewItem::transitionScheduledOrRunning() const +{ + return (transition && transition->isRunning()) + || nextTransitionType != QQuickItemViewTransitioner::NoTransition; +} + +bool QQuickViewItem::transitionRunning() const +{ + return (transition && transition->isRunning()); +} + +bool QQuickViewItem::isPendingRemoval() const +{ + if (nextTransitionType == QQuickItemViewTransitioner::RemoveTransition) + return isTransitionTarget; + if (transition && transition->isRunning() && transition->m_type == QQuickItemViewTransitioner::RemoveTransition) + return transition->m_isTarget; + return false; +} + +bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) +{ + bool doTransition = false; + + switch (nextTransitionType) { + case QQuickItemViewTransitioner::NoTransition: + { + return false; + } + case QQuickItemViewTransitioner::PopulateTransition: + { + return true; + } + case QQuickItemViewTransitioner::AddTransition: + case QQuickItemViewTransitioner::RemoveTransition: + // For Add targets, do transition if item is moving into visible area + // For Remove targets, do transition if item is currently in visible area + if (isTransitionTarget) { + doTransition = (nextTransitionType == QQuickItemViewTransitioner::AddTransition) + ? viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())) + : viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())); + if (!doTransition) + item->setPos(nextTransitionTo); + } else { + if (viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) + || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height()))) { + doTransition = (nextTransitionTo != item->pos()); + } else { + item->setPos(nextTransitionTo); + } + } + break; + case QQuickItemViewTransitioner::MoveTransition: + // do transition if moving from or into visible area + if (nextTransitionTo != item->pos()) { + doTransition = viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) + || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())); + if (!doTransition) + item->setPos(nextTransitionTo); + } + break; + } + + if (!doTransition) + resetTransitionData(); + return doTransition; +} + +void QQuickViewItem::startTransition(QQuickItemViewTransitioner *transitioner) +{ + if (nextTransitionType == QQuickItemViewTransitioner::NoTransition) + return; + + if (!transition || transition->m_type != nextTransitionType || transition->m_isTarget != isTransitionTarget) { + delete transition; + transition = new QQuickItemViewTransitionJob(transitioner); + } + + // if item is not already moving somewhere, set it to not move anywhere + // so that removed items do not move to the default (0,0) + if (!nextTransitionToSet) + moveTo(item->pos()); + + transition->startTransition(this, nextTransitionType, nextTransitionTo, isTransitionTarget); + nextTransitionType = QQuickItemViewTransitioner::NoTransition; +} + +void QQuickViewItem::stopTransition() +{ + if (transition) { + transition->cancel(); + delete transition; + transition = 0; + } + resetTransitionData(); + finishedTransition(); +} + +void QQuickViewItem::setNextTransition(QQuickItemViewTransitioner::TransitionType type, bool isTargetItem) +{ + // Don't reset nextTransitionToSet - once it is set, it cannot be changed + // until the animation finishes since the itemX() and itemY() may be used + // to calculate positions for transitions for other items in the view. + nextTransitionType = type; + isTransitionTarget = isTargetItem; +} + +void QQuickViewItem::finishedTransition() +{ + nextTransitionToSet = false; + nextTransitionTo = QPointF(); +} + +void QQuickViewItem::resetTransitionData() +{ + nextTransitionType = QQuickItemViewTransitioner::NoTransition; + isTransitionTarget = false; + nextTransitionTo = QPointF(); + nextTransitionToSet = false; +} + + +QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) + : QObject(parent), m_item(0), m_index(-1) +{ +} +/*! + \qmlclass ViewTransition QQuickViewTransitionAttached + \inqmlmodule QtQuick 2 + \ingroup qml-view-elements + \brief The ViewTransition attached property provides details on items under transition in a view. + + With ListView and GridView, it is possible to specify transitions that should be applied whenever + the items in the view change as a result of modifications to the view's model. They both have the + following properties that can be set to the appropriate transitions to be run for various + operations: + + \list + \o \c add and \c addDisplaced - the transitions to run when items are added to the view + \o \c remove and \c removeDisplaced - the transitions to run when items are removed from the view + \o \c move and \c moveDisplaced - the transitions to run when items are moved within the view + (i.e. as a result of a move operation in the model) + \o \c populate - the transition to run when a view is created, or when the model changes + \endlist + + Such view transitions additionally have access to a ViewTransition attached property that + provides details of the items that are under transition and the operation that triggered the + transition. Since view transitions are run once per item, these details can be used to customise + each transition for each individual item. + + The ViewTransition attached property provides the following properties specific to the item to + which the transition is applied: + + \list + \o ViewTransition.item - the item that is under transition + \o ViewTransition.index - the index of this item + \o ViewTransition.destination - the (x,y) point to which this item is moving for the relevant view operation + \endlist + + In addition, ViewTransition provides properties specific to the items which are the target + of the operation that triggered the transition: + + \list + \o ViewTransition.targetIndexes - the indexes of the target items + \o ViewTransition.targetItems - the target items themselves + \endlist + + View transitions can be written without referring to any of the attributes listed + above. These attributes merely provide extra details that are useful for customising view + transitions. + + Following is an introduction to view transitions and the ways in which the ViewTransition + attached property can be used to augment view transitions. + + + \section2 View transitions: a simple example + + Here is a basic example of the use of view transitions. The view below specifies transitions for + the \c add and \c addDisplaced properties, which will be run when items are added to the view: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml 0 + + When the space key is pressed, adding an item to the model, the new item will fade in and + increase in scale over 400 milliseconds as it is added to the view. Also, any item that is + displaced by the addition of a new item will animate to its new position in the view over + 400 milliseconds, as specified by the \c addDisplaced transition. + + If five items were inserted in succession at index 0, the effect would be this: + + \image viewtransitions-basic.gif + + Notice that the NumberAnimation objects above do not need to specify a \c target to animate + the appropriate item. Also, the NumberAnimation in the \c addTransition does not need to specify + the \c to value to move the item to its correct position in the view. This is because the view + implicitly sets the \c target and \c to values with the correct item and final item position + values if these properties are not explicitly defined. + + At its simplest, a view transition may just animate an item to its new position following a + view operation, just as the \c addDisplaced transition does above, or animate some item properties, + as in the \c add transition above. Additionally, a view transition may make use of the + ViewTransition attached property to customise animation behavior for different items. Following + are some examples of how this can be achieved. + + + \section2 Using the ViewTransition attached property + + As stated, the various ViewTransition properties provide details specific to the individual item + being transitioned as well as the operation that triggered the transition. In the animation above, + five items are inserted in succession at index 0. When the fifth and final insertion takes place, + adding "Item 4" to the view, the \c add transition is run once (for the inserted item) and the + \c addDisplaced transition is run four times (once for each of the four existing items in the view). + + At this point, if we examined the \c addDisplaced transition that was run for the bottom displaced + item ("Item 0"), the ViewTransition property values provided to this transition would be as follows: + + \table + \header + \o Property + \o Value + \o Explanation + \row + \o ViewTransition.item + \o "Item 0" delegate instance + \o The "Item 0" \l Rectangle object itself + \row + \o ViewTransition.index + \o \c int value of 4 + \o The index of "Item 0" within the model following the add operation + \row + \o ViewTransition.destination + \o \l point value of (0, 120) + \o The position that "Item 0" is moving to + \row + \o ViewTransition.targetIndexes + \o \c int array, just contains the integer "0" (zero) + \o The index of "Item 4", the new item added to the view + \row + \o ViewTransition.targetItems + \o object array, just contains the "Item 4" delegate instance + \o The "Item 4" \l Rectangle object - the new item added to the view + \endtable + + The ViewTransition.targetIndexes and ViewTransition.targetItems lists provide the items and + indexes of all delegate instances that are the targets of the relevant operation. For an add + operation, these are all the items that are added into the view; for a remove, these are all + the items removed from the view, and so on. (Note these lists will only contain references to + items that have been created within the view or its cached items; targets that are not within + the visible area of the view or within the item cache will not be accessible.) + + So, while the ViewTransition.item, ViewTransition.index and ViewTransition.destination values + vary for each individual transition that is run, the ViewTransition.targetIndexes and + ViewTransition.targetItems values are the same for every \c add and \c addDisplaced transition + that is triggered by a particular add operation. + + + \section3 Delaying animations based on index + + Since each view transition is run once for each item affected by the transition, the ViewTransition + properties can be used within a transition to define custom behavior for each item's transition. + For example, the ListView in the previous example could use this information to create a ripple-type + effect on the movement of the displaced items. + + This can be achieved by modifying the \c addDisplaced transition so that it delays the animation of + each displaced item based on the difference between its index (provided by ViewTransition.index) + and the first removed index (provided by ViewTransition.targetIndexes): + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml 0 + + Each displaced item delays its animation by an additional 100 milliseconds, producing a subtle + ripple-type effect when items are displaced by the add, like this: + + \image viewtransitions-delayedbyindex.gif + + + \section3 Animating items to intermediate positions + + The ViewTransition.item property gives a reference to the item to which the transition is being + applied. This can be used to access any of the item's attributes, custom \c property values, + and so on. + + Below is a modification of the \c addDisplaced transition from the previous example. It adds a + ParallelAnimation with nested NumberAnimation objects that reference ViewTransition.item to access + each item's \c x and \c y values at the start of their transitions. This allows each item to + animate to an intermediate position relative to its starting point for the transition, before + animating to its final position in the view: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml 0 + + Now, a displaced item will first move to a position of (20, 50) relative to its starting + position, and then to its final, correct position in the view: + + \image viewtransitions-intermediatemove.gif + + Since the final NumberAnimation does not specify a \c to value, the view implicitly sets this + value to the item's final position in the view, and so this last animation will move this item + to the correct place. If the transition requires the final position of the item for some calculation, + this is accessible through ViewTransition.destination. + + Instead of using multiple NumberAnimations, you could use a PathAnimation to animate an item over + a curved path. For example, the \c add transition in the previous example could be augmented with + a PathAnimation as follows: to animate newly added items along a path: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml 0 + + This animates newly added items along a path. Notice that each path is specified relative to + each item's final destination point, so that items inserted at different indexes start their + paths from different positions: + + \image viewtransitions-pathanim.gif + + + \section2 Handling interrupted animations + + A view transition may be interrupted at any time if a different view transition needs to be + applied while the original transition is in progress. For example, say Item A is inserted at index 0 + and undergoes an "add" transition; then, Item B is inserted at index 0 in quick succession before + Item A's transition has finished. Since Item B is inserted before Item A, it will displace Item + A, causing the view to interrupt Item A's "add" transition mid-way and start an "addDisplaced" + transition on Item A instead. + + For simple animations that simply animate an item's movement to its final destination, this + interruption is unlikely to require additional consideration. However, if a transition changes other + properties, this interruption may cause unwanted side effects. Consider the first example on this + page, repeated below for convenience: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml 0 + + If multiple items are added in rapid succession, without waiting for a previous transition + to finish, this is the result: + + \image viewtransitions-interruptedbad.gif + + Each newly added item undergoes an \c add transition, but before the transition can finish, + another item is added, displacing the previously added item. Because of this, the \c add + transition on the previously added item is interrupted and an \c addDisplaced transition is + started on the item instead. Due to the interruption, the \c opacity and \c scale animations + have not completed, thus producing items with opacity and scale that are below 1.0. + + To fix this, the \c addDisplaced transition should additionally ensure the item properties are + set to the end values specified in the \c add transition, effectively resetting these values + whenever an item is displaced. In this case, it means setting the item opacity and scale to 1.0: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml 0 + + Now, when an item's \c add transition is interrupted, its opacity and scale are animated to 1.0 + upon displacement, avoiding the erroneous visual effects from before: + + \image viewtransitions-interruptedgood.gif + + The same principle applies to any combination of view transitions. An added item may be moved + before its add transition finishes, or a moved item may be removed before its moved transition + finishes, and so on; so, the rule of thumb is that every transition should handle the same set of + properties. + + + \section2 Restrictions regarding ScriptAction + + When a view transition is initialized, any property bindings that refer to the ViewTransition + attached property are evaluated in preparation for the transition. Due to the nature of the + internal construction of a view transition, the attributes of the ViewTransition attached + property are only valid for the relevant item when the transition is initialized, and may not be + valid when the transition is actually run. + + Therefore, a ScriptAction within a view transition should not refer to the ViewTransition + attached property, as it may not refer to the expected values at the time that the ScriptAction + is actually invoked. Consider the following example: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml 0 + + When the space key is pressed, three items are moved from index 5 to index 1. For each moved + item, the \c moveTransition sequence presumably animates the item's color to "yellow", then + animates it to its final position, then changes the item color back to "lightsteelblue" using a + ScriptAction. However, when run, the transition does not produce the intended result: + + \image viewtransitions-scriptactionbad.gif + + Only the last moved item is returned to the "lightsteelblue" color; the others remain yellow. This + is because the ScriptAction is not run until after the transition has already been initialized, by + which time the ViewTransition.item value has changed to refer to a different item; the item that + the script had intended to refer to is not the one held by ViewTransition.item at the time the + ScriptAction is actually invoked. + + In this instance, to avoid this issue, the view could set the property using a PropertyAction + instead: + + \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml 0 + + When the transition is initialized, the PropertyAction \c target will be set to the respective + ViewTransition.item for the transition and will later run with the correct item target as + expected. + */ + +/*! + \qmlattachedproperty list QtQuick2::ViewTransition::index + + This attached property holds the index of the item that is being + transitioned. + + Note that if the item is being moved, this property holds the index that + the item is moving to, not from. +*/ + +/*! + \qmlattachedproperty list QtQuick2::ViewTransition::item + + This attached property holds the the item that is being transitioned. + + \warning This item should not be kept and referred to outside of the transition + as it may become invalid as the view changes. +*/ + +/*! + \qmlattachedproperty list QtQuick2::ViewTransition::destination + + This attached property holds the final destination position for the transitioned + item within the view. + + This property value is a \l point with \c x and \c y properties. +*/ + +/*! + \qmlattachedproperty list QtQuick2::ViewTransition::targetIndexes + + This attached property holds a list of the indexes of the items in view + that are the target of the relevant operation. + + The targets are the items that are the subject of the operation. For + an add operation, these are the items being added; for a remove, these + are the items being removed; for a move, these are the items being + moved. + + For example, if the transition was triggered by an insert operation + that added two items at index 1 and 2, this targetIndexes list would + have the value [1,2]. + + \note The targetIndexes list only contains the indexes of items that are actually + in view, or will be in the view once the relevant operation completes. + + \sa QtQuick2::ViewTransition::targetIndexes +*/ + +/*! + \qmlattachedproperty list QtQuick2::ViewTransition::targetItems + + This attached property holds the list of items in view that are the + target of the relevant operation. + + The targets are the items that are the subject of the operation. For + an add operation, these are the items being added; for a remove, these + are the items being removed; for a move, these are the items being + moved. + + For example, if the transition was triggered by an insert operation + that added two items at index 1 and 2, this targetItems list would + contain these two items. + + \note The targetItems list only contains items that are actually + in view, or will be in the view once the relevant operation completes. + + \warning The objects in this list should not be kept and referred to + outside of the transition as the items may become invalid. The targetItems + are only valid when the Transition is initially created; this also means + they should not be used by ScriptAction objects in the Transition, which are + not evaluated until the transition is run. + + \sa QtQuick2::ViewTransition::targetIndexes +*/ +QDeclarativeListProperty QQuickViewTransitionAttached::targetItems() +{ + return QDeclarativeListProperty(this, m_targetItems); +} + +QQuickViewTransitionAttached *QQuickViewTransitionAttached::qmlAttachedProperties(QObject *obj) +{ + return new QQuickViewTransitionAttached(obj); +} + +QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h new file mode 100644 index 0000000000..c388bed17e --- /dev/null +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKITEMVIEWTRANSITION_P_P_H +#define QQUICKITEMVIEWTRANSITION_P_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QQuickItem; +class QQuickViewItem; +class QQuickItemViewTransitionJob; + + +class QQuickItemViewTransitionChangeListener +{ +public: + QQuickItemViewTransitionChangeListener() {} + virtual ~QQuickItemViewTransitionChangeListener() {} + + virtual void viewItemTransitionFinished(QQuickViewItem *item) = 0; +}; + + +class QQuickItemViewTransitioner +{ +public: + enum TransitionType { + NoTransition, + PopulateTransition, + AddTransition, + MoveTransition, + RemoveTransition + }; + + QQuickItemViewTransitioner(); + virtual ~QQuickItemViewTransitioner() {} + + bool canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const; + void transitionNextReposition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget); + + inline void setPopulateTransitionEnabled(bool b) { usePopulateTransition = b; } + inline void setChangeListener(QQuickItemViewTransitionChangeListener *obj) { changeListener = obj; } + + QList addTransitionIndexes; + QList moveTransitionIndexes; + QList removeTransitionIndexes; + QList addTransitionTargets; + QList moveTransitionTargets; + QList removeTransitionTargets; + + QDeclarativeTransition *populateTransition; + QDeclarativeTransition *addTransition; + QDeclarativeTransition *addDisplacedTransition; + QDeclarativeTransition *moveTransition; + QDeclarativeTransition *moveDisplacedTransition; + QDeclarativeTransition *removeTransition; + QDeclarativeTransition *removeDisplacedTransition; + +private: + friend class QQuickItemViewTransitionJob; + + QQuickItemViewTransitionChangeListener *changeListener; + bool usePopulateTransition; + + void finishedTransition(QQuickViewItem *item); +}; + + +/* + An item in a view, that can be transitioned using QQuickViewTransitionJob. + */ +class QQuickViewItem +{ +public: + QQuickViewItem(QQuickItem *i); + virtual ~QQuickViewItem(); + + qreal itemX() const; + qreal itemY() const; + + void moveTo(const QPointF &pos); + void setVisible(bool visible); + + bool transitionScheduledOrRunning() const; + bool transitionRunning() const; + bool isPendingRemoval() const; + + bool prepareTransition(const QRectF &viewBounds); + void startTransition(QQuickItemViewTransitioner *transitioner); + void stopTransition(); + + QPointF nextTransitionTo; + QQuickItem *item; + QQuickItemViewTransitionJob *transition; + QQuickItemViewTransitioner::TransitionType nextTransitionType; + int index; + bool isTransitionTarget; + bool nextTransitionToSet; + +private: + friend class QQuickItemViewTransitioner; + friend class QQuickItemViewTransitionJob; + void setNextTransition(QQuickItemViewTransitioner::TransitionType, bool isTargetItem); + void finishedTransition(); + void resetTransitionData(); +}; + + +class QQuickViewTransitionAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int index READ index NOTIFY indexChanged) + Q_PROPERTY(QQuickItem* item READ item NOTIFY itemChanged) + Q_PROPERTY(QPointF destination READ destination NOTIFY destinationChanged) + + Q_PROPERTY(QList targetIndexes READ targetIndexes NOTIFY targetIndexesChanged) + Q_PROPERTY(QDeclarativeListProperty targetItems READ targetItems NOTIFY targetItemsChanged) + +public: + QQuickViewTransitionAttached(QObject *parent); + + int index() const { return m_index; } + QQuickItem *item() const { return m_item; } + QPointF destination() const { return m_destination; } + + QList targetIndexes() const { return m_targetIndexes; } + QDeclarativeListProperty targetItems(); + + static QQuickViewTransitionAttached *qmlAttachedProperties(QObject *); + +signals: + void indexChanged(); + void itemChanged(); + void destinationChanged(); + + void targetIndexesChanged(); + void targetItemsChanged(); + +private: + friend class QQuickItemViewTransitionJob; + QPointF m_destination; + QList m_targetIndexes; + QList m_targetItems; + + QQuickItem *m_item; + int m_index; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickViewTransitionAttached) +QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif // QQUICKITEMVIEWTRANSITION_P_P_H diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 0e643a13e3..2190952c69 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -316,9 +316,6 @@ class FxListItemSG : public FxViewItem return (x >= itemX() && x < itemX() + item->width() && y >= itemY() && y < itemY() + item->height()); } - QQuickItemView *itemView() const { - return view; - } QQuickListView *view; @@ -643,7 +640,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d #endif if (!(item = static_cast(createItem(modelIndex, doBuffer)))) break; - if (!canTransition(FxViewItemTransitionManager::PopulateTransition, true)) // pos will be set by layoutVisibleItems() + if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems() item->setPosition(pos); item->item->setVisible(!doBuffer); pos += item->size() + spacing; @@ -663,7 +660,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d break; --visibleIndex; visiblePos -= item->size() + spacing; - if (!canTransition(FxViewItemTransitionManager::PopulateTransition, true)) // pos will be set by layoutVisibleItems() + if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems() item->setPosition(visiblePos); item->item->setVisible(!doBuffer); visibleItems.prepend(item); @@ -2341,6 +2338,10 @@ void QQuickListView::setSnapMode(SnapMode mode) the new item that has been added to the view; to animate the added items, set the \l add property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2405,6 +2406,10 @@ void QQuickListView::setSnapMode(SnapMode mode) the items that are the actual subjects of the move operation; to animate the moved items, set the \l move property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2472,6 +2477,10 @@ void QQuickListView::setSnapMode(SnapMode mode) the item that has actually been removed from the view; to animate the removed items, set the \l remove property. + If an item is displaced by multiple types of operations at the same time, it is not + defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition + will be applied. + For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2740,7 +2749,8 @@ bool QQuickListViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In insertResult->changedFirstItem = true; if (!change.isMove()) { addedItems->append(item); - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, true); + if (transitioner) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true); } insertResult->sizeChangesBeforeVisiblePos += item->size() + spacing; pos -= item->size() + spacing; @@ -2766,11 +2776,12 @@ bool QQuickListViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In if (change.isMove()) { // we know this is a move target, since move displaced items that are // shuffled into view due to a move would be added in refill() - if (canTransition(FxViewItemTransitionManager::MoveTransition, true) && newItem) + if (newItem && transitioner && transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, true)) movingIntoView->append(MovedItem(item, change.moveKey(item->index))); } else { addedItems->append(item); - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, true); + if (transitioner) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true); } insertResult->sizeChangesAfterVisiblePos += item->size() + spacing; pos += item->size() + spacing; @@ -2782,10 +2793,12 @@ bool QQuickListViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In FxViewItem *item = visibleItems.at(index); if (item->index != -1) item->index += count; - if (change.isMove()) - transitionNextReposition(item, FxViewItemTransitionManager::MoveTransition, false); - else - transitionNextReposition(item, FxViewItemTransitionManager::AddTransition, false); + if (transitioner) { + if (change.isMove()) + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false); + else + transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, false); + } } updateVisibleIndex(); @@ -2797,6 +2810,9 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex { Q_UNUSED(insertionResult); + if (!transitioner) + return; + int markerItemIndex = -1; for (int i=0; iindex == afterModelIndex) { @@ -2816,7 +2832,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex if (!listItem->transitionScheduledOrRunning()) { qreal pos = listItem->position(); listItem->setPosition(pos - sizeRemoved); - transitionNextReposition(listItem, FxViewItemTransitionManager::RemoveTransition, false); + transitioner->transitionNextReposition(listItem, QQuickItemViewTransitioner::RemoveTransition, false); listItem->setPosition(pos); } } From 0507afe3fc13640fbf7d1a79c6699337b31498fc Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 28 Feb 2012 12:03:46 +1000 Subject: [PATCH 44/82] Properly cleanup cancelled incubation. Not all allocations were being destroyed. Change-Id: I2134bb224c58b947cfb990b0af2f6eedfd36da4a Reviewed-by: Andrew den Exter --- src/quick/items/qquickvisualdatamodel.cpp | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/quick/items/qquickvisualdatamodel.cpp b/src/quick/items/qquickvisualdatamodel.cpp index 0bdf0cb5af..3aa6077d32 100644 --- a/src/quick/items/qquickvisualdatamodel.cpp +++ b/src/quick/items/qquickvisualdatamodel.cpp @@ -461,8 +461,28 @@ void QQuickVisualDataModel::cancel(int index) Compositor::iterator it = d->m_compositor.find(d->m_compositorGroup, index); QQuickVisualDataModelItem *cacheItem = it->inCache() ? d->m_cache.at(it.cacheIndex) : 0; - if (cacheItem && cacheItem->incubationTask) - d->releaseIncubator(cacheItem->incubationTask); + if (cacheItem) { + if (cacheItem->incubationTask) { + delete cacheItem->incubationTask->incubatingContext; + cacheItem->incubationTask->incubatingContext = 0; + d->releaseIncubator(cacheItem->incubationTask); + cacheItem->incubationTask = 0; + } + if (cacheItem->object && !cacheItem->isObjectReferenced()) { + d->destroy(cacheItem->object); + if (QDeclarativePackage *package = qobject_cast(cacheItem->object)) + d->emitDestroyingPackage(package); + else if (QQuickItem *item = qobject_cast(cacheItem->object)) + d->emitDestroyingItem(item); + cacheItem->object = 0; + } + if (!cacheItem->isReferenced()) { + d->m_compositor.clearFlags(Compositor::Cache, it.cacheIndex, 1, Compositor::CacheFlag); + d->m_cache.removeAt(it.cacheIndex); + delete cacheItem; + Q_ASSERT(d->m_cache.count() == d->m_compositor.count(Compositor::Cache)); + } + } } void QQuickVisualDataModelPrivate::group_append( From 76c695c9a257c3ac914c11c283f04209075bc290 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Feb 2012 11:15:03 +0100 Subject: [PATCH 45/82] Add missing include Change-Id: Ifb4b489bb87b7ee8fb2f758da0e00af1e95e410f Reviewed-by: Olivier Goffart --- src/declarative/debugger/qdebugmessageservice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/debugger/qdebugmessageservice.cpp b/src/declarative/debugger/qdebugmessageservice.cpp index 3f18a0fe4b..ca75199f58 100644 --- a/src/declarative/debugger/qdebugmessageservice.cpp +++ b/src/declarative/debugger/qdebugmessageservice.cpp @@ -42,6 +42,8 @@ #include "qdebugmessageservice_p.h" #include "qdeclarativedebugservice_p_p.h" +#include + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QDebugMessageService, declarativeDebugMessageService) From ba3ac328ca721712c56f28a1fc6ae8e64b6ad7f2 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 22 Feb 2012 17:23:47 +1000 Subject: [PATCH 46/82] Add generic "displaced" transition property This is the default displaced transition that will be applied if addDisplaced, removeDisplaced or moveDisplaced are not specified (or are disabled). Change-Id: I9356036dc93bd9cb26e64e0b1769228113b74273 Reviewed-by: Martin Jones --- .../viewtransitions/viewtransitions-basic.qml | 2 +- .../viewtransitions-delayedbyindex.qml | 8 +- .../viewtransitions-intermediatemove.qml | 12 +- .../viewtransitions-interruptedgood.qml | 2 +- .../viewtransitions-pathanim.qml | 12 +- .../viewtransitions-scriptactionbad.qml | 2 +- .../viewtransitions-scriptactiongood.qml | 2 +- src/quick/items/qquickgridview.cpp | 74 ++++-- src/quick/items/qquickitemview.cpp | 16 ++ src/quick/items/qquickitemview_p.h | 5 + src/quick/items/qquickitemviewtransition.cpp | 60 +++-- src/quick/items/qquickitemviewtransition_p.h | 1 + src/quick/items/qquicklistview.cpp | 72 ++++-- .../data/displacedTransitions.qml | 138 ++++++++++++ .../qquickgridview/tst_qquickgridview.cpp | 211 +++++++++++++++++ .../data/displacedTransitions.qml | 128 +++++++++++ .../qquicklistview/tst_qquicklistview.cpp | 213 ++++++++++++++++++ tests/auto/qtquick2/shared/viewtestutil.h | 1 + 18 files changed, 887 insertions(+), 72 deletions(-) create mode 100644 tests/auto/qtquick2/qquickgridview/data/displacedTransitions.qml create mode 100644 tests/auto/qtquick2/qquicklistview/data/displacedTransitions.qml diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml index 8a05491ee1..cb94acb2b1 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml @@ -60,7 +60,7 @@ ListView { NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } } - addDisplaced: Transition { + displaced: Transition { NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce } } diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml index 79d00d2d1c..84c4848a76 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-delayedbyindex.qml @@ -60,12 +60,12 @@ ListView { } //! [0] - addDisplaced: Transition { - id: addDispTrans + displaced: Transition { + id: dispTrans SequentialAnimation { PauseAnimation { - duration: (addDispTrans.ViewTransition.index - - addDispTrans.ViewTransition.targetIndexes[0]) * 100 + duration: (dispTrans.ViewTransition.index - + dispTrans.ViewTransition.targetIndexes[0]) * 100 } NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce } } diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml index a43d3a8b7f..89353b40e8 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-intermediatemove.qml @@ -60,20 +60,20 @@ ListView { } //! [0] - addDisplaced: Transition { - id: addDispTrans + displaced: Transition { + id: dispTrans SequentialAnimation { PauseAnimation { - duration: (addDispTrans.ViewTransition.index - - addDispTrans.ViewTransition.targetIndexes[0]) * 100 + duration: (dispTrans.ViewTransition.index - + dispTrans.ViewTransition.targetIndexes[0]) * 100 } ParallelAnimation { NumberAnimation { - property: "x"; to: addDispTrans.ViewTransition.item.x + 20 + property: "x"; to: dispTrans.ViewTransition.item.x + 20 easing.type: Easing.OutQuad } NumberAnimation { - property: "y"; to: addDispTrans.ViewTransition.item.y + 50 + property: "y"; to: dispTrans.ViewTransition.item.y + 50 easing.type: Easing.OutQuad } } diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml index 1355268710..0644caaec7 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-interruptedgood.qml @@ -60,7 +60,7 @@ ListView { } //! [0] - addDisplaced: Transition { + displaced: Transition { NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce } // ensure opacity and scale values return to 1.0 diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml index 3d075c4367..4b1685719d 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-pathanim.qml @@ -76,20 +76,20 @@ ListView { } //! [0] - addDisplaced: Transition { - id: addDispTrans + displaced: Transition { + id: dispTrans SequentialAnimation { PauseAnimation { - duration: (addDispTrans.ViewTransition.index - - addDispTrans.ViewTransition.targetIndexes[0]) * 100 + duration: (dispTrans.ViewTransition.index - + dispTrans.ViewTransition.targetIndexes[0]) * 100 } ParallelAnimation { NumberAnimation { - property: "x"; to: addDispTrans.ViewTransition.item.x + 20 + property: "x"; to: dispTrans.ViewTransition.item.x + 20 easing.type: Easing.OutQuad } NumberAnimation { - property: "y"; to: addDispTrans.ViewTransition.item.y + 50 + property: "y"; to: dispTrans.ViewTransition.item.y + 50 easing.type: Easing.OutQuad } } diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml index 03348356e1..0e7d1e8d82 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactionbad.qml @@ -70,7 +70,7 @@ ListView { } } - moveDisplaced: Transition { + displaced: Transition { NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce } } diff --git a/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml b/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml index eda5c35479..7fa7e48f82 100644 --- a/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml +++ b/doc/src/snippets/declarative/viewtransitions/viewtransitions-scriptactiongood.qml @@ -73,7 +73,7 @@ ListView { } //! [0] - moveDisplaced: Transition { + displaced: Transition { NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce } } diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index fbce0af0c3..8b9f8059fb 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1634,8 +1634,8 @@ void QQuickGridView::setSnapMode(SnapMode mode) Whenever an item is added to the above view, the item will be animated from the position (100,100) to its final x,y position within the view, over one second. The transition only applies to the new items that are added to the view; it does not apply to the items below that are - displaced by the addition of the new items. To animate the displaced items, set the \l - addDisplaced property. + displaced by the addition of the new items. To animate the displaced items, set the \l displaced + or \l addDisplaced properties. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1671,9 +1671,10 @@ void QQuickGridView::setSnapMode(SnapMode mode) the new item that has been added to the view; to animate the added items, set the \l add property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1682,7 +1683,7 @@ void QQuickGridView::setSnapMode(SnapMode mode) populated, or when the view's \l model changes. In those cases, the \l populate transition is applied instead. - \sa add, populate, ViewTransition + \sa displaced, add, populate, ViewTransition */ /*! \qmlproperty Transition QtQuick2::GridView::move @@ -1705,7 +1706,7 @@ void QQuickGridView::setSnapMode(SnapMode mode) respective items in the view will be animated to their new positions in the view over one second. The transition only applies to the items that are the subject of the move operation in the model; it does not apply to items below them that are displaced by the move operation. - To animate the displaced items, set the \l moveDisplaced property. + To animate the displaced items, set the \l displaced or \l moveDisplaced properties. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -1738,14 +1739,15 @@ void QQuickGridView::setSnapMode(SnapMode mode) the items that are the actual subjects of the move operation; to animate the moved items, set the \l move property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. - \sa move, ViewTransition + \sa displaced, move, ViewTransition */ /*! @@ -1770,8 +1772,8 @@ void QQuickGridView::setSnapMode(SnapMode mode) Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below - them that are displaced by the removal of the items. To animate the displaced items, set the \l - removeDisplaced property. + them that are displaced by the removal of the items. To animate the displaced items, set the + \l displaced or \l removeDisplaced properties. Note that by the time the transition is applied, the item has already been removed from the model; any references to the model data for the removed index will not be valid. @@ -1809,15 +1811,53 @@ void QQuickGridView::setSnapMode(SnapMode mode) the item that has actually been removed from the view; to animate the removed items, set the \l remove property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. - \sa remove, ViewTransition + \sa displaced, remove, ViewTransition */ + +/*! + \qmlproperty Transition QtQuick2::GridView::displaced + This property holds the generic transition to apply to items that have been displaced by + any model operation that affects the view. + + This is a convenience for specifying a generic transition for items that are displaced + by add, move or remove operations, without having to specify the individual addDisplaced, + moveDisplaced and removeDisplaced properties. For example, here is a view that specifies + a displaced transition: + + \code + GridView { + ... + displaced: Transition { + NumberAnimation { properties: "x,y"; duration: 1000 } + } + } + \endcode + + When any item is added, moved or removed within the above view, the items below it are + displaced, causing them to move down (or sideways, if horizontally orientated) within the + view. As this displacement occurs, the items' movement to their new x,y positions within + the view will be animated by a NumberAnimation over one second, as specified. + + If a view specifies this generic displaced transition as well as a specific addDisplaced, + moveDisplaced or removeDisplaced transition, the more specific transition will be used + instead of the generic displaced transition when the relevant operation occurs, providing that + the more specific transition has not been disabled (by setting \l {Transition::enabled}{enabled} + to false). If it has indeed been disabled, the generic displaced transition is applied instead. + + For more details and examples on how to use view transitions, see the ViewTransition + documentation. + + \sa addDisplaced, moveDisplaced, removeDisplaced, ViewTransition +*/ + void QQuickGridView::viewportMoved() { Q_D(QQuickGridView); diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 481a0d4360..600b72dfcb 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -705,6 +705,22 @@ void QQuickItemView::setRemoveDisplacedTransition(QDeclarativeTransition *transi } } +QDeclarativeTransition *QQuickItemView::displacedTransition() const +{ + Q_D(const QQuickItemView); + return d->transitioner ? d->transitioner->displacedTransition : 0; +} + +void QQuickItemView::setDisplacedTransition(QDeclarativeTransition *transition) +{ + Q_D(QQuickItemView); + d->createTransitioner(); + if (d->transitioner->displacedTransition != transition) { + d->transitioner->displacedTransition = transition; + emit displacedTransitionChanged(); + } +} + void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode) { Q_Q(QQuickItemView); diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 63262f32ab..69a3d4a0c8 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -83,6 +83,7 @@ class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable Q_PROPERTY(QDeclarativeTransition *moveDisplaced READ moveDisplacedTransition WRITE setMoveDisplacedTransition NOTIFY moveDisplacedTransitionChanged) Q_PROPERTY(QDeclarativeTransition *remove READ removeTransition WRITE setRemoveTransition NOTIFY removeTransitionChanged) Q_PROPERTY(QDeclarativeTransition *removeDisplaced READ removeDisplacedTransition WRITE setRemoveDisplacedTransition NOTIFY removeDisplacedTransitionChanged) + Q_PROPERTY(QDeclarativeTransition *displaced READ displacedTransition WRITE setDisplacedTransition NOTIFY displacedTransitionChanged) Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) Q_PROPERTY(QQuickItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) @@ -151,6 +152,9 @@ class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable QDeclarativeTransition *removeDisplacedTransition() const; void setRemoveDisplacedTransition(QDeclarativeTransition *transition); + QDeclarativeTransition *displacedTransition() const; + void setDisplacedTransition(QDeclarativeTransition *transition); + QDeclarativeComponent *highlight() const; void setHighlight(QDeclarativeComponent *); @@ -211,6 +215,7 @@ class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable void moveDisplacedTransitionChanged(); void removeTransitionChanged(); void removeDisplacedTransitionChanged(); + void displacedTransitionChanged(); void highlightChanged(); void highlightItemChanged(); diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 3e3a99f553..0f092b76c3 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -90,13 +90,25 @@ void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickIt trans = m_transitioner->populateTransition; break; case QQuickItemViewTransitioner::AddTransition: - trans = isTargetItem ? m_transitioner->addTransition : m_transitioner->addDisplacedTransition; + if (isTargetItem) + trans = m_transitioner->addTransition; + else + trans = (m_transitioner->addDisplacedTransition && m_transitioner->addDisplacedTransition->enabled()) ? + m_transitioner->addDisplacedTransition : m_transitioner->displacedTransition; break; case QQuickItemViewTransitioner::MoveTransition: - trans = isTargetItem ? m_transitioner->moveTransition : m_transitioner->moveDisplacedTransition; + if (isTargetItem) + trans = m_transitioner->moveTransition; + else + trans = (m_transitioner->moveDisplacedTransition && m_transitioner->moveDisplacedTransition->enabled()) ? + m_transitioner->moveDisplacedTransition : m_transitioner->displacedTransition; break; case QQuickItemViewTransitioner::RemoveTransition: - trans = isTargetItem ? m_transitioner->removeTransition : m_transitioner->removeDisplacedTransition; + if (isTargetItem) + trans = m_transitioner->removeTransition; + else + trans = (m_transitioner->removeDisplacedTransition && m_transitioner->removeDisplacedTransition->enabled()) ? + m_transitioner->removeDisplacedTransition : m_transitioner->displacedTransition; break; } @@ -169,6 +181,7 @@ QQuickItemViewTransitioner::QQuickItemViewTransitioner() , addTransition(0), addDisplacedTransition(0) , moveTransition(0), moveDisplacedTransition(0) , removeTransition(0), removeDisplacedTransition(0) + , displacedTransition(0) , changeListener(0) , usePopulateTransition(false) { @@ -176,6 +189,12 @@ QQuickItemViewTransitioner::QQuickItemViewTransitioner() bool QQuickItemViewTransitioner::canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const { + if (!asTarget + && type != QQuickItemViewTransitioner::NoTransition && type != QQuickItemViewTransitioner::PopulateTransition + && displacedTransition && displacedTransition->enabled()) { + return true; + } + switch (type) { case QQuickItemViewTransitioner::NoTransition: break; @@ -428,11 +447,16 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) operations: \list - \o \c add and \c addDisplaced - the transitions to run when items are added to the view - \o \c remove and \c removeDisplaced - the transitions to run when items are removed from the view - \o \c move and \c moveDisplaced - the transitions to run when items are moved within the view - (i.e. as a result of a move operation in the model) \o \c populate - the transition to run when a view is created, or when the model changes + \o \c add - the transition to apply to items that are added to the view + \o \c remove - the transition to apply to items that are removed from the view + \o \c move - the transition to apply to items that are moved within the view (i.e. as a result + of a move operation in the model) + \o \c displaced - the generic transition to be applied to any items that are displaced by an + add, move or remove operation + \o \c addDisplaced, \c removeDisplaced and \c moveDisplaced - the transitions to be applied when + items are displaced by add, move, or remove operations, respectively (these override the + generic displaced transition if specified) \endlist Such view transitions additionally have access to a ViewTransition attached property that @@ -468,14 +492,14 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) \section2 View transitions: a simple example Here is a basic example of the use of view transitions. The view below specifies transitions for - the \c add and \c addDisplaced properties, which will be run when items are added to the view: + the \c add and \c displaced properties, which will be run when items are added to the view: \snippet doc/src/snippets/declarative/viewtransitions/viewtransitions-basic.qml 0 When the space key is pressed, adding an item to the model, the new item will fade in and increase in scale over 400 milliseconds as it is added to the view. Also, any item that is displaced by the addition of a new item will animate to its new position in the view over - 400 milliseconds, as specified by the \c addDisplaced transition. + 400 milliseconds, as specified by the \c displaced transition. If five items were inserted in succession at index 0, the effect would be this: @@ -488,7 +512,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) values if these properties are not explicitly defined. At its simplest, a view transition may just animate an item to its new position following a - view operation, just as the \c addDisplaced transition does above, or animate some item properties, + view operation, just as the \c displaced transition does above, or animate some item properties, as in the \c add transition above. Additionally, a view transition may make use of the ViewTransition attached property to customise animation behavior for different items. Following are some examples of how this can be achieved. @@ -500,9 +524,9 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) being transitioned as well as the operation that triggered the transition. In the animation above, five items are inserted in succession at index 0. When the fifth and final insertion takes place, adding "Item 4" to the view, the \c add transition is run once (for the inserted item) and the - \c addDisplaced transition is run four times (once for each of the four existing items in the view). + \c displaced transition is run four times (once for each of the four existing items in the view). - At this point, if we examined the \c addDisplaced transition that was run for the bottom displaced + At this point, if we examined the \c displaced transition that was run for the bottom displaced item ("Item 0"), the ViewTransition property values provided to this transition would be as follows: \table @@ -541,7 +565,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) So, while the ViewTransition.item, ViewTransition.index and ViewTransition.destination values vary for each individual transition that is run, the ViewTransition.targetIndexes and - ViewTransition.targetItems values are the same for every \c add and \c addDisplaced transition + ViewTransition.targetItems values are the same for every \c add and \c displaced transition that is triggered by a particular add operation. @@ -552,7 +576,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) For example, the ListView in the previous example could use this information to create a ripple-type effect on the movement of the displaced items. - This can be achieved by modifying the \c addDisplaced transition so that it delays the animation of + This can be achieved by modifying the \c displaced transition so that it delays the animation of each displaced item based on the difference between its index (provided by ViewTransition.index) and the first removed index (provided by ViewTransition.targetIndexes): @@ -570,7 +594,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) applied. This can be used to access any of the item's attributes, custom \c property values, and so on. - Below is a modification of the \c addDisplaced transition from the previous example. It adds a + Below is a modification of the \c displaced transition from the previous example. It adds a ParallelAnimation with nested NumberAnimation objects that reference ViewTransition.item to access each item's \c x and \c y values at the start of their transitions. This allows each item to animate to an intermediate position relative to its starting point for the transition, before @@ -607,7 +631,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) applied while the original transition is in progress. For example, say Item A is inserted at index 0 and undergoes an "add" transition; then, Item B is inserted at index 0 in quick succession before Item A's transition has finished. Since Item B is inserted before Item A, it will displace Item - A, causing the view to interrupt Item A's "add" transition mid-way and start an "addDisplaced" + A, causing the view to interrupt Item A's "add" transition mid-way and start a "displaced" transition on Item A instead. For simple animations that simply animate an item's movement to its final destination, this @@ -624,11 +648,11 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) Each newly added item undergoes an \c add transition, but before the transition can finish, another item is added, displacing the previously added item. Because of this, the \c add - transition on the previously added item is interrupted and an \c addDisplaced transition is + transition on the previously added item is interrupted and a \c displaced transition is started on the item instead. Due to the interruption, the \c opacity and \c scale animations have not completed, thus producing items with opacity and scale that are below 1.0. - To fix this, the \c addDisplaced transition should additionally ensure the item properties are + To fix this, the \c displaced transition should additionally ensure the item properties are set to the end values specified in the \c add transition, effectively resetting these values whenever an item is displaced. In this case, it means setting the item opacity and scale to 1.0: diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index c388bed17e..8dd2f86899 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -99,6 +99,7 @@ class QQuickItemViewTransitioner QDeclarativeTransition *moveDisplacedTransition; QDeclarativeTransition *removeTransition; QDeclarativeTransition *removeDisplacedTransition; + QDeclarativeTransition *displacedTransition; private: friend class QQuickItemViewTransitionJob; diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 2190952c69..876859eeb1 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2301,8 +2301,8 @@ void QQuickListView::setSnapMode(SnapMode mode) Whenever an item is added to the above view, the item will be animated from the position (100,100) to its final x,y position within the view, over one second. The transition only applies to the new items that are added to the view; it does not apply to the items below that are - displaced by the addition of the new items. To animate the displaced items, set the \l - addDisplaced property. + displaced by the addition of the new items. To animate the displaced items, set the \l displaced + or \l addDisplaced properties. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2338,9 +2338,10 @@ void QQuickListView::setSnapMode(SnapMode mode) the new item that has been added to the view; to animate the added items, set the \l add property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2349,7 +2350,7 @@ void QQuickListView::setSnapMode(SnapMode mode) populated, or when the view's \l model changes. In those cases, the \l populate transition is applied instead. - \sa add, populate, ViewTransition + \sa displaced, add, populate, ViewTransition */ /*! @@ -2373,7 +2374,7 @@ void QQuickListView::setSnapMode(SnapMode mode) respective items in the view will be animated to their new positions in the view over one second. The transition only applies to the items that are the subject of the move operation in the model; it does not apply to items below them that are displaced by the move operation. - To animate the displaced items, set the \l moveDisplaced property. + To animate the displaced items, set the \l displaced or \l moveDisplaced properties. For more details and examples on how to use view transitions, see the ViewTransition documentation. @@ -2406,14 +2407,15 @@ void QQuickListView::setSnapMode(SnapMode mode) the items that are the actual subjects of the move operation; to animate the moved items, set the \l move property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. - \sa move, ViewTransition + \sa displaced, move, ViewTransition */ /*! @@ -2438,8 +2440,8 @@ void QQuickListView::setSnapMode(SnapMode mode) Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below - them that are displaced by the removal of the items. To animate the displaced items, set the \l - removeDisplaced property. + them that are displaced by the removal of the items. To animate the displaced items, set the + \l displaced or \l removeDisplaced properties. Note that by the time the transition is applied, the item has already been removed from the model; any references to the model data for the removed index will not be valid. @@ -2477,16 +2479,52 @@ void QQuickListView::setSnapMode(SnapMode mode) the item that has actually been removed from the view; to animate the removed items, set the \l remove property. - If an item is displaced by multiple types of operations at the same time, it is not - defined as to whether the addDisplaced, moveDisplaced or removeDisplaced transition - will be applied. + If an item is displaced by multiple types of operations at the same time, it is not defined as to + whether the addDisplaced, moveDisplaced or removeDisplaced transition will be applied. Additionally, + if it is not necessary to specify different transitions depending on whether an item is displaced + by an add, move or remove operation, consider setting the \l displaced property instead. For more details and examples on how to use view transitions, see the ViewTransition documentation. - \sa remove, ViewTransition + \sa displaced, remove, ViewTransition */ +/*! + \qmlproperty Transition QtQuick2::ListView::displaced + This property holds the generic transition to apply to items that have been displaced by + any model operation that affects the view. + + This is a convenience for specifying the generic transition to be applied to any items + that are displaced by an add, move or remove operation, without having to specify the + individual addDisplaced, moveDisplaced and removeDisplaced properties. For example, here + is a view that specifies a displaced transition: + + \code + ListView { + ... + displaced: Transition { + NumberAnimation { properties: "x,y"; duration: 1000 } + } + } + \endcode + + When any item is added, moved or removed within the above view, the items below it are + displaced, causing them to move down (or sideways, if horizontally orientated) within the + view. As this displacement occurs, the items' movement to their new x,y positions within + the view will be animated by a NumberAnimation over one second, as specified. + + If a view specifies this generic displaced transition as well as a specific addDisplaced, + moveDisplaced or removeDisplaced transition, the more specific transition will be used + instead of the generic displaced transition when the relevant operation occurs, providing that + the more specific transition has not been disabled (by setting \l {Transition::enabled}{enabled} + to false). If it has indeed been disabled, the generic displaced transition is applied instead. + + For more details and examples on how to use view transitions, see the ViewTransition + documentation. + + \sa addDisplaced, moveDisplaced, removeDisplaced, ViewTransition +*/ void QQuickListView::viewportMoved() { diff --git a/tests/auto/qtquick2/qquickgridview/data/displacedTransitions.qml b/tests/auto/qtquick2/qquickgridview/data/displacedTransitions.qml new file mode 100644 index 0000000000..d9353c0639 --- /dev/null +++ b/tests/auto/qtquick2/qquickgridview/data/displacedTransitions.qml @@ -0,0 +1,138 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: grid.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + width: 80 + height: 60 + Text { + text: index + } + Text { + x: 40 + text: wrapper.x + ", " + wrapper.y + } + Text { + y: 20 + id: textName + objectName: "textName" + text: name + } + Text { + y: 40 + id: textNumber + objectName: "textNumber" + text: number + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + + onXChanged: checkPos() + onYChanged: checkPos() + + function checkPos() { + if (Qt.point(x, y) == displaced_transitionVia) + model_displaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == addDisplaced_transitionVia) + model_addDisplaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == moveDisplaced_transitionVia) + model_moveDisplaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == removeDisplaced_transitionVia) + model_removeDisplaced_transitionVia.addItem(name, "") + } + } + } + + GridView { + id: grid + + property int targetTransitionsDone + property int displaceTransitionsDone + + objectName: "grid" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + + displaced: useDisplaced ? displaced : null + addDisplaced: useAddDisplaced ? addDisplaced : null + moveDisplaced: useMoveDisplaced ? moveDisplaced : null + removeDisplaced: useRemoveDisplaced ? removeDisplaced : null + + Transition { + id: displaced + enabled: displacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: displaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: displaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: addDisplaced + enabled: addDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: addDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: addDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: moveDisplaced + enabled: moveDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: moveDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: moveDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: removeDisplaced + enabled: removeDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: removeDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: removeDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: grid + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp index 5765a67b77..6d755a64c7 100644 --- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp @@ -138,6 +138,8 @@ private slots: void moveTransitions_data(); void removeTransitions(); void removeTransitions_data(); + void displacedTransitions(); + void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); @@ -4557,6 +4559,215 @@ void tst_QQuickGridView::removeTransitions_data() << 18 << 3 << ListRange(); } +void tst_QQuickGridView::displacedTransitions() +{ + QFETCH(bool, useDisplaced); + QFETCH(bool, displacedEnabled); + QFETCH(bool, useAddDisplaced); + QFETCH(bool, addDisplacedEnabled); + QFETCH(bool, useMoveDisplaced); + QFETCH(bool, moveDisplacedEnabled); + QFETCH(bool, useRemoveDisplaced); + QFETCH(bool, removeDisplacedEnabled); + QFETCH(ListChange, change); + QFETCH(ListRange, expectedDisplacedIndexes); + + QaimModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + QaimModel model_displaced_transitionVia; + QaimModel model_addDisplaced_transitionVia; + QaimModel model_moveDisplaced_transitionVia; + QaimModel model_removeDisplaced_transitionVia; + + QPointF displaced_transitionVia(-50, -100); + QPointF addDisplaced_transitionVia(-150, 100); + QPointF moveDisplaced_transitionVia(50, -100); + QPointF removeDisplaced_transitionVia(150, 100); + + QQuickView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia); + ctxt->setContextProperty("model_addDisplaced_transitionVia", &model_addDisplaced_transitionVia); + ctxt->setContextProperty("model_moveDisplaced_transitionVia", &model_moveDisplaced_transitionVia); + ctxt->setContextProperty("model_removeDisplaced_transitionVia", &model_removeDisplaced_transitionVia); + ctxt->setContextProperty("displaced_transitionVia", displaced_transitionVia); + ctxt->setContextProperty("addDisplaced_transitionVia", addDisplaced_transitionVia); + ctxt->setContextProperty("moveDisplaced_transitionVia", moveDisplaced_transitionVia); + ctxt->setContextProperty("removeDisplaced_transitionVia", removeDisplaced_transitionVia); + ctxt->setContextProperty("useDisplaced", useDisplaced); + ctxt->setContextProperty("displacedEnabled", displacedEnabled); + ctxt->setContextProperty("useAddDisplaced", useAddDisplaced); + ctxt->setContextProperty("addDisplacedEnabled", addDisplacedEnabled); + ctxt->setContextProperty("useMoveDisplaced", useMoveDisplaced); + ctxt->setContextProperty("moveDisplacedEnabled", moveDisplacedEnabled); + ctxt->setContextProperty("useRemoveDisplaced", useRemoveDisplaced); + ctxt->setContextProperty("removeDisplacedEnabled", removeDisplacedEnabled); + canvas->setSource(testFileUrl("displacedTransitions.qml")); + canvas->show(); + qApp->processEvents(); + + QQuickGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + QQuickItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + + QList > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); + gridview->setProperty("displaceTransitionsDone", false); + + switch (change.type) { + case ListChange::Inserted: + { + QList > targetItemData; + for (int i=change.index; icount()); + break; + } + case ListChange::Removed: + model.removeItems(change.index, change.count); + QTRY_COMPARE(model.count(), gridview->count()); + break; + case ListChange::Moved: + model.moveItems(change.index, change.to, change.count); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + break; + case ListChange::SetCurrent: + case ListChange::SetContentY: + break; + } + if ((useDisplaced && displacedEnabled) + || (useAddDisplaced && addDisplacedEnabled) + || (useMoveDisplaced && moveDisplacedEnabled) + || (useRemoveDisplaced && removeDisplacedEnabled)) { + QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool()); + } + + if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled) + model_addDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with add displaced", "shouldn't have been animated with add displaced"); + else + QCOMPARE(model_addDisplaced_transitionVia.count(), 0); + if (change.type == ListChange::Moved && useMoveDisplaced && moveDisplacedEnabled) + model_moveDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with move displaced", "shouldn't have been animated with move displaced"); + else + QCOMPARE(model_moveDisplaced_transitionVia.count(), 0); + if (change.type == ListChange::Removed && useRemoveDisplaced && removeDisplacedEnabled) + model_removeDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with remove displaced", "shouldn't have been animated with remove displaced"); + else + QCOMPARE(model_removeDisplaced_transitionVia.count(), 0); + + if (useDisplaced && displacedEnabled + && ( (change.type == ListChange::Inserted && (!useAddDisplaced || !addDisplacedEnabled)) + || (change.type == ListChange::Moved && (!useMoveDisplaced || !moveDisplacedEnabled)) + || (change.type == ListChange::Removed && (!useRemoveDisplaced || !removeDisplacedEnabled))) ) { + model_displaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with generic displaced", "shouldn't have been animated with generic displaced"); + } else { + QCOMPARE(model_displaced_transitionVia.count(), 0); + } + + // verify all items moved to the correct final positions + QList items = findItems(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QCOMPARE(item->x(), (i%3)*80.0); + QCOMPARE(item->y(), (i/3)*60.0); + QQuickText *name = findItem(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + +void tst_QQuickGridView::displacedTransitions_data() +{ + QTest::addColumn("useDisplaced"); + QTest::addColumn("displacedEnabled"); + QTest::addColumn("useAddDisplaced"); + QTest::addColumn("addDisplacedEnabled"); + QTest::addColumn("useMoveDisplaced"); + QTest::addColumn("moveDisplacedEnabled"); + QTest::addColumn("useRemoveDisplaced"); + QTest::addColumn("removeDisplacedEnabled"); + QTest::addColumn("change"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("no displaced transitions at all") + << false << false + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 17); + + QTest::newRow("just displaced") + << true << true + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 17); + + QTest::newRow("just displaced (not enabled)") + << true << false + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 17); + + QTest::newRow("displaced + addDisplaced") + << true << true + << true << true + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 17); + + QTest::newRow("displaced + addDisplaced (not enabled)") + << true << true + << true << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 17); + + QTest::newRow("displaced + moveDisplaced") + << true << true + << false << false + << true << true + << false << false + << ListChange::move(0, 10, 1) << ListRange(1, 10); + + QTest::newRow("displaced + moveDisplaced (not enabled)") + << true << true + << false << false + << true << false + << false << false + << ListChange::move(0, 10, 1) << ListRange(1, 10); + + QTest::newRow("displaced + removeDisplaced") + << true << true + << false << false + << false << false + << true << true + << ListChange::remove(0, 1) << ListRange(1, 18); + + QTest::newRow("displaced + removeDisplaced (not enabled)") + << true << true + << false << false + << false << false + << true << false + << ListChange::remove(0, 1) << ListRange(1, 18); + + + QTest::newRow("displaced + add, should use generic displaced for a remove") + << true << true + << true << true + << false << false + << true << false + << ListChange::remove(0, 1) << ListRange(1, 18); +} + void tst_QQuickGridView::multipleTransitions() { // Tests that if you interrupt a transition in progress with another action that diff --git a/tests/auto/qtquick2/qquicklistview/data/displacedTransitions.qml b/tests/auto/qtquick2/qquicklistview/data/displacedTransitions.qml new file mode 100644 index 0000000000..cc7892e930 --- /dev/null +++ b/tests/auto/qtquick2/qquicklistview/data/displacedTransitions.qml @@ -0,0 +1,128 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 600 + + property int duration: 10 + property int count: list.count + + Component { + id: myDelegate + Rectangle { + id: wrapper + + property string nameData: name + + objectName: "wrapper" + height: 20 + width: 240 + Text { text: index } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + + onXChanged: checkPos() + onYChanged: checkPos() + + function checkPos() { + if (Qt.point(x, y) == displaced_transitionVia) + model_displaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == addDisplaced_transitionVia) + model_addDisplaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == moveDisplaced_transitionVia) + model_moveDisplaced_transitionVia.addItem(name, "") + if (Qt.point(x, y) == removeDisplaced_transitionVia) + model_removeDisplaced_transitionVia.addItem(name, "") + } + } + } + + ListView { + id: list + + property int targetTransitionsDone + property int displaceTransitionsDone + + objectName: "list" + focus: true + anchors.centerIn: parent + width: 240 + height: 320 + model: testModel + delegate: myDelegate + + displaced: useDisplaced ? displaced : null + addDisplaced: useAddDisplaced ? addDisplaced : null + moveDisplaced: useMoveDisplaced ? moveDisplaced : null + removeDisplaced: useRemoveDisplaced ? removeDisplaced : null + + Transition { + id: displaced + enabled: displacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: displaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: displaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: addDisplaced + enabled: addDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: addDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: addDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: moveDisplaced + enabled: moveDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: moveDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: moveDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + + Transition { + id: removeDisplaced + enabled: removeDisplacedEnabled + SequentialAnimation { + ParallelAnimation { + NumberAnimation { properties: "x"; to: removeDisplaced_transitionVia.x; duration: root.duration } + NumberAnimation { properties: "y"; to: removeDisplaced_transitionVia.y; duration: root.duration } + } + NumberAnimation { properties: "x,y"; duration: root.duration } + PropertyAction { target: list; property: "displaceTransitionsDone"; value: true } + } + } + } + + Rectangle { + anchors.fill: list + color: "lightsteelblue" + opacity: 0.2 + } +} + diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index 04da3f732f..a834f1aa03 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -179,6 +179,8 @@ private slots: void moveTransitions_data(); void removeTransitions(); void removeTransitions_data(); + void displacedTransitions(); + void displacedTransitions_data(); void multipleTransitions(); void multipleTransitions_data(); @@ -5564,6 +5566,217 @@ void tst_QQuickListView::removeTransitions_data() << 17 << 3 << ListRange(); } +void tst_QQuickListView::displacedTransitions() +{ + QFETCH(bool, useDisplaced); + QFETCH(bool, displacedEnabled); + QFETCH(bool, useAddDisplaced); + QFETCH(bool, addDisplacedEnabled); + QFETCH(bool, useMoveDisplaced); + QFETCH(bool, moveDisplacedEnabled); + QFETCH(bool, useRemoveDisplaced); + QFETCH(bool, removeDisplacedEnabled); + QFETCH(ListChange, change); + QFETCH(ListRange, expectedDisplacedIndexes); + + QaimModel model; + for (int i = 0; i < 30; i++) + model.addItem("Original item" + QString::number(i), ""); + QaimModel model_displaced_transitionVia; + QaimModel model_addDisplaced_transitionVia; + QaimModel model_moveDisplaced_transitionVia; + QaimModel model_removeDisplaced_transitionVia; + + QPointF displaced_transitionVia(-50, -100); + QPointF addDisplaced_transitionVia(-150, 100); + QPointF moveDisplaced_transitionVia(50, -100); + QPointF removeDisplaced_transitionVia(150, 100); + + QQuickView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject(canvas); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testObject", testObject); + ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia); + ctxt->setContextProperty("model_addDisplaced_transitionVia", &model_addDisplaced_transitionVia); + ctxt->setContextProperty("model_moveDisplaced_transitionVia", &model_moveDisplaced_transitionVia); + ctxt->setContextProperty("model_removeDisplaced_transitionVia", &model_removeDisplaced_transitionVia); + ctxt->setContextProperty("displaced_transitionVia", displaced_transitionVia); + ctxt->setContextProperty("addDisplaced_transitionVia", addDisplaced_transitionVia); + ctxt->setContextProperty("moveDisplaced_transitionVia", moveDisplaced_transitionVia); + ctxt->setContextProperty("removeDisplaced_transitionVia", removeDisplaced_transitionVia); + ctxt->setContextProperty("useDisplaced", useDisplaced); + ctxt->setContextProperty("displacedEnabled", displacedEnabled); + ctxt->setContextProperty("useAddDisplaced", useAddDisplaced); + ctxt->setContextProperty("addDisplacedEnabled", addDisplacedEnabled); + ctxt->setContextProperty("useMoveDisplaced", useMoveDisplaced); + ctxt->setContextProperty("moveDisplacedEnabled", moveDisplacedEnabled); + ctxt->setContextProperty("useRemoveDisplaced", useRemoveDisplaced); + ctxt->setContextProperty("removeDisplacedEnabled", removeDisplacedEnabled); + canvas->setSource(testFileUrl("displacedTransitions.qml")); + canvas->show(); + qApp->processEvents(); + + QQuickListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + QQuickItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + QList > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); + listview->setProperty("displaceTransitionsDone", false); + + switch (change.type) { + case ListChange::Inserted: + { + QList > targetItemData; + for (int i=change.index; icount()); + break; + } + case ListChange::Removed: + model.removeItems(change.index, change.count); + QTRY_COMPARE(model.count(), listview->count()); + break; + case ListChange::Moved: + model.moveItems(change.index, change.to, change.count); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + break; + case ListChange::SetCurrent: + case ListChange::SetContentY: + break; + } + if ((useDisplaced && displacedEnabled) + || (useAddDisplaced && addDisplacedEnabled) + || (useMoveDisplaced && moveDisplacedEnabled) + || (useRemoveDisplaced && removeDisplacedEnabled)) { + QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool()); + } + + if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled) + model_addDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with add displaced", "shouldn't have been animated with add displaced"); + else + QCOMPARE(model_addDisplaced_transitionVia.count(), 0); + if (change.type == ListChange::Moved && useMoveDisplaced && moveDisplacedEnabled) + model_moveDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with move displaced", "shouldn't have been animated with move displaced"); + else + QCOMPARE(model_moveDisplaced_transitionVia.count(), 0); + if (change.type == ListChange::Removed && useRemoveDisplaced && removeDisplacedEnabled) + model_removeDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with remove displaced", "shouldn't have been animated with remove displaced"); + else + QCOMPARE(model_removeDisplaced_transitionVia.count(), 0); + + if (useDisplaced && displacedEnabled + && ( (change.type == ListChange::Inserted && (!useAddDisplaced || !addDisplacedEnabled)) + || (change.type == ListChange::Moved && (!useMoveDisplaced || !moveDisplacedEnabled)) + || (change.type == ListChange::Removed && (!useRemoveDisplaced || !removeDisplacedEnabled))) ) { + model_displaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with generic displaced", "shouldn't have been animated with generic displaced"); + } else { + QCOMPARE(model_displaced_transitionVia.count(), 0); + } + + // verify all items moved to the correct final positions + QList items = findItems(contentItem, "wrapper"); + for (int i=0; i < model.count() && i < items.count(); ++i) { + QQuickItem *item = findItem(contentItem, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + QCOMPARE(item->x(), 0.0); + QCOMPARE(item->y(), i * 20.0); + QQuickText *name = findItem(contentItem, "textName", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + } + + delete canvas; +} + +void tst_QQuickListView::displacedTransitions_data() +{ + QTest::addColumn("useDisplaced"); + QTest::addColumn("displacedEnabled"); + QTest::addColumn("useAddDisplaced"); + QTest::addColumn("addDisplacedEnabled"); + QTest::addColumn("useMoveDisplaced"); + QTest::addColumn("moveDisplacedEnabled"); + QTest::addColumn("useRemoveDisplaced"); + QTest::addColumn("removeDisplacedEnabled"); + QTest::addColumn("change"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("no displaced transitions at all") + << false << false + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 15); + + QTest::newRow("just displaced") + << true << true + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 15); + + QTest::newRow("just displaced (not enabled)") + << true << false + << false << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 15); + + QTest::newRow("displaced + addDisplaced") + << true << true + << true << true + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 15); + + QTest::newRow("displaced + addDisplaced (not enabled)") + << true << true + << true << false + << false << false + << false << false + << ListChange::insert(0, 1) << ListRange(0, 15); + + QTest::newRow("displaced + moveDisplaced") + << true << true + << false << false + << true << true + << false << false + << ListChange::move(0, 10, 1) << ListRange(1, 10); + + QTest::newRow("displaced + moveDisplaced (not enabled)") + << true << true + << false << false + << true << false + << false << false + << ListChange::move(0, 10, 1) << ListRange(1, 10); + + QTest::newRow("displaced + removeDisplaced") + << true << true + << false << false + << false << false + << true << true + << ListChange::remove(0, 1) << ListRange(1, 16); + + QTest::newRow("displaced + removeDisplaced (not enabled)") + << true << true + << false << false + << false << false + << true << false + << ListChange::remove(0, 1) << ListRange(1, 16); + + + QTest::newRow("displaced + add, should use generic displaced for a remove") + << true << true + << true << true + << false << false + << true << false + << ListChange::remove(0, 1) << ListRange(1, 16); +} + void tst_QQuickListView::multipleTransitions() { QSKIP("QTBUG-24523"); diff --git a/tests/auto/qtquick2/shared/viewtestutil.h b/tests/auto/qtquick2/shared/viewtestutil.h index 71fd5065df..ebee1787d3 100644 --- a/tests/auto/qtquick2/shared/viewtestutil.h +++ b/tests/auto/qtquick2/shared/viewtestutil.h @@ -174,6 +174,7 @@ namespace QQuickViewTestUtil }; } +Q_DECLARE_METATYPE(QQuickViewTestUtil::ListChange) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QQuickViewTestUtil::ListRange) From ab727e6702e949c8f36649f16a81780746ebb2de Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Feb 2012 13:03:30 +1000 Subject: [PATCH 47/82] Add and use a method for querying whether a property is revisioned. Accessor data and the revision are now unioned, so querying the value directly can give incorrect results. Change-Id: I0ba6c53d8bd6b012507bfb32d33dc414348379b0 Reviewed-by: Chris Adams --- src/declarative/qml/qdeclarativepropertycache_p.h | 1 + src/declarative/qml/v4/qv4irbuilder.cpp | 6 +++--- src/declarative/qml/v8/qv8qobjectwrapper.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index d5d7095667..301f70bfe8 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -149,6 +149,7 @@ class QDeclarativePropertyRawData bool hasOverride() const { return !(flags & IsValueTypeVirtual) && !(flags & HasAccessors) && overrideIndex >= 0; } + bool hasRevision() const { return !(flags & HasAccessors) && revision != 0; } // Returns -1 if not a value type virtual property inline int getValueTypeCoreIndex() const; diff --git a/src/declarative/qml/v4/qv4irbuilder.cpp b/src/declarative/qml/v4/qv4irbuilder.cpp index 604eeaa713..522bc01684 100644 --- a/src/declarative/qml/v4/qv4irbuilder.cpp +++ b/src/declarative/qml/v4/qv4irbuilder.cpp @@ -437,7 +437,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QDeclarativePropertyData *data = cache->property(name); - if (data && data->revision != 0) { + if (data && data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); @@ -458,7 +458,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QDeclarativePropertyData *data = cache->property(name); - if (data && data->revision != 0) { + if (data && data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); @@ -609,7 +609,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) if (!data || data->isFunction()) return false; // Don't support methods (or non-existing properties ;) - if (data->revision != 0) { + if (data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index 11733be5fd..9c4e07ae4f 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp +++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp @@ -513,7 +513,7 @@ v8::Handle QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject if (!result) return v8::Handle(); - if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) { + if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) { QDeclarativeData *ddata = QDeclarativeData::get(object); if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) return v8::Handle(); @@ -673,7 +673,7 @@ bool QV8QObjectWrapper::SetProperty(QV8Engine *engine, QObject *object, const QH if (!result) return false; - if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) { + if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) { QDeclarativeData *ddata = QDeclarativeData::get(object); if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) return false; From 7fa6fcd30cb4a688eae744cae4abf9f263c16616 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 22 Feb 2012 18:13:29 +1000 Subject: [PATCH 48/82] Avoid unneccessary duplication of string data. Check for the existence of new line characters before trying to replace them. There's some redundancy if the characters are found but for single line strings we avoid the detach in replace. Change-Id: I48ccc614601a6f356b3d2e68f617e112c100bbdd Reviewed-by: Yann Bodson --- src/quick/items/qquicktext.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 28491d8f75..fd8ffe501b 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -305,9 +305,17 @@ void QQuickTextPrivate::updateLayout() formatModifiesFontSize = fontSizeModified; } else { layout.clearAdditionalFormats(); - multilengthEos = text.indexOf(QLatin1Char('\x9c')); - QString tmp = multilengthEos != -1 ? text.mid(0, multilengthEos) : text; - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); + QString tmp = text; + multilengthEos = tmp.indexOf(QLatin1Char('\x9c')); + if (multilengthEos != -1) { + tmp = tmp.mid(0, multilengthEos); + tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); + } else if (tmp.contains(QLatin1Char('\n'))) { + // Replace always does a detach. Checking for the new line character first + // means iterating over those items again if found but prevents a realloc + // otherwise. + tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); + } layout.setText(tmp); } textHasChanged = false; From 4e0e0e5cc59a0e5379dcc1964976288d3c3e1b82 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 23 Feb 2012 13:25:58 +1000 Subject: [PATCH 49/82] Don't round Text dimensions. Painting issues in QtQuick1 meant drawing had to be aligned to pixel boundaries, since this is no longer a problem we should use qreal everywhere. Change-Id: I58e88e10270fa603170f1cedf471bfb53bd89b73 Reviewed-by: Yann Bodson --- src/quick/items/qquicktext.cpp | 37 ++++++++++--------- src/quick/items/qquicktext_p_p.h | 6 +-- .../qquicktext/data/multilengthStrings.qml | 2 +- .../data/multilengthStringsWrapped.qml | 2 +- .../qtquick2/qquicktext/tst_qquicktext.cpp | 8 +--- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index fd8ffe501b..656440f2d3 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -386,7 +386,7 @@ void QQuickTextPrivate::updateSize() return; } - QFontMetrics fm(font); + QFontMetricsF fm(font); if (text.isEmpty()) { qreal fontHeight = fm.height(); q->setImplicitSize(0, fontHeight); @@ -399,16 +399,16 @@ void QQuickTextPrivate::updateSize() qreal naturalWidth = 0; - int dy = q->height(); - QSize size(0, 0); - QSize previousSize = layedOutTextRect.size(); + qreal dy = q->height(); + QSizeF size(0, 0); + QSizeF previousSize = layedOutTextRect.size(); #if defined(Q_OS_MAC) layoutThread = QThread::currentThread(); #endif //setup instance of QTextLayout for all cases other than richtext if (!richText) { - QRect textRect = setupTextLayout(&naturalWidth); + QRectF textRect = setupTextLayout(&naturalWidth); layedOutTextRect = textRect; size = textRect.size(); dy -= size.height(); @@ -436,12 +436,12 @@ void QQuickTextPrivate::updateSize() doc->setTextWidth(q->width()); else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) - dy -= (int)doc->size().height(); - QSize dsize = doc->size().toSize(); - layedOutTextRect = QRect(QPoint(0,0), dsize); - size = QSize(int(doc->idealWidth()),dsize.height()); + dy -= doc->size().height(); + QSizeF dsize = doc->size(); + layedOutTextRect = QRectF(QPointF(0,0), dsize); + size = QSizeF(doc->idealWidth(),dsize.height()); } - int yoff = 0; + qreal yoff = 0; if (q->heightValid()) { if (vAlign == QQuickText::AlignBottom) @@ -601,13 +601,13 @@ void QQuickTextPrivate::setupCustomLineGeometry(QTextLine &line, qreal &height, #endif } -QString QQuickTextPrivate::elidedText(int lineWidth, const QTextLine &line, QTextLine *nextLine) const +QString QQuickTextPrivate::elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine) const { if (nextLine) { nextLine->setLineWidth(INT_MAX); return layout.engine()->elidedText( Qt::TextElideMode(elideMode), - lineWidth, + QFixed::fromReal(lineWidth), 0, line.textStart(), line.textLength() + nextLine->textLength()); @@ -630,7 +630,7 @@ QString QQuickTextPrivate::elidedText(int lineWidth, const QTextLine &line, QTex already absolutely positioned horizontally). */ -QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) +QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) { Q_Q(QQuickText); layout.setCacheEnabled(true); @@ -673,8 +673,9 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) return QRect(0, 0, 0, height); } - const int lineWidth = q->widthValid() ? q->width() : INT_MAX; + const qreal lineWidth = q->widthValid() ? q->width() : FLT_MAX; const qreal maxHeight = q->heightValid() ? q->height() : FLT_MAX; + const bool customLayout = isLineLaidOutConnected(); const bool wasTruncated = truncated; @@ -783,7 +784,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) height = preLayoutHeight; elideText = layout.engine()->elidedText( Qt::TextElideMode(elideMode), - lineWidth, + QFixed::fromReal(lineWidth), 0, line.textStart(), line.textLength()); @@ -941,7 +942,7 @@ QRect QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) if (truncated != wasTruncated) emit q->truncatedChanged(); - return QRect(qRound(br.x()), qRound(br.y()), qCeil(br.width()), qCeil(br.height())); + return br; } void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height) @@ -1897,7 +1898,7 @@ QRectF QQuickText::boundingRect() const { Q_D(const QQuickText); - QRect rect = d->layedOutTextRect; + QRectF rect = d->layedOutTextRect; if (d->style != Normal) rect.adjust(-1, 0, 1, 2); @@ -1915,7 +1916,7 @@ QRectF QQuickText::boundingRect() const break; } - return QRectF(rect); + return rect; } /*! \internal */ diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index e060cc1cd2..d0770e6962 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -82,9 +82,9 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate QTextDocument *textDocument(); bool isLineLaidOutConnected(); void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); - QString elidedText(int lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; + QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; - QRect layedOutTextRect; + QRectF layedOutTextRect; qreal lineHeight; @@ -156,7 +156,7 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate void ensureDoc(); - QRect setupTextLayout(qreal *const naturalWidth); + QRectF setupTextLayout(qreal *const naturalWidth); void setupCustomLineGeometry(QTextLine &line, qreal &height, int lineOffset = 0); bool isLinkActivatedConnected(); QString anchorAt(const QPointF &pos); diff --git a/tests/auto/qtquick2/qquicktext/data/multilengthStrings.qml b/tests/auto/qtquick2/qquicktext/data/multilengthStrings.qml index d26576eacd..6b9dc71fbc 100644 --- a/tests/auto/qtquick2/qquicktext/data/multilengthStrings.qml +++ b/tests/auto/qtquick2/qquicktext/data/multilengthStrings.qml @@ -7,7 +7,7 @@ Item { Text { id: myText objectName: "myText" - width: 100 + width: 60 font.pixelSize: 15 font.family: "Helvetica" } diff --git a/tests/auto/qtquick2/qquicktext/data/multilengthStringsWrapped.qml b/tests/auto/qtquick2/qquicktext/data/multilengthStringsWrapped.qml index 0da9bc353a..21f1b20619 100644 --- a/tests/auto/qtquick2/qquicktext/data/multilengthStringsWrapped.qml +++ b/tests/auto/qtquick2/qquicktext/data/multilengthStringsWrapped.qml @@ -7,7 +7,7 @@ Item { Text { id: myText objectName: "myText" - width: 100 + width: 60 height: 36 font.pixelSize: 15 font.family: "Helvetica" diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index c28de8b53c..5f13f6211d 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -295,11 +295,10 @@ void tst_qquicktext::width() layout.endLayout(); - metricWidth = qCeil(layout.boundingRect().width()); + metricWidth = layout.boundingRect().width(); } else { QFontMetricsF fm(f); - qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); - metricWidth = qCeil(metricWidth); + metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); } QString componentStr = "import QtQuick 2.0\nText { text: \"" + standard.at(i) + "\" }"; @@ -2422,9 +2421,6 @@ void tst_qquicktext::multilengthStrings() QCOMPARE(myText->contentWidth(), mediumWidth); QCOMPARE(myText->contentHeight(), mediumHeight); -#ifdef Q_OS_MAC - QEXPECT_FAIL("Wrap", "QTBUG-24310", Continue); -#endif QCOMPARE(myText->truncated(), true); myText->setSize(QSizeF(shortWidth, shortHeight)); From 7002ef6142250cfd7edc81f739ddafee7e71bdbf Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 28 Feb 2012 16:49:17 +1000 Subject: [PATCH 50/82] Make sure positioners remove change listeners for invisible items. Children that are invisble weren't having their change listeners removed, which showed illegal accesses on destruction in valgrind. Change-Id: Icae798e773168323781e9ab88b3dae6a5aea0952 Reviewed-by: Alan Alpert --- src/quick/items/qquickpositioners.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 77d2a360b8..95ee9bfb58 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -111,6 +111,8 @@ QQuickBasePositioner::~QQuickBasePositioner() Q_D(QQuickBasePositioner); for (int i = 0; i < positionedItems.count(); ++i) d->unwatchChanges(positionedItems.at(i).item); + for (int i = 0; i < unpositionedItems.count(); ++i) + d->unwatchChanges(unpositionedItems.at(i).item); positionedItems.clear(); } @@ -187,6 +189,9 @@ void QQuickBasePositioner::itemChange(ItemChange change, const ItemChangeData &v if (idx >= 0) { d->unwatchChanges(child); positionedItems.remove(idx); + } else if ((idx = unpositionedItems.find(posItem)) >= 0) { + d->unwatchChanges(child); + unpositionedItems.remove(idx); } d->setPositioningDirty(); } From 38722cae7bd5c8b853427dd74d1d5e680df302e8 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 28 Feb 2012 17:09:14 +1000 Subject: [PATCH 51/82] Fix particle system on windows To preserve correctness, just use a non-point-sprite performance level on windows until QTBUG-24540 is resolved. Change-Id: I7608fbe21233534fb22c9d352aafae759e68c143 Reviewed-by: Martin Jones --- src/quick/particles/qquickimageparticle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/quick/particles/qquickimageparticle.cpp b/src/quick/particles/qquickimageparticle.cpp index 83687ae234..562a6c5dc7 100644 --- a/src/quick/particles/qquickimageparticle.cpp +++ b/src/quick/particles/qquickimageparticle.cpp @@ -1342,6 +1342,10 @@ void QQuickImageParticle::finishBuildParticleNodes() } } } +#ifdef Q_OS_WIN + if (perfLevel < Deformable) //QTBUG-24540 , point sprite 'extension' isn't working on windows. + perfLevel = Deformable; +#endif if (perfLevel >= Colored && !m_color.isValid()) m_color = QColor(Qt::white);//Hidden default, but different from unset From 82a2faadb83d74fec82c7ade443e64558670f3a7 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 7 Feb 2012 13:29:58 +0100 Subject: [PATCH 52/82] QFastMetaBuilder: Generate revision 6 meta-objects Support for old meta-object revisions (<= 6) will be dropped in Qt5. The first, simple step towards revision 7 is to move from rev 4 to 6. Also avoid copy/paste of the flags/types defined in qmetaobject_p.h (in preparation of porting to revision 7). Change-Id: I8ec3ad0811295528303abb5cce86011fc869ec30 Reviewed-by: Aaron Kennedy --- src/declarative/qml/ftw/qfastmetabuilder.cpp | 64 ++------------------ 1 file changed, 4 insertions(+), 60 deletions(-) diff --git a/src/declarative/qml/ftw/qfastmetabuilder.cpp b/src/declarative/qml/ftw/qfastmetabuilder.cpp index 0395ab3309..327ed861f6 100644 --- a/src/declarative/qml/ftw/qfastmetabuilder.cpp +++ b/src/declarative/qml/ftw/qfastmetabuilder.cpp @@ -42,6 +42,8 @@ #include "qfastmetabuilder_p.h" #include +#include +#include QT_BEGIN_NAMESPACE @@ -50,65 +52,6 @@ struct QFastMetaBuilderHeader int fieldCount; }; -struct QMetaObjectPrivate -{ - int revision; - int className; - int classInfoCount, classInfoData; - int methodCount, methodData; - int propertyCount, propertyData; - int enumeratorCount, enumeratorData; - int constructorCount, constructorData; //since revision 2 - int flags; //since revision 3 - int signalCount; //since revision 4 -}; - -enum MetaObjectFlag { - DynamicMetaObject = 0x01 -}; - -enum PropertyFlags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - Resettable = 0x00000004, - EnumOrFlag = 0x00000008, - StdCppSet = 0x00000100, -// Override = 0x00000200, - Constant = 0x00000400, - Final = 0x00000800, - Designable = 0x00001000, - ResolveDesignable = 0x00002000, - Scriptable = 0x00004000, - ResolveScriptable = 0x00008000, - Stored = 0x00010000, - ResolveStored = 0x00020000, - Editable = 0x00040000, - ResolveEditable = 0x00080000, - User = 0x00100000, - ResolveUser = 0x00200000, - Notify = 0x00400000, - Revisioned = 0x00800000 -}; - -enum MethodFlags { - AccessPrivate = 0x00, - AccessProtected = 0x01, - AccessPublic = 0x02, - AccessMask = 0x03, //mask - - MethodMethod = 0x00, - MethodSignal = 0x04, - MethodSlot = 0x08, - MethodConstructor = 0x0c, - MethodTypeMask = 0x0c, - - MethodCompatibility = 0x10, - MethodCloned = 0x20, - MethodScriptable = 0x40, - MethodRevisioned = 0x80 -}; - #define FMBHEADER_FIELD_COUNT 1 #define HEADER_FIELD_COUNT 14 @@ -175,7 +118,7 @@ QFastMetaBuilder::StringRef QFastMetaBuilder::init(int classNameLength, int dataIndex = HEADER_FIELD_COUNT; - p->revision = 4; + p->revision = 6; p->className = 0; // Class infos @@ -364,6 +307,7 @@ void QFastMetaBuilder::fromData(QMetaObject *output, const QMetaObject *parent, output->d.superdata = parent; output->d.stringdata = data.constData() + header(data)->fieldCount * sizeof(uint); output->d.data = fieldPointer(data); + output->d.extradata = 0; } QT_END_NAMESPACE From 9593df26c4a87130947dbdacf5ddb2f7a3412cbc Mon Sep 17 00:00:00 2001 From: Martin Petersson Date: Mon, 20 Feb 2012 14:56:12 +0100 Subject: [PATCH 53/82] FolderListModel: remove widget and QDirModel use FolderListModel used the obsolete QDirModel internally. Because of this it needed widgets to work. I have made a threaded model instead that use QDir internally. Change-Id: Ibd1267a135ee3c6df7bcde420073866b7a76d0d1 Reviewed-by: Alan Alpert --- .../folderlistmodel/fileinfothread.cpp | 280 ++++++++++ .../folderlistmodel/fileinfothread_p.h | 107 ++++ src/imports/folderlistmodel/fileproperty_p.h | 94 ++++ .../folderlistmodel/folderlistmodel.pro | 9 +- .../qdeclarativefolderlistmodel.cpp | 494 ++++++++++++------ .../qdeclarativefolderlistmodel.h | 60 ++- .../tst_qdeclarativefolderlistmodel.cpp | 4 +- 7 files changed, 855 insertions(+), 193 deletions(-) create mode 100644 src/imports/folderlistmodel/fileinfothread.cpp create mode 100644 src/imports/folderlistmodel/fileinfothread_p.h create mode 100644 src/imports/folderlistmodel/fileproperty_p.h diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp new file mode 100644 index 0000000000..3c4d60bb89 --- /dev/null +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -0,0 +1,280 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "fileinfothread_p.h" +#include + +#include + + +FileInfoThread::FileInfoThread(QObject *parent) + : QThread(parent), + abort(false), + watcher(0), + sortFlags(QDir::Name), + needUpdate(true), + folderUpdate(false), + sortUpdate(false), + showDirs(true), + showDirsFirst(false), + showDotDot(false), + showOnlyReadable(false) +{ + watcher = new QFileSystemWatcher(this); + connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString))); + connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); + start(LowPriority); +} + +FileInfoThread::~FileInfoThread() +{ + QMutexLocker locker(&mutex); + abort = true; + condition.wakeOne(); + locker.unlock(); + wait(); +} + +void FileInfoThread::clear() +{ + QMutexLocker locker(&mutex); + watcher->removePaths(watcher->files()); + watcher->removePaths(watcher->directories()); +} + +void FileInfoThread::removePath(const QString &path) +{ + QMutexLocker locker(&mutex); + watcher->removePath(path); + currentPath.clear(); +} + +void FileInfoThread::setPath(const QString &path) +{ + Q_ASSERT(!path.isEmpty()); + + QMutexLocker locker(&mutex); + watcher->addPath(path); + currentPath = path; + needUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setRootPath(const QString &path) +{ + Q_ASSERT(!path.isEmpty()); + + QMutexLocker locker(&mutex); + rootPath = path; +} + +void FileInfoThread::dirChanged(const QString &directoryPath) +{ + Q_UNUSED(directoryPath); + QMutexLocker locker(&mutex); + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setSortFlags(QDir::SortFlags flags) +{ + QMutexLocker locker(&mutex); + sortFlags = flags; + sortUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setNameFilters(const QStringList & filters) +{ + QMutexLocker locker(&mutex); + nameFilters = filters; + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setShowDirs(bool showFolders) +{ + QMutexLocker locker(&mutex); + showDirs = showFolders; + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setShowDirsFirst(bool showDirsFirst) +{ + QMutexLocker locker(&mutex); + showDirsFirst = showDirsFirst; + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setShowDotDot(bool on) +{ + QMutexLocker locker(&mutex); + showDotDot = on; + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::setShowOnlyReadable(bool on) +{ + QMutexLocker locker(&mutex); + showOnlyReadable = on; + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::updateFile(const QString &path) +{ + Q_UNUSED(path); + QMutexLocker locker(&mutex); + folderUpdate = true; + condition.wakeAll(); +} + +void FileInfoThread::run() +{ + forever { + bool updateFiles = false; + QMutexLocker locker(&mutex); + if (abort) { + return; + } + if (currentPath.isEmpty() || !needUpdate) + condition.wait(&mutex); + + if (abort) { + return; + } + + if (!currentPath.isEmpty()) { + updateFiles = true; + } + if (updateFiles) + getFileInfos(currentPath); + locker.unlock(); + } +} + + +void FileInfoThread::getFileInfos(const QString &path) +{ + QDir::Filters filter; + filter = QDir::Files | QDir::NoDot | QDir::CaseSensitive; + if (showDirs) + filter = filter | QDir::AllDirs | QDir::Drives; + if ((path == rootPath) || !showDotDot) + filter = filter | QDir::NoDotDot; + if (showOnlyReadable) + filter = filter | QDir::Readable; + if (showDirsFirst) + sortFlags = sortFlags | QDir::DirsFirst; + + QDir currentDir(path, QString(), sortFlags); + QFileInfoList fileInfoList; + QList filePropertyList; + + fileInfoList = currentDir.entryInfoList(nameFilters, filter, sortFlags); + + if (!fileInfoList.isEmpty()) { + foreach (QFileInfo info, fileInfoList) { + //qDebug() << "Adding file : " << info.fileName() << "to list "; + filePropertyList << FileProperty(info); + } + if (folderUpdate) { + int fromIndex = 0; + int toIndex = currentFileList.size()-1; + findChangeRange(filePropertyList, fromIndex, toIndex); + folderUpdate = false; + currentFileList = filePropertyList; + //qDebug() << "emit directoryUpdated : " << fromIndex << " " << toIndex; + emit directoryUpdated(path, filePropertyList, fromIndex, toIndex); + } else { + currentFileList = filePropertyList; + if (sortUpdate) { + emit sortFinished(filePropertyList); + sortUpdate = false; + } else + emit directoryChanged(path, filePropertyList); + } + } else { + // The directory is empty + if (folderUpdate) { + int fromIndex = 0; + int toIndex = currentFileList.size()-1; + folderUpdate = false; + currentFileList.clear(); + emit directoryUpdated(path, filePropertyList, fromIndex, toIndex); + } else { + currentFileList.clear(); + emit directoryChanged(path, filePropertyList); + } + } + needUpdate = false; +} + +void FileInfoThread::findChangeRange(const QList &list, int &fromIndex, int &toIndex) +{ + if (currentFileList.size() == 0) { + fromIndex = 0; + toIndex = list.size(); + return; + } + + int i; + int listSize = list.size() < currentFileList.size() ? list.size() : currentFileList.size(); + bool changeFound = false; + + for (i=0; i < listSize; i++) { + if (list.at(i) != currentFileList.at(i)) { + changeFound = true; + break; + } + } + + if (changeFound) + fromIndex = i; + else + fromIndex = i-1; + + // For now I let the rest of the list be updated.. + toIndex = list.size() > currentFileList.size() ? list.size() - 1 : currentFileList.size() - 1; +} diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h new file mode 100644 index 0000000000..a5be6e6fcc --- /dev/null +++ b/src/imports/folderlistmodel/fileinfothread_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILEINFOTHREAD_P_H +#define FILEINFOTHREAD_P_H + +#include +#include +#include +#include +#include +#include + +#include "fileproperty_p.h" + +class FileInfoThread : public QThread +{ + Q_OBJECT + +Q_SIGNALS: + void directoryChanged(const QString &directory, const QList &list) const; + void directoryUpdated(const QString &directory, const QList &list, int fromIndex, int toIndex) const; + void sortFinished(const QList &list) const; + +public: + FileInfoThread(QObject *parent = 0); + ~FileInfoThread(); + + void clear(); + void removePath(const QString &path); + void setPath(const QString &path); + void setRootPath(const QString &path); + void setSortFlags(QDir::SortFlags flags); + void setNameFilters(const QStringList & nameFilters); + void setShowDirs(bool showFolders); + void setShowDirsFirst(bool showDirsFirst); + void setShowDotDot(bool on); + void setShowOnlyReadable(bool on); + +public Q_SLOTS: + void dirChanged(const QString &directoryPath); + void updateFile(const QString &path); + +protected: + void run(); + void getFileInfos(const QString &path); + void findChangeRange(const QList &list, int &fromIndex, int &toIndex); + +private: + QMutex mutex; + QWaitCondition condition; + volatile bool abort; + + QFileSystemWatcher *watcher; + QList currentFileList; + QDir::SortFlags sortFlags; + QString currentPath; + QString rootPath; + QStringList nameFilters; + bool needUpdate; + bool folderUpdate; + bool sortUpdate; + bool showDirs; + bool showDirsFirst; + bool showDotDot; + bool showOnlyReadable; +}; + +#endif // FILEINFOTHREAD_P_H diff --git a/src/imports/folderlistmodel/fileproperty_p.h b/src/imports/folderlistmodel/fileproperty_p.h new file mode 100644 index 0000000000..690581a9a3 --- /dev/null +++ b/src/imports/folderlistmodel/fileproperty_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILEPROPERTY_P_H +#define FILEPROPERTY_P_H + +#include +#include + +class FileProperty +{ +public: + FileProperty(const QFileInfo &info) + { + mFileName = info.fileName(); + mFilePath = info.filePath(); + mBaseName = info.baseName(); + mSize = info.size(); + mSuffix = info.completeSuffix(); + mIsDir = info.isDir(); + mIsFile = info.isFile(); + mLastModified = info.lastModified(); + mLastRead = info.lastRead(); + } + ~FileProperty() + {} + + inline QString fileName() const { return mFileName; } + inline QString filePath() const { return mFilePath; } + inline QString baseName() const { return mBaseName; } + inline qint64 size() const { return mSize; } + inline QString suffix() const { return mSuffix; } + inline bool isDir() const { return mIsDir; } + inline bool isFile() const { return mIsFile; } + inline QDateTime lastModified() const { return mLastModified; } + inline QDateTime lastRead() const { return mLastRead; } + + inline bool operator !=(const FileProperty &fileInfo) const { + return !operator==(fileInfo); + } + bool operator ==(const FileProperty &property) const { + return ((mFileName == property.mFileName) && (isDir() == property.isDir())); + } + +private: + QString mFileName; + QString mFilePath; + QString mBaseName; + QString mSuffix; + qint64 mSize; + bool mIsDir; + bool mIsFile; + QDateTime mLastModified; + QDateTime mLastRead; +}; +#endif // FILEPROPERTY_P_H diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index 26efc654b8..9727b513e6 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -2,10 +2,13 @@ TARGET = qmlfolderlistmodelplugin TARGETPATH = Qt/labs/folderlistmodel include(../qimportbase.pri) -QT += widgets declarative +QT += declarative -SOURCES += qdeclarativefolderlistmodel.cpp plugin.cpp -HEADERS += qdeclarativefolderlistmodel.h +SOURCES += qdeclarativefolderlistmodel.cpp plugin.cpp \ + fileinfothread.cpp +HEADERS += qdeclarativefolderlistmodel.h \ + fileproperty_p.h \ + fileinfothread_p.h DESTDIR = $$QT.declarative.imports/$$TARGETPATH target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 870479afad..fa1a181e1f 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -41,25 +41,71 @@ //![code] #include "qdeclarativefolderlistmodel.h" -#include +#include "fileinfothread_p.h" +#include "fileproperty_p.h" #include #include -#ifndef QT_NO_DIRMODEL - QT_BEGIN_NAMESPACE class QDeclarativeFolderListModelPrivate { + Q_DECLARE_PUBLIC(QDeclarativeFolderListModel) + public: - QDeclarativeFolderListModelPrivate() - : sortField(QDeclarativeFolderListModel::Name), sortReversed(false), count(0), showDirs(true), showDots(false), showOnlyReadable(false), insideRefresh(false) { + QDeclarativeFolderListModelPrivate(QDeclarativeFolderListModel *q) + : q_ptr(q), + sortField(QDeclarativeFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDots(false), showOnlyReadable(false) + { nameFilters << QLatin1String("*"); } - void updateSorting() { - QDir::SortFlags flags = 0; - switch(sortField) { + + QDeclarativeFolderListModel *q_ptr; + QUrl currentDir; + QUrl rootDir; + FileInfoThread fileInfoThread; + QList data; + QHash roleNames; + QDeclarativeFolderListModel::SortField sortField; + QStringList nameFilters; + bool sortReversed; + bool showDirs; + bool showDirsFirst; + bool showDots; + bool showOnlyReadable; + + ~QDeclarativeFolderListModelPrivate() {} + void init(); + void updateSorting(); + + // private slots + void _q_directoryChanged(const QString &directory, const QList &list); + void _q_directoryUpdated(const QString &directory, const QList &list, int fromIndex, int toIndex); + void _q_sortFinished(const QList &list); +}; + + +void QDeclarativeFolderListModelPrivate::init() +{ + Q_Q(QDeclarativeFolderListModel); + qRegisterMetaType >("QList"); + q->connect(&fileInfoThread, SIGNAL(directoryChanged(QString, QList)), + q, SLOT(_q_directoryChanged(QString, QList))); + q->connect(&fileInfoThread, SIGNAL(directoryUpdated(QString, QList, int, int)), + q, SLOT(_q_directoryUpdated(QString, QList, int, int))); + q->connect(&fileInfoThread, SIGNAL(sortFinished(QList)), + q, SLOT(_q_sortFinished(QList))); +} + + +void QDeclarativeFolderListModelPrivate::updateSorting() +{ + Q_Q(QDeclarativeFolderListModel); + + QDir::SortFlags flags = 0; + + switch (sortField) { case QDeclarativeFolderListModel::Unsorted: flags |= QDir::Unsorted; break; @@ -75,26 +121,80 @@ class QDeclarativeFolderListModelPrivate case QDeclarativeFolderListModel::Type: flags |= QDir::Type; break; - } + default: + break; + } + + emit q->layoutAboutToBeChanged(); + + if (sortReversed) + flags |= QDir::Reversed; + + fileInfoThread.setSortFlags(flags); +} + +void QDeclarativeFolderListModelPrivate::_q_directoryChanged(const QString &directory, const QList &list) +{ + Q_Q(QDeclarativeFolderListModel); + Q_UNUSED(directory); + + data = list; + q->endResetModel(); + emit q->rowCountChanged(); + emit q->folderChanged(); +} - if (sortReversed) - flags |= QDir::Reversed; - model.setSorting(flags); +void QDeclarativeFolderListModelPrivate::_q_directoryUpdated(const QString &directory, const QList &list, int fromIndex, int toIndex) +{ + Q_Q(QDeclarativeFolderListModel); + Q_UNUSED(directory); + + QModelIndex parent; + if (data.size() > list.size()) { + //File(s) removed. Since I do not know how many + //or where I need to update the whole list from the first item. + data = list; + q->beginRemoveRows(parent, fromIndex, toIndex); + q->endRemoveRows(); + q->beginInsertRows(parent, fromIndex, list.size()-1); + q->endInsertRows(); + emit q->rowCountChanged(); + } else if (data.size() < list.size()) { + //qDebug() << "File added. FromIndex: " << fromIndex << " toIndex: " << toIndex << " list size: " << list.size(); + //File(s) added. Calculate how many and insert + //from the first changed one. + toIndex = fromIndex + (list.size() - data.size()-1); + q->beginInsertRows(parent, fromIndex, toIndex); + q->endInsertRows(); + data = list; + emit q->rowCountChanged(); + QModelIndex modelIndexFrom = q->createIndex(fromIndex, 0); + QModelIndex modelIndexTo = q->createIndex(toIndex, 0); + emit q->dataChanged(modelIndexFrom, modelIndexTo); + } else { + //qDebug() << "File has been updated"; + QModelIndex modelIndexFrom = q->createIndex(fromIndex, 0); + QModelIndex modelIndexTo = q->createIndex(toIndex, 0); + data = list; + emit q->dataChanged(modelIndexFrom, modelIndexTo); } +} + +void QDeclarativeFolderListModelPrivate::_q_sortFinished(const QList &list) +{ + Q_Q(QDeclarativeFolderListModel); + + QModelIndex parent; + q->beginRemoveRows(parent, 0, data.size()-1); + data.clear(); + q->endRemoveRows(); + + q->beginInsertRows(parent, 0, list.size()-1); + data = list; + q->endInsertRows(); +} - QDirModel model; - QUrl folder; - QStringList nameFilters; - QModelIndex folderIndex; - QDeclarativeFolderListModel::SortField sortField; - bool sortReversed; - int count; - bool showDirs; - bool showDots; - bool showOnlyReadable; - bool insideRefresh; -}; /*! \qmlclass FolderListModel QDeclarativeFolderListModel @@ -115,8 +215,14 @@ class QDeclarativeFolderListModelPrivate Components access names and paths via the following roles: \list - \o fileName - \o filePath + \o \c fileName + \o \c filePath + \o \c fileBaseName + \o \c fileSuffix + \o \c fileSize + \o \c fileModified + \o \c fileAccessed + \o \c fileIsDir \endlist Additionally a file entry can be differentiated from a folder entry via the @@ -157,39 +263,62 @@ class QDeclarativeFolderListModelPrivate */ QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) - : QAbstractListModel(parent) + : QAbstractListModel(parent), d_ptr(new QDeclarativeFolderListModelPrivate(this)) { - QHash roles; - roles[FileNameRole] = "fileName"; - roles[FilePathRole] = "filePath"; - setRoleNames(roles); - - d = new QDeclarativeFolderListModelPrivate; - d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot); - connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) - , this, SLOT(inserted(const QModelIndex&,int,int))); - connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)) - , this, SLOT(removed(const QModelIndex&,int,int))); - connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)) - , this, SLOT(handleDataChanged(const QModelIndex&,const QModelIndex&))); - connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh())); - connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); + Q_D(QDeclarativeFolderListModel); + d->roleNames[FileNameRole] = "fileName"; + d->roleNames[FilePathRole] = "filePath"; + d->roleNames[FileBaseNameRole] = "fileBaseName"; + d->roleNames[FileSuffixRole] = "fileSuffix"; + d->roleNames[FileSizeRole] = "fileSize"; + d->roleNames[FileLastModifiedRole] = "fileModified"; + d->roleNames[FileLastReadRole] = "fileAccessed"; + d->roleNames[FileIsDirRole] = "fileIsDir"; + setRoleNames(d->roleNames); + + d->init(); } QDeclarativeFolderListModel::~QDeclarativeFolderListModel() { - delete d; } QVariant QDeclarativeFolderListModel::data(const QModelIndex &index, int role) const { + Q_D(const QDeclarativeFolderListModel); QVariant rv; - QModelIndex modelIndex = d->model.index(index.row(), 0, d->folderIndex); - if (modelIndex.isValid()) { - if (role == FileNameRole) - rv = d->model.data(modelIndex, QDirModel::FileNameRole).toString(); - else if (role == FilePathRole) - rv = QUrl::fromLocalFile(d->model.data(modelIndex, QDirModel::FilePathRole).toString()); + + if (index.row() >= d->data.size()) + return rv; + + switch (role) + { + case FileNameRole: + rv = d->data.at(index.row()).fileName(); + break; + case FilePathRole: + rv = d->data.at(index.row()).filePath(); + break; + case FileBaseNameRole: + rv = d->data.at(index.row()).baseName(); + break; + case FileSuffixRole: + rv = d->data.at(index.row()).suffix(); + break; + case FileSizeRole: + rv = d->data.at(index.row()).size(); + break; + case FileLastModifiedRole: + rv = d->data.at(index.row()).lastModified().date().toString(Qt::ISODate) + " " + d->data.at(index.row()).lastModified().time().toString(); + break; + case FileLastReadRole: + rv = d->data.at(index.row()).lastRead().date().toString(Qt::ISODate) + " " + d->data.at(index.row()).lastRead().time().toString(); + break; + case FileIsDirRole: + rv = d->data.at(index.row()).isDir(); + break; + default: + break; } return rv; } @@ -202,8 +331,14 @@ QVariant QDeclarativeFolderListModel::data(const QModelIndex &index, int role) c */ int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const { + Q_D(const QDeclarativeFolderListModel); Q_UNUSED(parent); - return d->count; + return d->data.size(); +} + +QModelIndex QDeclarativeFolderListModel::index(int row, int , const QModelIndex &) const +{ + return createIndex(row, 0); } /*! @@ -219,46 +354,70 @@ int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const */ QUrl QDeclarativeFolderListModel::folder() const { - return d->folder; + Q_D(const QDeclarativeFolderListModel); + return d->currentDir; } void QDeclarativeFolderListModel::setFolder(const QUrl &folder) { - if (folder == d->folder) + Q_D(QDeclarativeFolderListModel); + + if (folder == d->currentDir) return; - QModelIndex index = d->model.index(folder.toLocalFile()); // This can modify the filtering rules. - if ((index.isValid() && d->model.isDir(index)) || folder.toLocalFile().isEmpty()) { - d->folder = folder; - QMetaObject::invokeMethod(this, "resetFiltering", Qt::QueuedConnection); // resetFiltering will invoke refresh(). - emit folderChanged(); + QString resolvedPath = QDir::cleanPath(folder.path()); + + beginResetModel(); + + //Remove the old path for the file system watcher + if (!d->currentDir.isEmpty()) + d->fileInfoThread.removePath(d->currentDir.path()); + + d->currentDir = folder; + + QFileInfo info(resolvedPath); + if (!info.exists() || !info.isDir()) { + d->data.clear(); + endResetModel(); + emit rowCountChanged(); + return; } + + d->fileInfoThread.setPath(resolvedPath); +} + + +/*! + \qmlproperty string QDeclarativeFolderListModel::rootFolder + + When the rootFolder is set, then this folder will + be threated as the root in the file system, so that + you can only travers sub folders from this rootFolder. +*/ +QUrl QDeclarativeFolderListModel::rootFolder() const +{ + Q_D(const QDeclarativeFolderListModel); + return d->rootDir; } -void QDeclarativeFolderListModel::resetFiltering() +void QDeclarativeFolderListModel::setRootFolder(const QUrl &path) { - // ensure that we reset the filtering rules, because the QDirModel::index() - // function isn't quite as const as it claims to be. - QDir::Filters filt = d->model.filter(); + Q_D(QDeclarativeFolderListModel); - if (d->showDirs) - filt |= (QDir::AllDirs | QDir::Drives); - else - filt &= ~(QDir::AllDirs | QDir::Drives); + if (path.isEmpty()) + return; - if (d->showDots) - filt &= ~QDir::NoDotAndDotDot; - else - filt |= QDir::NoDotAndDotDot; + QString resolvedPath = QDir::cleanPath(path.path()); - if (d->showOnlyReadable) - filt |= QDir::Readable; - else - filt &= ~QDir::Readable; + QFileInfo info(resolvedPath); + if (!info.exists() || !info.isDir()) + return; - d->model.setFilter(filt); // this causes a refresh(). + d->fileInfoThread.setRootPath(resolvedPath); + d->rootDir = path; } + /*! \qmlproperty url FolderListModel::parentFolder @@ -266,7 +425,9 @@ void QDeclarativeFolderListModel::resetFiltering() */ QUrl QDeclarativeFolderListModel::parentFolder() const { - QString localFile = d->folder.toLocalFile(); + Q_D(const QDeclarativeFolderListModel); + + QString localFile = d->currentDir.toLocalFile(); if (!localFile.isEmpty()) { QDir dir(localFile); #if defined(Q_OS_WIN) @@ -277,10 +438,10 @@ QUrl QDeclarativeFolderListModel::parentFolder() const dir.cdUp(); localFile = dir.path(); } else { - int pos = d->folder.path().lastIndexOf(QLatin1Char('/')); + int pos = d->currentDir.path().lastIndexOf(QLatin1Char('/')); if (pos == -1) return QUrl(); - localFile = d->folder.path().left(pos); + localFile = d->currentDir.path().left(pos); } return QUrl::fromLocalFile(localFile); } @@ -303,13 +464,15 @@ QUrl QDeclarativeFolderListModel::parentFolder() const */ QStringList QDeclarativeFolderListModel::nameFilters() const { + Q_D(const QDeclarativeFolderListModel); return d->nameFilters; } void QDeclarativeFolderListModel::setNameFilters(const QStringList &filters) { + Q_D(QDeclarativeFolderListModel); + d->fileInfoThread.setNameFilters(filters); d->nameFilters = filters; - d->model.setNameFilters(d->nameFilters); } void QDeclarativeFolderListModel::classBegin() @@ -318,11 +481,10 @@ void QDeclarativeFolderListModel::classBegin() void QDeclarativeFolderListModel::componentComplete() { - if (!d->folder.isValid() || d->folder.toLocalFile().isEmpty() || !QDir().exists(d->folder.toLocalFile())) - setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); + Q_D(QDeclarativeFolderListModel); - if (!d->folderIndex.isValid()) - QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); + if (!d->currentDir.isValid() || d->currentDir.toLocalFile().isEmpty() || !QDir().exists(d->currentDir.toLocalFile())) + setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); } /*! @@ -331,9 +493,9 @@ void QDeclarativeFolderListModel::componentComplete() The \a sortField property contains field to use for sorting. sortField may be one of: \list - \o Unsorted - no sorting is applied. The order is system default. + \o Unsorted - no sorting is applied. \o Name - sort by filename - \o Time - sort by time modified + \o LastModified - sort by time modified \o Size - sort by file size \o Type - sort by file type (extension) \endlist @@ -342,17 +504,25 @@ void QDeclarativeFolderListModel::componentComplete() */ QDeclarativeFolderListModel::SortField QDeclarativeFolderListModel::sortField() const { + Q_D(const QDeclarativeFolderListModel); return d->sortField; } void QDeclarativeFolderListModel::setSortField(SortField field) { + Q_D(QDeclarativeFolderListModel); if (field != d->sortField) { d->sortField = field; d->updateSorting(); } } +int QDeclarativeFolderListModel::roleFromString(const QString &roleName) const +{ + Q_D(const QDeclarativeFolderListModel); + return d->roleNames.key(roleName.toLatin1(), -1); +} + /*! \qmlproperty bool FolderListModel::sortReversed @@ -362,11 +532,14 @@ void QDeclarativeFolderListModel::setSortField(SortField field) */ bool QDeclarativeFolderListModel::sortReversed() const { + Q_D(const QDeclarativeFolderListModel); return d->sortReversed; } void QDeclarativeFolderListModel::setSortReversed(bool rev) { + Q_D(QDeclarativeFolderListModel); + if (rev != d->sortReversed) { d->sortReversed = rev; d->updateSorting(); @@ -382,91 +555,66 @@ void QDeclarativeFolderListModel::setSortReversed(bool rev) bool QDeclarativeFolderListModel::isFolder(int index) const { if (index != -1) { - QModelIndex idx = d->model.index(index, 0, d->folderIndex); - if (idx.isValid()) - return d->model.isDir(idx); + QModelIndex idx = createIndex(index, 0); + if (idx.isValid()) { + QVariant var = data(idx, FileIsDirRole); + if (var.isValid()) + return var.toBool(); + } } return false; } -void QDeclarativeFolderListModel::refresh() -{ - if (d->insideRefresh) - return; - d->insideRefresh = true; +/*! + \qmlproperty bool FolderListModel::showDirs - d->folderIndex = QModelIndex(); - if (d->count) { - emit beginRemoveRows(QModelIndex(), 0, d->count-1); - d->count = 0; - emit endRemoveRows(); - } + If true, directories are included in the model; otherwise only files + are included. - d->folderIndex = d->model.index(d->folder.toLocalFile()); - int newcount = d->model.rowCount(d->folderIndex); - if (newcount) { - emit beginInsertRows(QModelIndex(), 0, newcount-1); - d->count = newcount; - emit endInsertRows(); - } + By default, this property is true. - d->insideRefresh = false; // finished refreshing. -} + Note that the nameFilters are not applied to directories. -void QDeclarativeFolderListModel::inserted(const QModelIndex &index, int start, int end) + \sa showDotAndDotDot +*/ +bool QDeclarativeFolderListModel::showDirs() const { - if (index == d->folderIndex) { - emit beginInsertRows(QModelIndex(), start, end); - d->count = d->model.rowCount(d->folderIndex); - emit endInsertRows(); - } + Q_D(const QDeclarativeFolderListModel); + return d->showDirs; } -void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, int end) +void QDeclarativeFolderListModel::setShowDirs(bool on) { - if (index == d->folderIndex) { - emit beginRemoveRows(QModelIndex(), start, end); - d->count = d->model.rowCount(d->folderIndex); - emit endRemoveRows(); - } -} + Q_D(QDeclarativeFolderListModel); -void QDeclarativeFolderListModel::handleDataChanged(const QModelIndex &start, const QModelIndex &end) -{ - if (start.parent() == d->folderIndex) - emit dataChanged(index(start.row(),0), index(end.row(),0)); + d->fileInfoThread.setShowDirs(on); + d->showDirs = on; } /*! - \qmlproperty bool FolderListModel::showDirs + \qmlproperty bool FolderListModel::showDirsFirst - If true, directories are included in the model; otherwise only files - are included. + If true, if directories are included in the model they will + always be shown first, then the files. - By default, this property is true. - - Note that the nameFilters are not applied to directories. + By default, this property is false. - \sa showDotAndDotDot */ -bool QDeclarativeFolderListModel::showDirs() const +bool QDeclarativeFolderListModel::showDirsFirst() const { - return d->model.filter() & QDir::AllDirs; + Q_D(const QDeclarativeFolderListModel); + return d->showDirsFirst; } -void QDeclarativeFolderListModel::setShowDirs(bool on) +void QDeclarativeFolderListModel::setShowDirsFirst(bool on) { - if (!(d->model.filter() & QDir::AllDirs) == !on) - return; - if (on) { - d->showDirs = true; - d->model.setFilter(d->model.filter() | QDir::AllDirs | QDir::Drives); - } else { - d->showDirs = false; - d->model.setFilter(d->model.filter() & ~(QDir::AllDirs | QDir::Drives)); - } + Q_D(QDeclarativeFolderListModel); + + d->fileInfoThread.setShowDirsFirst(on); + d->showDirsFirst = on; } + /*! \qmlproperty bool FolderListModel::showDotAndDotDot @@ -479,19 +627,16 @@ void QDeclarativeFolderListModel::setShowDirs(bool on) */ bool QDeclarativeFolderListModel::showDotAndDotDot() const { - return !(d->model.filter() & QDir::NoDotAndDotDot); + Q_D(const QDeclarativeFolderListModel); + return d->showDots; } void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) { - if (!(d->model.filter() & QDir::NoDotAndDotDot) == on) - return; - if (on) { - d->showDots = true; - d->model.setFilter(d->model.filter() & ~QDir::NoDotAndDotDot); - } else { - d->showDots = false; - d->model.setFilter(d->model.filter() | QDir::NoDotAndDotDot); + Q_D(QDeclarativeFolderListModel); + + if (on != d->showDots) { + d->fileInfoThread.setShowDotDot(on); } } @@ -507,23 +652,46 @@ void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) */ bool QDeclarativeFolderListModel::showOnlyReadable() const { - return d->model.filter() & QDir::Readable; + Q_D(const QDeclarativeFolderListModel); + return d->showOnlyReadable; } void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) { - if (!(d->model.filter() & QDir::Readable) == !on) - return; - if (on) { - d->showOnlyReadable = true; - d->model.setFilter(d->model.filter() | QDir::Readable); - } else { - d->showOnlyReadable = false; - d->model.setFilter(d->model.filter() & ~QDir::Readable); + Q_D(QDeclarativeFolderListModel); + + if (on != d->showOnlyReadable) { + d->fileInfoThread.setShowOnlyReadable(on); } } +/*! + \qmlmethod QVariant QDeclarativeFolderListModel::get(int idx, const QString &property) const + + Get the folder property for the given index. The following properties + are available. + + \list + \o \c fileName + \o \c filePath + \o \c fileBaseName + \o \c fileSuffix + \o \c fileSize + \o \c fileModified + \o \c fileAccessed + \o \c fileIsDir + \endlist +*/ +QVariant QDeclarativeFolderListModel::get(int idx, const QString &property) const +{ + int role = roleFromString(property); + if (role >= 0 && idx >= 0) + return data(index(idx, 0), role); + else + return QVariant(); +} + +#include "moc_qdeclarativefolderlistmodel.cpp" + //![code] QT_END_NAMESPACE - -#endif // QT_NO_DIRMODEL diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h index 5f9cb0e81a..27a7bc00a1 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h @@ -47,8 +47,6 @@ #include #include -#ifndef QT_NO_DIRMODEL - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -68,14 +66,16 @@ class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarati //![class props] Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) + Q_PROPERTY(QUrl rootFolder READ rootFolder WRITE setRootFolder) Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) Q_PROPERTY(SortField sortField READ sortField WRITE setSortField) Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed) Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs) + Q_PROPERTY(bool showDirsFirst READ showDirsFirst WRITE setShowDirsFirst) Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot) Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) - Q_PROPERTY(int count READ count) + Q_PROPERTY(int count READ count NOTIFY rowCountChanged) //![class props] //![abslistmodel] @@ -83,10 +83,20 @@ class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarati QDeclarativeFolderListModel(QObject *parent = 0); ~QDeclarativeFolderListModel(); - enum Roles { FileNameRole = Qt::UserRole+1, FilePathRole = Qt::UserRole+2 }; - - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; + enum Roles { + FileNameRole = Qt::UserRole + 1, + FilePathRole = Qt::UserRole + 2, + FileBaseNameRole = Qt::UserRole + 3, + FileSuffixRole = Qt::UserRole + 4, + FileSizeRole = Qt::UserRole + 5, + FileLastModifiedRole = Qt::UserRole + 6, + FileLastReadRole = Qt::UserRole +7, + FileIsDirRole = Qt::UserRole + 8 + }; + + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; //![abslistmodel] //![count] @@ -96,6 +106,8 @@ class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarati //![prop funcs] QUrl folder() const; void setFolder(const QUrl &folder); + QUrl rootFolder() const; + void setRootFolder(const QUrl &path); QUrl parentFolder() const; @@ -111,49 +123,47 @@ class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarati void setSortReversed(bool rev); bool showDirs() const; - void setShowDirs(bool); + void setShowDirs(bool showDirs); + bool showDirsFirst() const; + void setShowDirsFirst(bool showDirsFirst); bool showDotAndDotDot() const; - void setShowDotAndDotDot(bool); + void setShowDotAndDotDot(bool on); bool showOnlyReadable() const; - void setShowOnlyReadable(bool); + void setShowOnlyReadable(bool on); //![prop funcs] -//![isfolder] Q_INVOKABLE bool isFolder(int index) const; -//![isfolder] + Q_INVOKABLE QVariant get(int idx, const QString &property) const; //![parserstatus] virtual void classBegin(); virtual void componentComplete(); //![parserstatus] + int roleFromString(const QString &roleName) const; + //![notifier] Q_SIGNALS: void folderChanged(); + void rowCountChanged() const; //![notifier] //![class end] -private Q_SLOTS: - void refresh(); - void resetFiltering(); - void inserted(const QModelIndex &index, int start, int end); - void removed(const QModelIndex &index, int start, int end); - void handleDataChanged(const QModelIndex &start, const QModelIndex &end); + private: Q_DISABLE_COPY(QDeclarativeFolderListModel) - QDeclarativeFolderListModelPrivate *d; + Q_DECLARE_PRIVATE(QDeclarativeFolderListModel) + QScopedPointer d_ptr; + + Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QList &list)) + Q_PRIVATE_SLOT(d_func(), void _q_directoryUpdated(const QString &directory, const QList &list, int fromIndex, int toIndex)) + Q_PRIVATE_SLOT(d_func(), void _q_sortFinished(const QList &list)) }; //![class end] QT_END_NAMESPACE -//![qml decl] -QML_DECLARE_TYPE(QDeclarativeFolderListModel) -//![qml decl] - QT_END_HEADER -#endif // QT_NO_DIRMODEL - #endif // QDECLARATIVEFOLDERLISTMODEL_H diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp index 07eb6e87e1..708f3c90bb 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp @@ -170,8 +170,8 @@ void tst_qdeclarativefolderlistmodel::refresh() flm->setProperty("sortReversed", true); - QCOMPARE(removeStart, 0); - QCOMPARE(removeEnd, count-1); + QTRY_COMPARE(removeStart, 0); + QTRY_COMPARE(removeEnd, count-1); // wait for refresh } QTEST_MAIN(tst_qdeclarativefolderlistmodel) From 648337d19abde0bc1d3f248f11ad4a40890f532f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 7 Feb 2012 19:37:38 +0100 Subject: [PATCH 54/82] Add autotest for QML meta-objects This autotest checks that the QMetaObject generated from a QML type can be introspected from C++ (properties, class info, signals and slots). Change-Id: I9a50f138f911690f5c55cd28e5b49f0682450d07 Reviewed-by: Aaron Kennedy --- tests/auto/declarative/declarative.pro | 1 + .../qdeclarativemetaobject/data/method.1.qml | 5 + .../qdeclarativemetaobject/data/method.2.qml | 5 + .../qdeclarativemetaobject/data/method.3.qml | 5 + .../data/property.MyQmlObject.qml | 6 + .../data/property.QtObject.qml | 5 + .../data/property.alias.2.qml | 6 + .../data/property.alias.3.qml | 7 + .../data/property.alias.qml | 7 + .../data/property.bool.qml | 5 + .../data/property.color.qml | 5 + .../data/property.date.qml | 5 + .../data/property.int.qml | 5 + .../data/property.list.MyQmlObject.qml | 6 + .../data/property.list.QtObject.qml | 5 + .../data/property.real.qml | 5 + .../data/property.string.qml | 5 + .../data/property.url.qml | 5 + .../data/property.var.qml | 5 + .../data/property.variant.qml | 5 + .../qdeclarativemetaobject/data/signal.1.qml | 5 + .../qdeclarativemetaobject/data/signal.2.qml | 5 + .../qdeclarativemetaobject/data/signal.3.qml | 5 + .../qdeclarativemetaobject/data/signal.4.qml | 5 + .../qdeclarativemetaobject/data/signal.5.qml | 5 + .../qdeclarativemetaobject.pro | 14 + .../tst_qdeclarativemetaobject.cpp | 364 ++++++++++++++++++ 27 files changed, 506 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/method.1.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/method.2.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/method.3.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.MyQmlObject.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.QtObject.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.alias.2.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.alias.3.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.alias.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.bool.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.color.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.date.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.int.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.list.MyQmlObject.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.list.QtObject.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.real.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.string.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.url.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.var.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/property.variant.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/signal.1.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/signal.2.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/signal.3.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/signal.4.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/data/signal.5.qml create mode 100644 tests/auto/declarative/qdeclarativemetaobject/qdeclarativemetaobject.pro create mode 100644 tests/auto/declarative/qdeclarativemetaobject/tst_qdeclarativemetaobject.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 7288da27ba..85de8618e2 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -15,6 +15,7 @@ PUBLICTESTS += \ qdeclarativeinfo \ qdeclarativelistreference \ qdeclarativelocale \ + qdeclarativemetaobject \ qdeclarativemoduleplugin \ qdeclarativeqt \ qdeclarativetranslation \ diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/method.1.qml b/tests/auto/declarative/qdeclarativemetaobject/data/method.1.qml new file mode 100644 index 0000000000..a021881743 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/method.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + function testFunction() { return 19; } +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/method.2.qml b/tests/auto/declarative/qdeclarativemetaobject/data/method.2.qml new file mode 100644 index 0000000000..d514955f47 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/method.2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + function testFunction(foo) { return 19; } +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/method.3.qml b/tests/auto/declarative/qdeclarativemetaobject/data/method.3.qml new file mode 100644 index 0000000000..d6d19758c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/method.3.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + function testFunction(foo, bar, baz) { return 19; } +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.MyQmlObject.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.MyQmlObject.qml new file mode 100644 index 0000000000..8903bbb3e9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.MyQmlObject.qml @@ -0,0 +1,6 @@ +import Qt.test 1.0 +import QtQuick 2.0 + +QtObject { + property MyQmlObject test: MyQmlObject {} +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.QtObject.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.QtObject.qml new file mode 100644 index 0000000000..20c42b5851 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.QtObject.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property QtObject test: QtObject {} +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.2.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.2.qml new file mode 100644 index 0000000000..cae1ae6696 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.2.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +QtObject { + id: me + property alias test: me +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.3.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.3.qml new file mode 100644 index 0000000000..86422ae367 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.3.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Text { + id: me + font.family: "Arial" + property alias test: me.font.family +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.qml new file mode 100644 index 0000000000..33a4a1c5b0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.alias.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +QtObject { + objectName: "Joe" + id: me + property alias test: me.objectName +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.bool.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.bool.qml new file mode 100644 index 0000000000..9459cb6394 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.bool.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + default property bool test: true +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.color.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.color.qml new file mode 100644 index 0000000000..7451a27101 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.color.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + default property color test: "#ff0000" +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.date.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.date.qml new file mode 100644 index 0000000000..05fcb2516c --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.date.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property date test: "2012-02-07" +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.int.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.int.qml new file mode 100644 index 0000000000..ae419d08cb --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.int.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property int test: 19 +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.list.MyQmlObject.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.list.MyQmlObject.qml new file mode 100644 index 0000000000..602762cba2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.list.MyQmlObject.qml @@ -0,0 +1,6 @@ +import Qt.test 1.0 +import QtQuick 2.0 + +QtObject { + property list test: [ MyQmlObject {} ] +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.list.QtObject.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.list.QtObject.qml new file mode 100644 index 0000000000..e774d70b42 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.list.QtObject.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property list test: [ QtObject {} ] +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.real.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.real.qml new file mode 100644 index 0000000000..de2baf5be2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.real.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property real test: 21 +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.string.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.string.qml new file mode 100644 index 0000000000..2a625c4fe4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.string.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + default property string test: "dog" +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.url.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.url.qml new file mode 100644 index 0000000000..c820c82515 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.url.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property url test: "http://foo.bar" +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.var.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.var.qml new file mode 100644 index 0000000000..9ea9245317 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.var.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + property var test: [5, true, "ciao"] +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/property.variant.qml b/tests/auto/declarative/qdeclarativemetaobject/data/property.variant.qml new file mode 100644 index 0000000000..edffa173c4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/property.variant.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + default property variant test: "12,34" +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/signal.1.qml b/tests/auto/declarative/qdeclarativemetaobject/data/signal.1.qml new file mode 100644 index 0000000000..113130f3cc --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/signal.1.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal testSignal +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/signal.2.qml b/tests/auto/declarative/qdeclarativemetaobject/data/signal.2.qml new file mode 100644 index 0000000000..db860cc7cd --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/signal.2.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal testSignal(string foo) +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/signal.3.qml b/tests/auto/declarative/qdeclarativemetaobject/data/signal.3.qml new file mode 100644 index 0000000000..4d04041f8f --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/signal.3.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal testSignal(int foo, bool bar, real baz) +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/signal.4.qml b/tests/auto/declarative/qdeclarativemetaobject/data/signal.4.qml new file mode 100644 index 0000000000..ad9b002176 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/signal.4.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal testSignal(variant foo, var bar) +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/data/signal.5.qml b/tests/auto/declarative/qdeclarativemetaobject/data/signal.5.qml new file mode 100644 index 0000000000..b848bb5cb5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/data/signal.5.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +QtObject { + signal testSignal(color foo, date bar, url baz) +} diff --git a/tests/auto/declarative/qdeclarativemetaobject/qdeclarativemetaobject.pro b/tests/auto/declarative/qdeclarativemetaobject/qdeclarativemetaobject.pro new file mode 100644 index 0000000000..206f510506 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/qdeclarativemetaobject.pro @@ -0,0 +1,14 @@ +CONFIG += testcase +TARGET = tst_qdeclarativemetaobject +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativemetaobject.cpp + +include (../../shared/util.pri) + +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles + +CONFIG += parallel_test +QT += declarative testlib diff --git a/tests/auto/declarative/qdeclarativemetaobject/tst_qdeclarativemetaobject.cpp b/tests/auto/declarative/qdeclarativemetaobject/tst_qdeclarativemetaobject.cpp new file mode 100644 index 0000000000..424de872b7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetaobject/tst_qdeclarativemetaobject.cpp @@ -0,0 +1,364 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "../../shared/util.h" + +Q_DECLARE_METATYPE(QMetaMethod::MethodType) + +class MyQmlObject : public QObject +{ + Q_OBJECT +}; +QML_DECLARE_TYPE(MyQmlObject) + +class tst_QDeclarativeMetaObject : public QDeclarativeDataTest +{ + Q_OBJECT +private slots: + void initTestCase(); + + void property_data(); + void property(); + void method_data(); + void method(); + +private: + MyQmlObject myQmlObject; +}; + +void tst_QDeclarativeMetaObject::initTestCase() +{ + QDeclarativeDataTest::initTestCase(); + + qmlRegisterType("Qt.test", 1,0, "MyQmlObject"); +} + +void tst_QDeclarativeMetaObject::property_data() +{ + QTest::addColumn("testFile"); + QTest::addColumn("cppTypeName"); + QTest::addColumn("cppType"); + QTest::addColumn("isDefault"); + QTest::addColumn("expectedValue"); + QTest::addColumn("isWritable"); + QTest::addColumn("newValue"); + + QTest::newRow("int") << "property.int.qml" + << QByteArray("int") << int(QMetaType::Int) + << false // default + << QVariant(19) << true << QVariant(42); + QTest::newRow("bool") << "property.bool.qml" + << QByteArray("bool") << int(QMetaType::Bool) + << true // default + << QVariant(true) << true << QVariant(false); + QTest::newRow("real") << "property.real.qml" + << QByteArray("double") << int(QMetaType::Double) + << false // default + << QVariant(double(21)) + << true // writable + << QVariant(double(37)); + QTest::newRow("string") << "property.string.qml" + << QByteArray("QString") << int(QMetaType::QString) + << true // default + << QVariant(QString::fromLatin1("dog")) + << true // writable + << QVariant(QString::fromLatin1("food")); + QTest::newRow("url") << "property.url.qml" + << QByteArray("QUrl") << int(QMetaType::QUrl) + << false // default + << QVariant(QUrl("http://foo.bar")) + << true //writable + << QVariant(QUrl("http://bar.baz")); + QTest::newRow("color") << "property.color.qml" + << QByteArray("QColor") << int(QMetaType::QColor) + << true // default + << QVariant(QColor("#ff0000")) + << true // writable + << QVariant(QColor("#00ff00")); + QTest::newRow("date") << "property.date.qml" + << QByteArray("QDateTime") << int(QMetaType::QDateTime) + << false // default + << QVariant(QDateTime(QDate(2012, 2, 7))) + << true // writable + << QVariant(QDateTime(QDate(2010, 7, 2))); + QTest::newRow("variant") << "property.variant.qml" + << QByteArray("QVariant") << int(QMetaType::QVariant) + << true // default + << QVariant(QPointF(12, 34)) + << true // writable + << QVariant(QSizeF(45, 67)); + QTest::newRow("var") << "property.var.qml" + << QByteArray("QVariant") << int(QMetaType::QVariant) + << false // default + << QVariant(QVariantList() << 5 << true << "ciao") + << true // writable + << QVariant(QVariantList() << 17.0); + QTest::newRow("QtObject") << "property.QtObject.qml" + << QByteArray("QObject*") << int(QMetaType::QObjectStar) + << false // default + << QVariant() + << true // writable + << QVariant::fromValue(static_cast(this)); + QTest::newRow("list") << "property.list.QtObject.qml" + << QByteArray("QDeclarativeListProperty") + << qMetaTypeId >() + << false // default + << QVariant() + << false // writable + << QVariant(); + QTest::newRow("MyQmlObject") << "property.MyQmlObject.qml" + << QByteArray("MyQmlObject*") << qMetaTypeId() + << false // default + << QVariant() + << true // writable + << QVariant::fromValue(&myQmlObject); + QTest::newRow("list") << "property.list.MyQmlObject.qml" + << QByteArray("QDeclarativeListProperty") + << qMetaTypeId >() + << false // default + << QVariant() + << false // writable + << QVariant(); + QTest::newRow("alias") << "property.alias.qml" + << QByteArray("QString") << int(QMetaType::QString) + << false // default + << QVariant(QString::fromLatin1("Joe")) + << true // writable + << QVariant(QString::fromLatin1("Bob")); + QTest::newRow("alias-2") << "property.alias.2.qml" + << QByteArray("QObject*") << int(QMetaType::QObjectStar) + << false // default + << QVariant() + << false // writable + << QVariant(); + QTest::newRow("alias-3") << "property.alias.3.qml" + << QByteArray("QString") << int(QMetaType::QString) + << false // default + << QVariant(QString::fromLatin1("Arial")) + << true // writable + << QVariant(QString::fromLatin1("Helvetica")); +} + +void tst_QDeclarativeMetaObject::property() +{ + QFETCH(QString, testFile); + QFETCH(QByteArray, cppTypeName); + QFETCH(int, cppType); + QFETCH(bool, isDefault); + QFETCH(QVariant, expectedValue); + QFETCH(bool, isWritable); + QFETCH(QVariant, newValue); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, testFileUrl(testFile)); + QObject *object = component.create(); + QVERIFY(object != 0); + + const QMetaObject *mo = object->metaObject(); + QVERIFY(mo->superClass() != 0); + QVERIFY(QByteArray(mo->className()).contains("_QML_")); + QCOMPARE(mo->propertyOffset(), mo->superClass()->propertyCount()); + QCOMPARE(mo->propertyCount(), mo->superClass()->propertyCount() + 1); + + QMetaProperty prop = mo->property(mo->propertyOffset()); + QCOMPARE(prop.name(), "test"); + + QCOMPARE(QByteArray(prop.typeName()), cppTypeName); + QEXPECT_FAIL("QtObject", "prop.type() returns UserType for QtObject properties", Continue); + QEXPECT_FAIL("alias-2", "prop.type() returns UserType for QtObject properties", Continue); + if (prop.userType() < QMetaType::User) + QCOMPARE(prop.type(), QVariant::Type(cppType)); + QCOMPARE(prop.userType(), cppType); + + QVERIFY(!prop.isConstant()); + QVERIFY(!prop.isDesignable()); + QVERIFY(!prop.isEnumType()); + QVERIFY(!prop.isFinal()); + QVERIFY(!prop.isFlagType()); + QVERIFY(prop.isReadable()); + QVERIFY(!prop.isResettable()); + QVERIFY(prop.isScriptable()); + QVERIFY(!prop.isStored()); + QVERIFY(!prop.isUser()); + QVERIFY(prop.isValid()); + QCOMPARE(prop.isWritable(), isWritable); + + QCOMPARE(mo->classInfoOffset(), mo->superClass()->classInfoCount()); + QCOMPARE(mo->classInfoCount(), mo->superClass()->classInfoCount() + (isDefault ? 1 : 0)); + if (isDefault) { + QMetaClassInfo info = mo->classInfo(mo->classInfoOffset()); + QCOMPARE(info.name(), "DefaultProperty"); + QCOMPARE(info.value(), "test"); + } + + QCOMPARE(mo->methodOffset(), mo->superClass()->methodCount()); + QCOMPARE(mo->methodCount(), mo->superClass()->methodCount() + 1); // the signal + + QVERIFY(prop.notifySignalIndex() != -1); + QMetaMethod signal = prop.notifySignal(); + QCOMPARE(signal.methodType(), QMetaMethod::Signal); + QCOMPARE(signal.signature(), "testChanged()"); + QCOMPARE(signal.access(), QMetaMethod::Protected); + QCOMPARE(signal.parameterTypes(), QList()); + QCOMPARE(signal.parameterNames(), QList()); + QCOMPARE(signal.tag(), ""); + QCOMPARE(signal.typeName(), ""); + + QSignalSpy changedSpy(object, SIGNAL(testChanged())); + QObject::connect(object, SIGNAL(testChanged()), object, SLOT(deleteLater())); + + if (expectedValue.isValid()) + QCOMPARE(prop.read(object), expectedValue); + else + QVERIFY(prop.read(object).isValid()); + QCOMPARE(changedSpy.count(), 0); + + if (isWritable) { + QVERIFY(prop.write(object, newValue)); + QCOMPARE(changedSpy.count(), 1); + QCOMPARE(prop.read(object), newValue); + } else { + QVERIFY(!prop.write(object, prop.read(object))); + QCOMPARE(changedSpy.count(), 0); + } + + delete object; +} + +void tst_QDeclarativeMetaObject::method_data() +{ + QTest::addColumn("testFile"); + QTest::addColumn("signature"); + QTest::addColumn("methodType"); + QTest::addColumn("returnTypeName"); + QTest::addColumn >("parameterTypeNames"); + QTest::addColumn >("parameterNames"); + + QTest::newRow("testFunction()") << "method.1.qml" + << "testFunction()" + << QMetaMethod::Slot + << "QVariant" + << QList() + << QList(); + QTest::newRow("testFunction(foo)") << "method.2.qml" + << "testFunction(QVariant)" + << QMetaMethod::Slot + << "QVariant" + << (QList() << "QVariant") + << (QList() << "foo"); + QTest::newRow("testFunction(foo, bar, baz)") << "method.3.qml" + << "testFunction(QVariant,QVariant,QVariant)" + << QMetaMethod::Slot + << "QVariant" + << (QList() << "QVariant" << "QVariant" << "QVariant") + << (QList() << "foo" << "bar" << "baz"); + QTest::newRow("testSignal") << "signal.1.qml" + << "testSignal()" + << QMetaMethod::Signal + << "" + << QList() + << QList(); + QTest::newRow("testSignal(string foo)") << "signal.2.qml" + << "testSignal(QString)" + << QMetaMethod::Signal + << "" + << (QList() << "QString") + << (QList() << "foo"); + QTest::newRow("testSignal(int foo, bool bar, real baz)") << "signal.3.qml" + << "testSignal(int,bool,qreal)" + << QMetaMethod::Signal + << "" + << (QList() << "int" << "bool" << "qreal") + << (QList() << "foo" << "bar" << "baz"); + QTest::newRow("testSignal(variant foo, var bar)") << "signal.4.qml" + << "testSignal(QVariant,QVariant)" + << QMetaMethod::Signal + << "" + << (QList() << "QVariant" << "QVariant") + << (QList() << "foo" << "bar"); + QTest::newRow("testSignal(color foo, date bar, url baz)") << "signal.5.qml" + << "testSignal(QColor,QDateTime,QUrl)" + << QMetaMethod::Signal + << "" + << (QList() << "QColor" << "QDateTime" << "QUrl") + << (QList() << "foo" << "bar" << "baz"); +} + +void tst_QDeclarativeMetaObject::method() +{ + QFETCH(QString, testFile); + QFETCH(QString, signature); + QFETCH(QMetaMethod::MethodType, methodType); + QFETCH(QString, returnTypeName); + QFETCH(QList, parameterTypeNames); + QFETCH(QList, parameterNames); + + QCOMPARE(parameterTypeNames.size(), parameterNames.size()); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, testFileUrl(testFile)); + QObject *object = component.create(); + QVERIFY(object != 0); + + const QMetaObject *mo = object->metaObject(); + QVERIFY(mo->superClass() != 0); + QVERIFY(QByteArray(mo->className()).contains("_QML_")); + QCOMPARE(mo->methodOffset(), mo->superClass()->methodCount()); + QCOMPARE(mo->methodCount(), mo->superClass()->methodCount() + 1); + + QMetaMethod method = mo->method(mo->methodOffset()); + QCOMPARE(method.methodType(), methodType); + QCOMPARE(QString::fromUtf8(method.signature()), signature); + QCOMPARE(method.access(), QMetaMethod::Protected); + QCOMPARE(method.parameterTypes(), parameterTypeNames); + QCOMPARE(method.parameterNames(), parameterNames); + QCOMPARE(method.tag(), ""); + QCOMPARE(QString::fromUtf8(method.typeName()), returnTypeName); + + delete object; +} + +QTEST_MAIN(tst_QDeclarativeMetaObject) + +#include "tst_qdeclarativemetaobject.moc" From 1ebad3a320e69b82a7a135f618fd38f650791539 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 1 Mar 2012 10:10:07 +1000 Subject: [PATCH 55/82] Fix QQuickDropArea test compilation. Change-Id: I5feaabe235201af842ca6bc4f3496b1861b06fb9 Reviewed-by: Michael Brasser --- .../qquickdroparea/qquickdroparea.pro | 2 + .../qquickdroparea/tst_qquickdroparea.cpp | 75 ++++++++++--------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/tests/auto/qtquick2/qquickdroparea/qquickdroparea.pro b/tests/auto/qtquick2/qquickdroparea/qquickdroparea.pro index 46fe08c145..6c6de13d5f 100644 --- a/tests/auto/qtquick2/qquickdroparea/qquickdroparea.pro +++ b/tests/auto/qtquick2/qquickdroparea/qquickdroparea.pro @@ -7,3 +7,5 @@ SOURCES += tst_qquickdroparea.cpp CONFIG += parallel_test QT += core-private gui-private declarative-private quick-private network testlib + +mac: CONFIG += insignificant_test # QTBUG-24588 diff --git a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp index 0cd3fa9416..88cf1ec009 100644 --- a/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/qtquick2/qquickdroparea/tst_qquickdroparea.cpp @@ -48,6 +48,7 @@ #include #include +#include template static T evaluate(QObject *scope, const QString &expression) { @@ -193,14 +194,14 @@ void tst_QQuickDropArea::containsDrag_external() QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "hasDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(evaluate(dropArea, "exitEvents"), 0); evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); @@ -208,13 +209,13 @@ void tst_QQuickDropArea::containsDrag_external() evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(150, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(150, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "exitEvents"), 0); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "hasDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); @@ -222,13 +223,13 @@ void tst_QQuickDropArea::containsDrag_external() evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(150, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(150, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "exitEvents"), 1); - QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(150, 50)); + QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(150, 50), Qt::CopyAction); } void tst_QQuickDropArea::keys_internal() @@ -363,80 +364,80 @@ void tst_QQuickDropArea::keys_external() QCOMPARE(evaluate(dropArea, "containsDrag"), false); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); evaluate(dropArea, "keys = \"text/x-blue\""); QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-blue"); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-blue"); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); evaluate(dropArea, "keys = \"text/x-red\""); QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red"); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red"); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); evaluate(dropArea, "keys = \"text/x-green\""); QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-green"); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-green"); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); evaluate(dropArea, "keys = [\"text/x-red\", \"text/x-green\"]"); QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red" << "text/x-green"); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red" << "text/x-green"); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); data.removeFormat("text/x-red"); data.removeFormat("text/x-blue"); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); evaluate(dropArea, "keys = []"); QCOMPARE(dropArea->property("keys").toStringList(), QStringList()); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList()); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList()); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); data.setData("text/x-red", "red"); data.setData("text/x-blue", "blue"); QCOMPARE(dropArea->property("keys").toStringList(), QStringList()); QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList()); evaluate(dropArea, "{ enterEvents = 0; dragKeys = undefined }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue"); - QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(50, 50), Qt::CopyAction); } void tst_QQuickDropArea::source_internal() @@ -589,7 +590,7 @@ void tst_QQuickDropArea::position_external() QMimeData data; - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(50)); @@ -600,7 +601,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(40, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(40, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(40)); @@ -611,7 +612,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(75, 25)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(75, 25), Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(75)); @@ -621,7 +622,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventX"), qreal(75)); QCOMPARE(evaluate(dropArea, "eventY"), qreal(25)); - QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(75, 25)); + QWindowSystemInterface::handleDrop(&canvas, &data, QPoint(75, 25), Qt::CopyAction); } void tst_QQuickDropArea::drop_internal() @@ -886,7 +887,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -894,7 +895,7 @@ void tst_QQuickDropArea::simultaneousDrags() QCOMPARE(evaluate(dropArea2, "enterEvents"), 0); QCOMPARE(evaluate(dropArea2, "exitEvents"), 0); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -902,7 +903,7 @@ void tst_QQuickDropArea::simultaneousDrags() QCOMPARE(evaluate(dropArea2, "enterEvents"), 0); QCOMPARE(evaluate(dropArea2, "exitEvents"), 0); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -920,7 +921,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), false); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -931,7 +932,7 @@ void tst_QQuickDropArea::simultaneousDrags() // external then internal. evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 1); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -965,7 +966,7 @@ void tst_QQuickDropArea::simultaneousDrags() QCOMPARE(evaluate(dropArea2, "enterEvents"), 0); QCOMPARE(evaluate(dropArea2, "exitEvents"), 0); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), false); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 1); @@ -1061,7 +1062,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -1071,7 +1072,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -1081,7 +1082,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&canvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), true); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -1101,7 +1102,7 @@ void tst_QQuickDropArea::simultaneousDrags() evaluate(dropArea1, "{ enterEvents = 0; exitEvents = 0 }"); evaluate(dropArea2, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrag(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); QCOMPARE(evaluate(dropArea1, "containsDrag"), false); QCOMPARE(evaluate(dropArea1, "enterEvents"), 0); QCOMPARE(evaluate(dropArea1, "exitEvents"), 0); @@ -1109,7 +1110,7 @@ void tst_QQuickDropArea::simultaneousDrags() QCOMPARE(evaluate(dropArea2, "enterEvents"), 0); QCOMPARE(evaluate(dropArea2, "exitEvents"), 1); - QWindowSystemInterface::handleDrop(&alternateCanvas, &data, QPoint(50, 50)); + QWindowSystemInterface::handleDrop(&alternateCanvas, &data, QPoint(50, 50), Qt::CopyAction); } QTEST_MAIN(tst_QQuickDropArea) From e3a43b3ca3b1e2d6fd92945d6d7f42aed8203abc Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 24 Feb 2012 09:27:12 +1000 Subject: [PATCH 56/82] Reduce size of QQuickTextPrivate Move less used members to an extra struct lazily allocated Change-Id: I87e464af4b9d29303705dd7e766f734309ed7763 Reviewed-by: Andrew den Exter --- src/quick/items/qquicktext.cpp | 193 ++++++++++-------- src/quick/items/qquicktext_p_p.h | 37 ++-- .../qtquick2/qquicktext/tst_qquicktext.cpp | 13 +- 3 files changed, 137 insertions(+), 106 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 656440f2d3..f0ce26ed62 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -71,17 +71,16 @@ QT_BEGIN_NAMESPACE const QChar QQuickTextPrivate::elideChar = QChar(0x2026); QQuickTextPrivate::QQuickTextPrivate() - : lineHeight(1) - , elideLayout(0), textLine(0), doc(0) + : elideLayout(0), textLine(0) #if defined(Q_OS_MAC) , layoutThread(0), paintingThread(0) #endif , color(0xFF000000), linkColor(0xFF0000FF), styleColor(0xFF000000) - , lineCount(1), maximumLineCount(INT_MAX), multilengthEos(-1), minimumPixelSize(12), minimumPointSize(12), nbActiveDownloads(0) - , hAlign(QQuickText::AlignLeft), vAlign(QQuickText::AlignTop), elideMode(QQuickText::ElideNone) + , lineCount(1), multilengthEos(-1) + , elideMode(QQuickText::ElideNone), hAlign(QQuickText::AlignLeft), vAlign(QQuickText::AlignTop) , format(QQuickText::AutoText), wrapMode(QQuickText::NoWrap) - , lineHeightMode(QQuickText::ProportionalHeight), style(QQuickText::Normal) - , fontSizeMode(QQuickText::FixedSize), updateType(UpdatePaintNode) + , style(QQuickText::Normal) + , updateType(UpdatePaintNode) , maximumLineCountValid(false), updateOnComponentComplete(true), richText(false) , styledText(false), singleline(false), internalWidthUpdate(false), requireImplicitWidth(false) , truncated(false), hAlignImplicit(true), rightToLeftText(false) @@ -89,6 +88,18 @@ QQuickTextPrivate::QQuickTextPrivate() { } +QQuickTextPrivate::ExtraData::ExtraData() + : lineHeight(1.0) + , doc(0) + , minimumPixelSize(12) + , minimumPointSize(12) + , nbActiveDownloads(0) + , maximumLineCount(INT_MAX) + , lineHeightMode(QQuickText::ProportionalHeight) + , fontSizeMode(QQuickText::FixedSize) +{ +} + void QQuickTextPrivate::init() { Q_Q(QQuickText); @@ -323,10 +334,10 @@ void QQuickTextPrivate::updateLayout() } else { ensureDoc(); QTextBlockFormat::LineHeightTypes type; - type = lineHeightMode == QQuickText::FixedHeight ? QTextBlockFormat::FixedHeight : QTextBlockFormat::ProportionalHeight; + type = lineHeightMode() == QQuickText::FixedHeight ? QTextBlockFormat::FixedHeight : QTextBlockFormat::ProportionalHeight; QTextBlockFormat blockFormat; - blockFormat.setLineHeight((lineHeightMode == QQuickText::FixedHeight ? lineHeight : lineHeight * 100), type); - for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next()) { + blockFormat.setLineHeight((lineHeightMode() == QQuickText::FixedHeight ? lineHeight() : lineHeight() * 100), type); + for (QTextBlock it = extra->doc->begin(); it != extra->doc->end(); it = it.next()) { QTextCursor cursor(it); cursor.mergeBlockFormat(blockFormat); } @@ -345,13 +356,13 @@ void QQuickText::imageDownloadFinished() { Q_D(QQuickText); - (d->nbActiveDownloads)--; + (d->extra->nbActiveDownloads)--; // when all the remote images have been downloaded, // if one of the sizes was not specified at parsing time // we use the implicit size from pixmapcache and re-layout. - if (d->nbActiveDownloads == 0) { + if (d->extra.isAllocated() && d->extra->nbActiveDownloads == 0) { bool needToUpdateLayout = false; foreach (QDeclarativeStyledTextImgTag *img, d->visibleImgTags) { if (!img->size.isValid()) { @@ -415,7 +426,7 @@ void QQuickTextPrivate::updateSize() } else { singleline = false; // richtext can't elide or be optimized for single-line case ensureDoc(); - doc->setDefaultFont(font); + extra->doc->setDefaultFont(font); QQuickText::HAlignment horizontalAlignment = q->effectiveHAlign(); if (rightToLeftText) { if (horizontalAlignment == QQuickText::AlignLeft) @@ -427,19 +438,19 @@ void QQuickTextPrivate::updateSize() option.setAlignment((Qt::Alignment)int(horizontalAlignment | vAlign)); option.setWrapMode(QTextOption::WrapMode(wrapMode)); option.setUseDesignMetrics(true); - doc->setDefaultTextOption(option); + extra->doc->setDefaultTextOption(option); if (requireImplicitWidth && q->widthValid()) { - doc->setTextWidth(-1); - naturalWidth = doc->idealWidth(); + extra->doc->setTextWidth(-1); + naturalWidth = extra->doc->idealWidth(); } if (wrapMode != QQuickText::NoWrap && q->widthValid()) - doc->setTextWidth(q->width()); + extra->doc->setTextWidth(q->width()); else - doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) - dy -= doc->size().height(); - QSizeF dsize = doc->size(); + extra->doc->setTextWidth(extra->doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) + dy -= extra->doc->size().height(); + QSizeF dsize = extra->doc->size(); layedOutTextRect = QRectF(QPointF(0,0), dsize); - size = QSizeF(doc->idealWidth(),dsize.height()); + size = QSizeF(extra->doc->idealWidth(),dsize.height()); } qreal yoff = 0; @@ -581,8 +592,8 @@ void QQuickTextPrivate::setupCustomLineGeometry(QTextLine &line, qreal &height, textLine->setWidth(q->width()); else textLine->setWidth(INT_MAX); - if (lineHeight != 1.0) - textLine->setHeight((lineHeightMode == QQuickText::FixedHeight) ? lineHeight : line.height() * lineHeight); + if (lineHeight() != 1.0) + textLine->setHeight((lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : line.height() * lineHeight()); emit q->lineLaidOut(textLine); @@ -658,7 +669,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) // Layout to determine the implicit width. layout.beginLayout(); - for (int i = 0; i < maximumLineCount; ++i) { + for (int i = 0; i < maximumLineCount(); ++i) { QTextLine line = layout.createLine(); if (!line.isValid()) break; @@ -669,7 +680,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) } QFontMetrics fm(font); - qreal height = (lineHeightMode == QQuickText::FixedHeight) ? lineHeight : fm.height() * lineHeight; + qreal height = (lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : fm.height() * lineHeight(); return QRect(0, 0, 0, height); } @@ -686,15 +697,15 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) && (q->heightValid() || maximumLineCountValid); const bool canWrap = wrapMode != QQuickText::NoWrap && q->widthValid(); - const bool horizontalFit = fontSizeMode & QQuickText::HorizontalFit && q->widthValid(); - const bool verticalFit = fontSizeMode & QQuickText::VerticalFit + const bool horizontalFit = fontSizeMode() & QQuickText::HorizontalFit && q->widthValid(); + const bool verticalFit = fontSizeMode() & QQuickText::VerticalFit && (q->heightValid() || (maximumLineCountValid && canWrap)); const bool pixelSize = font.pixelSize() != -1; QString layoutText = layout.text(); int largeFont = pixelSize ? font.pixelSize() : font.pointSize(); - int smallFont = fontSizeMode != QQuickText::FixedSize - ? qMin(pixelSize ? minimumPixelSize : minimumPointSize, largeFont) + int smallFont = fontSizeMode() != QQuickText::FixedSize + ? qMin(pixelSize ? minimumPixelSize() : minimumPointSize(), largeFont) : largeFont; int scaledFontSize = largeFont; @@ -732,6 +743,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) elide = false; int characterCount = 0; int unwrappedLineCount = 1; + int maxLineCount = maximumLineCount(); height = 0; br = QRectF(); line = layout.createLine(); @@ -767,7 +779,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) line.setPosition(QPointF(FLT_MAX, FLT_MAX)); line = previousLine; --visibleCount; - height -= (lineHeightMode == QQuickText::FixedHeight) ? lineHeight : previousLine.height() * lineHeight; + height -= (lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : previousLine.height() * lineHeight(); break; } @@ -801,7 +813,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) // Stop if the maximum number of lines has been reached and elide the last line // if enabled. - if (visibleCount == maximumLineCount) { + if (visibleCount == maxLineCount) { truncated = true; characterCount = nextLine.textStart() + nextLine.textLength(); @@ -835,13 +847,13 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) if (requireImplicitWidth && characterCount < layoutText.length() - && unwrappedLineCount < maximumLineCount) { + && unwrappedLineCount < maxLineCount) { // Use a new layout to get the maximum width for the remaining text. Using a // different layout excludes the truncated text from rendering. QTextLayout widthLayout(layoutText.mid(characterCount), scaledFont); widthLayout.setTextOption(layout.textOption()); - for (; unwrappedLineCount <= maximumLineCount; ++unwrappedLineCount) { + for (; unwrappedLineCount <= maxLineCount; ++unwrappedLineCount) { QTextLine line = widthLayout.createLine(); if (!line.isValid()) break; @@ -952,7 +964,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal if (imgTags.isEmpty()) { line.setPosition(QPointF(line.position().x(), height)); - height += (lineHeightMode == QQuickText::FixedHeight) ? lineHeight : line.height() * lineHeight; + height += (lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : line.height() * lineHeight(); return; } @@ -971,7 +983,9 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal image->pix = new QDeclarativePixmap(qmlEngine(q), url, image->size); if (image->pix->isLoading()) { image->pix->connectFinished(q, SLOT(imageDownloadFinished())); - nbActiveDownloads++; + if (!extra.isAllocated() || !extra->nbActiveDownloads) + extra.value().nbActiveDownloads = 0; + extra->nbActiveDownloads++; } else if (image->pix->isReady()) { if (!image->size.isValid()) { image->size = image->pix->implicitSize(); @@ -1004,7 +1018,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal } line.setPosition(QPointF(line.position().x(), height + textTop)); - height += (lineHeightMode == QQuickText::FixedHeight) ? lineHeight : totalLineHeight * lineHeight; + height += (lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : totalLineHeight * lineHeight(); } /*! @@ -1012,12 +1026,12 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal */ void QQuickTextPrivate::ensureDoc() { - if (!doc) { + if (!extra.isAllocated() || !extra->doc) { Q_Q(QQuickText); - doc = new QQuickTextDocumentWithImageResources(q); - doc->setDocumentMargin(0); - doc->setBaseUrl(q->baseUrl()); - FAST_CONNECT(doc, SIGNAL(imagesLoaded()), q, SLOT(q_imagesLoaded())); + extra.value().doc = new QQuickTextDocumentWithImageResources(q); + extra->doc->setDocumentMargin(0); + extra->doc->setBaseUrl(q->baseUrl()); + FAST_CONNECT(extra->doc, SIGNAL(imagesLoaded()), q, SLOT(q_imagesLoaded())); } } @@ -1304,8 +1318,8 @@ void QQuickText::setText(const QString &n) if (isComponentComplete()) { if (d->richText) { d->ensureDoc(); - d->doc->setText(n); - d->rightToLeftText = d->doc->toPlainText().isRightToLeft(); + d->extra->doc->setText(n); + d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft(); } else { d->rightToLeftText = d->text.isRightToLeft(); } @@ -1569,11 +1583,6 @@ void QQuickTextPrivate::mirrorChange() } } -QTextDocument *QQuickTextPrivate::textDocument() -{ - return doc; -} - QQuickText::VAlignment QQuickText::vAlign() const { Q_D(const QQuickText); @@ -1666,7 +1675,7 @@ bool QQuickText::truncated() const int QQuickText::maximumLineCount() const { Q_D(const QQuickText); - return d->maximumLineCount; + return d->maximumLineCount(); } void QQuickText::setMaximumLineCount(int lines) @@ -1674,8 +1683,8 @@ void QQuickText::setMaximumLineCount(int lines) Q_D(QQuickText); d->maximumLineCountValid = lines==INT_MAX ? false : true; - if (d->maximumLineCount != lines) { - d->maximumLineCount = lines; + if (d->maximumLineCount() != lines) { + d->extra.value().maximumLineCount = lines; d->updateLayout(); emit maximumLineCountChanged(); } @@ -1777,8 +1786,8 @@ void QQuickText::setTextFormat(TextFormat format) if (isComponentComplete()) { if (!wasRich && d->richText) { d->ensureDoc(); - d->doc->setText(d->text); - d->rightToLeftText = d->doc->toPlainText().isRightToLeft(); + d->extra->doc->setText(d->text); + d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft(); } else { d->rightToLeftText = d->text.isRightToLeft(); } @@ -1831,7 +1840,7 @@ void QQuickText::setElideMode(QQuickText::TextElideMode mode) d->elideMode = mode; d->updateLayout(); - emit elideModeChanged(d->elideMode); + emit elideModeChanged(mode); } /*! @@ -1873,8 +1882,10 @@ void QQuickText::setBaseUrl(const QUrl &url) if (baseUrl() != url) { d->baseUrl = url; - if (d->doc) - d->doc->setBaseUrl(url); + if (d->richText) { + d->ensureDoc(); + d->extra->doc->setBaseUrl(url); + } if (d->styledText) { d->textHasChanged = true; qDeleteAll(d->imgTags); @@ -1933,7 +1944,7 @@ void QQuickText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo bool leftAligned = effectiveHAlign() == QQuickText::AlignLeft; bool wrapped = d->wrapMode != QQuickText::NoWrap; bool elide = d->elideMode != QQuickText::ElideNone; - bool scaleFont = d->fontSizeMode != QQuickText::FixedSize && (widthValid() || heightValid()); + bool scaleFont = d->fontSizeMode() != QQuickText::FixedSize && (widthValid() || heightValid()); if ((!widthChanged && !heightChanged) || d->internalWidthUpdate) goto geomChangeDone; @@ -1954,7 +1965,7 @@ void QQuickText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo if (d->elideMode == QQuickText::ElideRight && wrapped && newGeometry.height() > oldGeometry.height() && !scaleFont) { if (!d->truncated) goto geomChangeDone; // Multiline eliding not affected if we're not currently truncated and we get higher. - if (d->maximumLineCountValid && d->lineCount == d->maximumLineCount) + if (d->maximumLineCountValid && d->lineCount == d->maximumLineCount()) goto geomChangeDone; // Multiline eliding not affected if we're already at max line count and we get higher. } @@ -2021,7 +2032,7 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data if (d->richText) { d->ensureDoc(); - node->addTextDocument(bounds.topLeft(), d->doc, color, d->style, styleColor, linkColor); + node->addTextDocument(bounds.topLeft(), d->extra->doc, color, d->style, styleColor, linkColor); } else if (d->elideMode == QQuickText::ElideNone || bounds.width() > 0.) { node->addTextLayout(QPoint(0, bounds.y()), &d->layout, color, d->style, styleColor, linkColor); if (d->elideLayout) @@ -2081,17 +2092,17 @@ qreal QQuickText::contentHeight() const qreal QQuickText::lineHeight() const { Q_D(const QQuickText); - return d->lineHeight; + return d->lineHeight(); } void QQuickText::setLineHeight(qreal lineHeight) { Q_D(QQuickText); - if ((d->lineHeight == lineHeight) || (lineHeight < 0.0)) + if ((d->lineHeight() == lineHeight) || (lineHeight < 0.0)) return; - d->lineHeight = lineHeight; + d->extra.value().lineHeight = lineHeight; d->updateLayout(); emit lineHeightChanged(lineHeight); } @@ -2111,16 +2122,16 @@ void QQuickText::setLineHeight(qreal lineHeight) QQuickText::LineHeightMode QQuickText::lineHeightMode() const { Q_D(const QQuickText); - return d->lineHeightMode; + return d->lineHeightMode(); } void QQuickText::setLineHeightMode(LineHeightMode mode) { Q_D(QQuickText); - if (mode == d->lineHeightMode) + if (mode == d->lineHeightMode()) return; - d->lineHeightMode = mode; + d->extra.value().lineHeightMode = mode; d->updateLayout(); emit lineHeightModeChanged(mode); @@ -2154,18 +2165,18 @@ void QQuickText::setLineHeightMode(LineHeightMode mode) QQuickText::FontSizeMode QQuickText::fontSizeMode() const { Q_D(const QQuickText); - return d->fontSizeMode; + return d->fontSizeMode(); } void QQuickText::setFontSizeMode(FontSizeMode mode) { Q_D(QQuickText); - if (d->fontSizeMode == mode) + if (d->fontSizeMode() == mode) return; polish(); - d->fontSizeMode = mode; + d->extra.value().fontSizeMode = mode; emit fontSizeModeChanged(); } @@ -2182,18 +2193,18 @@ void QQuickText::setFontSizeMode(FontSizeMode mode) int QQuickText::minimumPixelSize() const { Q_D(const QQuickText); - return d->minimumPixelSize; + return d->minimumPixelSize(); } void QQuickText::setMinimumPixelSize(int size) { Q_D(QQuickText); - if (d->minimumPixelSize == size) + if (d->minimumPixelSize() == size) return; - if (d->fontSizeMode != FixedSize && (widthValid() || heightValid())) + if (d->fontSizeMode() != FixedSize && (widthValid() || heightValid())) polish(); - d->minimumPixelSize = size; + d->extra.value().minimumPixelSize = size; emit minimumPixelSizeChanged(); } @@ -2210,18 +2221,18 @@ void QQuickText::setMinimumPixelSize(int size) int QQuickText::minimumPointSize() const { Q_D(const QQuickText); - return d->minimumPointSize; + return d->minimumPointSize(); } void QQuickText::setMinimumPointSize(int size) { Q_D(QQuickText); - if (d->minimumPointSize == size) + if (d->minimumPointSize() == size) return; - if (d->fontSizeMode != FixedSize && (widthValid() || heightValid())) + if (d->fontSizeMode() != FixedSize && (widthValid() || heightValid())) polish(); - d->minimumPointSize = size; + d->extra.value().minimumPointSize = size; emit minimumPointSizeChanged(); } @@ -2231,7 +2242,9 @@ void QQuickText::setMinimumPointSize(int size) int QQuickText::resourcesLoading() const { Q_D(const QQuickText); - return d->doc ? d->doc->resourcesLoading() : 0; + if (d->richText && d->extra.isAllocated() && d->extra->doc) + return d->extra->doc->resourcesLoading(); + return 0; } /*! \internal */ @@ -2241,8 +2254,8 @@ void QQuickText::componentComplete() if (d->updateOnComponentComplete) { if (d->richText) { d->ensureDoc(); - d->doc->setText(d->text); - d->rightToLeftText = d->doc->toPlainText().isRightToLeft(); + d->extra->doc->setText(d->text); + d->rightToLeftText = d->extra->doc->toPlainText().isRightToLeft(); } else { d->rightToLeftText = d->text.isRightToLeft(); } @@ -2289,15 +2302,21 @@ void QQuickText::mousePressEvent(QMouseEvent *event) { Q_D(QQuickText); + QString link; if (d->isLinkActivatedConnected()) { if (d->styledText) - d->activeLink = d->anchorAt(event->localPos()); - else if (d->richText && d->doc) - d->activeLink = d->doc->documentLayout()->anchorAt(event->localPos()); + link = d->anchorAt(event->localPos()); + else if (d->richText) { + d->ensureDoc(); + link = d->extra->doc->documentLayout()->anchorAt(event->localPos()); + } } - if (d->activeLink.isEmpty()) + if (link.isEmpty()) { event->setAccepted(false); + } else { + d->extra.value().activeLink = link; + } // ### may malfunction if two of the same links are clicked & dragged onto each other) @@ -2317,12 +2336,14 @@ void QQuickText::mouseReleaseEvent(QMouseEvent *event) if (d->isLinkActivatedConnected()) { if (d->styledText) link = d->anchorAt(event->localPos()); - else if (d->richText && d->doc) - link = d->doc->documentLayout()->anchorAt(event->localPos()); + else if (d->richText) { + d->ensureDoc(); + link = d->extra->doc->documentLayout()->anchorAt(event->localPos()); + } } - if (!link.isEmpty() && d->activeLink == link) - emit linkActivated(d->activeLink); + if (!link.isEmpty() && d->extra.isAllocated() && d->extra->activeLink == link) + emit linkActivated(d->extra->activeLink); else event->setAccepted(false); diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index d0770e6962..e61eea90ae 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -60,6 +60,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -79,17 +80,28 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate bool determineHorizontalAlignment(); bool setHAlign(QQuickText::HAlignment, bool forceAlign = false); void mirrorChange(); - QTextDocument *textDocument(); bool isLineLaidOutConnected(); void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; QRectF layedOutTextRect; - qreal lineHeight; + struct ExtraData { + ExtraData(); + + qreal lineHeight; + QQuickTextDocumentWithImageResources *doc; + QString activeLink; + int minimumPixelSize; + int minimumPointSize; + int nbActiveDownloads; + int maximumLineCount; + QQuickText::LineHeightMode lineHeightMode; + QQuickText::FontSizeMode fontSizeMode; + }; + QLazilyAllocated extra; QString text; - QString activeLink; QUrl baseUrl; QFont font; QFont sourceFont; @@ -99,7 +111,6 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate QTextLayout layout; QTextLayout *elideLayout; QQuickTextLine *textLine; - QQuickTextDocumentWithImageResources *doc; #if defined(Q_OS_MAC) QList linesRects; @@ -112,11 +123,7 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate QRgb styleColor; int lineCount; - int maximumLineCount; int multilengthEos; - int minimumPixelSize; - int minimumPointSize; - int nbActiveDownloads; enum UpdateType { UpdateNone, @@ -124,14 +131,12 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate UpdatePaintNode }; + QQuickText::TextElideMode elideMode; QQuickText::HAlignment hAlign; QQuickText::VAlignment vAlign; - QQuickText::TextElideMode elideMode; QQuickText::TextFormat format; QQuickText::WrapMode wrapMode; - QQuickText::LineHeightMode lineHeightMode; QQuickText::TextStyle style; - QQuickText::FontSizeMode fontSizeMode; UpdateType updateType; bool maximumLineCountValid:1; @@ -161,9 +166,13 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate bool isLinkActivatedConnected(); QString anchorAt(const QPointF &pos); - static inline QQuickTextPrivate *get(QQuickText *t) { - return t->d_func(); - } + inline qreal lineHeight() const { return extra.isAllocated() ? extra->lineHeight : 1.0; } + inline int maximumLineCount() const { return extra.isAllocated() ? extra->maximumLineCount : INT_MAX; } + inline QQuickText::LineHeightMode lineHeightMode() const { return extra.isAllocated() ? extra->lineHeightMode : QQuickText::ProportionalHeight; } + inline QQuickText::FontSizeMode fontSizeMode() const { return extra.isAllocated() ? extra->fontSizeMode : QQuickText::FixedSize; } + inline int minimumPixelSize() const { return extra.isAllocated() ? extra->minimumPixelSize : 12; } + inline int minimumPointSize() const { return extra.isAllocated() ? extra->minimumPointSize : 12; } + static inline QQuickTextPrivate *get(QQuickText *t) { return t->d_func(); } }; class QDeclarativePixmap; diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index 5f13f6211d..2be2dcd43d 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -326,8 +326,9 @@ void tst_qquicktext::width() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); QVERIFY(textPrivate != 0); + QVERIFY(textPrivate->extra.isAllocated()); - QTextDocument *doc = textPrivate->textDocument(); + QTextDocument *doc = textPrivate->extra->doc; QVERIFY(doc != 0); QCOMPARE(int(textObject->width()), int(doc->idealWidth())); @@ -677,19 +678,20 @@ void tst_qquicktext::horizontalAlignment_RightToLeft() // implicitly aligned rich text should follow the reading direction of text QCOMPARE(text->hAlign(), QQuickText::AlignRight); QCOMPARE(text->effectiveHAlign(), text->hAlign()); - QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignLeft); + QVERIFY(textPrivate->extra.isAllocated()); + QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignLeft); // explicitly left aligned rich text text->setHAlign(QQuickText::AlignLeft); QCOMPARE(text->hAlign(), QQuickText::AlignLeft); QCOMPARE(text->effectiveHAlign(), text->hAlign()); - QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignRight); + QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignRight); // explicitly right aligned rich text text->setHAlign(QQuickText::AlignRight); QCOMPARE(text->hAlign(), QQuickText::AlignRight); QCOMPARE(text->effectiveHAlign(), text->hAlign()); - QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignLeft); + QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignLeft); text->setText(textString); text->setTextFormat(QQuickText::PlainText); @@ -1623,8 +1625,7 @@ void tst_qquicktext::lineLaidOut() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); QVERIFY(textPrivate != 0); - QTextDocument *doc = textPrivate->textDocument(); - QVERIFY(doc == 0); + QVERIFY(!textPrivate->extra.isAllocated()); #if defined(Q_OS_MAC) QVERIFY(myText->lineCount() == textPrivate->linesRects.count()); From beecd8388bc5f3f95c221027318642429f1902cb Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 28 Feb 2012 13:20:56 +1000 Subject: [PATCH 57/82] Update ImageElement examples Now more consistently formed. Required a UI redesign for border image, you now view one at a time, with a selector control. Change-Id: Idf64119b644c1a79779ea0a46412247d6d013cb1 Reviewed-by: Alan Alpert Reviewed-by: Yann Bodson --- doc/src/examples/examples-groups.qdoc | 10 -- .../qtquick/imageelements/animatedsprite.qml | 8 +- .../qtquick/imageelements/borderimage.qml | 28 ++++-- .../content/BorderImageSelector.qml | 96 +++++++++++++++++++ .../imageelements/content/MyBorderImage.qml | 2 +- examples/qtquick/imageelements/image.qml | 34 +++---- .../qtquick/imageelements/imageelements.pro | 10 ++ .../qtquick/imageelements/imageelements.qml | 25 ++++- examples/qtquick/imageelements/main.cpp | 41 ++++++++ .../{spriteimage.qml => spritesequence.qml} | 6 +- 10 files changed, 214 insertions(+), 46 deletions(-) create mode 100644 examples/qtquick/imageelements/content/BorderImageSelector.qml create mode 100644 examples/qtquick/imageelements/imageelements.pro create mode 100644 examples/qtquick/imageelements/main.cpp rename examples/qtquick/imageelements/{spriteimage.qml => spritesequence.qml} (97%) diff --git a/doc/src/examples/examples-groups.qdoc b/doc/src/examples/examples-groups.qdoc index a346794b96..0ecd117128 100644 --- a/doc/src/examples/examples-groups.qdoc +++ b/doc/src/examples/examples-groups.qdoc @@ -39,16 +39,6 @@ This example demonstrates the positioners and some of their animations. */ -/*! - \title QML Examples - Image Elements - \example declarative/imageelements - \brief This is a collection of QML examples - \image qml-imageelements-example.png - - This is a collection of small QML examples relating to image elements. Each example is - a small QML file, usually containing or emphasizing a particular element or - feature. You can run and observe the behavior of each example. -*/ /*! \title QML Examples - Models and Views \example declarative/modelviews diff --git a/examples/qtquick/imageelements/animatedsprite.qml b/examples/qtquick/imageelements/animatedsprite.qml index 3a597bba71..337456f785 100644 --- a/examples/qtquick/imageelements/animatedsprite.qml +++ b/examples/qtquick/imageelements/animatedsprite.qml @@ -40,15 +40,17 @@ import QtQuick 2.0 Item { - width: 400 - height: 400 + width: 320 + height: 480 Rectangle { anchors.fill: parent color: "white" } AnimatedSprite { id: sprite - anchors.fill: parent + width: 170 + height: 170 + anchors.centerIn: parent source: "content/speaker.png" frameCount: 60 frameSync: true diff --git a/examples/qtquick/imageelements/borderimage.qml b/examples/qtquick/imageelements/borderimage.qml index 7e132494db..30120fe60d 100644 --- a/examples/qtquick/imageelements/borderimage.qml +++ b/examples/qtquick/imageelements/borderimage.qml @@ -46,32 +46,48 @@ Rectangle { width: 320 height: 480 + BorderImageSelector { + id: selector + curIdx: 0 + maxIdx: 3 + gridWidth: 240 + flickable: mainFlickable + width: parent.width + height: 64 + } + Flickable { - anchors.fill: parent + id: mainFlickable + width: parent.width + anchors.bottom: parent.bottom + anchors.top: selector.bottom + interactive: false //Animated through selector control + contentX: -120 + Behavior on contentX { NumberAnimation {}} contentWidth: 1030 - contentHeight: 540 + contentHeight: 420 Grid { anchors.centerIn: parent; spacing: 20 MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200 source: "content/colors.png"; margin: 30 } MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200 source: "content/colors.png"; margin: 30 horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat } MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200 source: "content/colors.png"; margin: 30 horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat } MyBorderImage { - minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200 source: "content/colors.png"; margin: 30 horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round } diff --git a/examples/qtquick/imageelements/content/BorderImageSelector.qml b/examples/qtquick/imageelements/content/BorderImageSelector.qml new file mode 100644 index 0000000000..f3a534b3cd --- /dev/null +++ b/examples/qtquick/imageelements/content/BorderImageSelector.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: selector + property int curIdx: 0 + property int maxIdx: 3 + property int gridWidth: 240 + property Flickable flickable + width: parent.width + height: 64 + function advance(steps) { + var nextIdx = curIdx + steps + if (nextIdx < 0 || nextIdx > maxIdx) + return; + flickable.contentX += gridWidth * steps; + curIdx += steps; + } + Image { + source: "../../../shared/images/back.png" + MouseArea{ + anchors.fill: parent + onClicked: selector.advance(-1) + } + anchors.left: parent.left + anchors.leftMargin: 8 + anchors.verticalCenter: parent.verticalCenter + opacity: selector.curIdx == 0 ? 0.2 : 1.0 + Behavior on opacity {NumberAnimation{}} + } + Image { + source: "../../../shared/images/back.png" + mirror: true + MouseArea{ + anchors.fill: parent + onClicked: selector.advance(1) + } + opacity: selector.curIdx == selector.maxIdx ? 0.2 : 1.0 + Behavior on opacity {NumberAnimation{}} + anchors.right: parent.right + anchors.rightMargin: 8 + anchors.verticalCenter: parent.verticalCenter + } + Repeater { + model: [ "Scale", "Repeat", "Scale/Repeat", "Round" ] + delegate: Text { + text: model.modelData + anchors.verticalCenter: parent.verticalCenter + + x: (index - selector.curIdx) * 80 + 140 + Behavior on x { NumberAnimation{} } + + opacity: selector.curIdx == index ? 1.0 : 0.0 + Behavior on opacity { NumberAnimation{} } + } + } +} diff --git a/examples/qtquick/imageelements/content/MyBorderImage.qml b/examples/qtquick/imageelements/content/MyBorderImage.qml index 178e3706db..93880f12bb 100644 --- a/examples/qtquick/imageelements/content/MyBorderImage.qml +++ b/examples/qtquick/imageelements/content/MyBorderImage.qml @@ -53,7 +53,7 @@ Item { property int maxHeight property int margin - width: 240; height: 240 + width: 240; height: 200 BorderImage { id: image; anchors.centerIn: parent diff --git a/examples/qtquick/imageelements/image.qml b/examples/qtquick/imageelements/image.qml index 159558995d..ccefaf6b74 100644 --- a/examples/qtquick/imageelements/image.qml +++ b/examples/qtquick/imageelements/image.qml @@ -44,29 +44,23 @@ import "content" Rectangle { width: 320 height: 480 - Flickable { - anchors.fill: parent - contentWidth: 490 - contentHeight: 285 - - Grid { - property int cellWidth: (width - (spacing * (columns - 1))) / columns - property int cellHeight: (height - (spacing * (rows - 1))) / rows + Grid { + property int cellWidth: (width - (spacing * (columns - 1))) / columns + property int cellHeight: (height - (spacing * (rows - 1))) / rows - anchors.fill: parent - anchors.margins: 30 + anchors.fill: parent + anchors.margins: 30 - columns: 3 - rows: 2 - spacing: 30 + columns: 2 + rows: 3 + spacing: 30 - ImageCell { mode: Image.Stretch; caption: "Stretch" } - ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } - ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } + ImageCell { mode: Image.Stretch; caption: "Stretch" } + ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } + ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } - ImageCell { mode: Image.Tile; caption: "Tile" } - ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } - ImageCell { mode: Image.TileVertically; caption: "TileVertically" } - } + ImageCell { mode: Image.Tile; caption: "Tile" } + ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } + ImageCell { mode: Image.TileVertically; caption: "TileVertically" } } } diff --git a/examples/qtquick/imageelements/imageelements.pro b/examples/qtquick/imageelements/imageelements.pro new file mode 100644 index 0000000000..5300cbd870 --- /dev/null +++ b/examples/qtquick/imageelements/imageelements.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += quick declarative +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/imageelements +qml.files = borderimage.qml content imageelements.qml image.qml shadows.qml simplesprite.qml spriteimage.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/imageelements +INSTALLS += target qml + diff --git a/examples/qtquick/imageelements/imageelements.qml b/examples/qtquick/imageelements/imageelements.qml index f4075ec4c3..bb23ef6979 100644 --- a/examples/qtquick/imageelements/imageelements.qml +++ b/examples/qtquick/imageelements/imageelements.qml @@ -41,9 +41,28 @@ import QtQuick 2.0 import "../../shared" +/*! + \title QML Examples - Image Elements + \example declarative/imageelements + \brief This is a collection of QML examples + \image qml-imageelements-example.png + + This is a collection of small QML examples relating to image elements. + + BorderImage shows off the various scaling modes of the BorderImage item. + + Image shows off the various tiling modes of the Image item. + + Shadows shows how to create a drop shadow for a rectangle using a BorderImage. + + AnimatedSprite shows a simple use for the AnimatedSprite element. + + SpriteSequence demonstrates using the SpriteSequence element to draw an animated and slightly interactive bear. +*/ + Item { height: 480 - width: 640 + width: 320 LauncherList { id: ll anchors.fill: parent @@ -51,8 +70,8 @@ Item { addExample("BorderImage", "An image with scaled borders", Qt.resolvedUrl("borderimage.qml")); addExample("Image", "A showcase of the options available to Image", Qt.resolvedUrl("image.qml")); addExample("Shadows", "Rectangles with a drop-shadow effect", Qt.resolvedUrl("shadows.qml")); - addExample("Simple Sprite", "A simple sprite-based animation", Qt.resolvedUrl("simplesprite.qml")); - addExample("Sprite Image", "A sprite-based animation with complex transitions", Qt.resolvedUrl("spriteimage.qml")); + addExample("AnimatedSprite", "A simple sprite-based animation", Qt.resolvedUrl("animatedsprite.qml")); + addExample("SpriteSequence", "A sprite-based animation with complex transitions", Qt.resolvedUrl("spritesequence.qml")); } } } diff --git a/examples/qtquick/imageelements/main.cpp b/examples/qtquick/imageelements/main.cpp new file mode 100644 index 0000000000..72850f93c1 --- /dev/null +++ b/examples/qtquick/imageelements/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(imageelements) diff --git a/examples/qtquick/imageelements/spriteimage.qml b/examples/qtquick/imageelements/spritesequence.qml similarity index 97% rename from examples/qtquick/imageelements/spriteimage.qml rename to examples/qtquick/imageelements/spritesequence.qml index 372970d1d6..01f34e5c7a 100644 --- a/examples/qtquick/imageelements/spriteimage.qml +++ b/examples/qtquick/imageelements/spritesequence.qml @@ -40,8 +40,8 @@ import QtQuick 2.0 Item { - width: 480 - height: 1280 + width: 320 + height: 480 MouseArea { onClicked: anim.start(); anchors.fill: parent @@ -49,7 +49,7 @@ Item { SequentialAnimation { id: anim ScriptAction { script: image.goalSprite = "falling"; } - NumberAnimation { target: image; property: "y"; to: 1480; duration: 12000; } + NumberAnimation { target: image; property: "y"; to: 480; duration: 12000; } ScriptAction { script: {image.goalSprite = ""; image.jumpTo("still");} } PropertyAction { target: image; property: "y"; value: 0 } } From c4fa565379d82050ec0c114c6cef01474ea506ed Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 29 Feb 2012 14:37:33 +1000 Subject: [PATCH 58/82] Fix crash when transition finishes after view is deleted Change-Id: I5bb525bab735536fa7ae3a7f60bf775cd93cf3c1 Reviewed-by: Martin Jones --- src/quick/items/qquickitemview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 600b72dfcb..5d58cbf4f5 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1318,6 +1318,8 @@ QQuickItemViewPrivate::QQuickItemViewPrivate() QQuickItemViewPrivate::~QQuickItemViewPrivate() { + if (transitioner) + transitioner->setChangeListener(0); delete transitioner; } From 318f15e3d379f41c2fd74d1b801586e572f3affd Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 29 Feb 2012 15:47:03 +1000 Subject: [PATCH 59/82] Check item before notifying transition has finished Fixes crash when using SmoothedAnimation with view transitions Change-Id: Ib9a201e417c34d64f8144a616e75cae8b67568e2 Reviewed-by: Andrew den Exter --- src/quick/items/qquickitemviewtransition.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 0f092b76c3..ea81e14871 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -163,8 +163,6 @@ void QQuickItemViewTransitionJob::finished() { QDeclarativeTransitionManager::finished(); - if (m_item) - m_item->finishedTransition(); if (m_transitioner) m_transitioner->finishedTransition(m_item); @@ -245,8 +243,11 @@ void QQuickItemViewTransitioner::transitionNextReposition(QQuickViewItem *item, void QQuickItemViewTransitioner::finishedTransition(QQuickViewItem *item) { - if (changeListener) - changeListener->viewItemTransitionFinished(item); + if (item) { + item->finishedTransition(); + if (changeListener) + changeListener->viewItemTransitionFinished(item); + } } From 6b3b47539967722ee18d072c004e96ba1acb3234 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 28 Feb 2012 17:29:40 +1000 Subject: [PATCH 60/82] Update item position in parent change atomically. Changing x and y individually generates two geometry changed events, the first of which has an invalid position as the x coordinate is relative to the new parent and the y relative to the old parent. This in turn causes the Drag item to send move events with incorrect positions. Task-number: QTBUG-24534 Change-Id: If2636a968acc0fffce21d1a7e51510426ace38a0 Reviewed-by: Michael Brasser --- src/quick/items/qquickstateoperations.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index c4dd0fd146..ca2a94716a 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -132,8 +132,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s if (ok) { //qDebug() << x << y << rotation << scale; - target->setX(x); - target->setY(y); + target->setPos(QPointF(x, y)); target->setRotation(target->rotation() + rotation); target->setScale(target->scale() * scale); } From ae4c3c14e2535fbbf439c2baeb4333bbc21c2a96 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 29 Feb 2012 11:37:42 +1000 Subject: [PATCH 61/82] Allow styled text to be elided. Task-number: QTBUG-24521 Change-Id: Idd451d0a8a238a60691386726e34054c0368b658 Reviewed-by: Yann Bodson --- src/quick/items/qquicktext.cpp | 72 ++- src/quick/items/qquicktext_p_p.h | 2 + .../qtquick2/qquicktext/data/fontSizeMode.qml | 2 - .../qtquick2/qquicktext/tst_qquicktext.cpp | 521 +++++++++--------- 4 files changed, 314 insertions(+), 283 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index f0ce26ed62..6d1cc0d8d2 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -612,6 +612,22 @@ void QQuickTextPrivate::setupCustomLineGeometry(QTextLine &line, qreal &height, #endif } +void QQuickTextPrivate::elideFormats( + const int start, const int length, int offset, QList *elidedFormats) +{ + const int end = start + length; + QList formats = layout.additionalFormats(); + for (int i = 0; i < formats.count(); ++i) { + QTextLayout::FormatRange format = formats.at(i); + const int formatLength = qMin(format.start + format.length, end) - qMax(format.start, start); + if (formatLength > 0) { + format.start = qMax(offset, format.start - start + offset); + format.length = formatLength; + elidedFormats->append(format); + } + } +} + QString QQuickTextPrivate::elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine) const { if (nextLine) { @@ -624,12 +640,15 @@ QString QQuickTextPrivate::elidedText(qreal lineWidth, const QTextLine &line, QT line.textLength() + nextLine->textLength()); } else { QString elideText = layout.text().mid(line.textStart(), line.textLength()); - elideText[elideText.length() - 1] = elideChar; - // Appending the elide character may push the line over the maximum width - // in which case the elided text will need to be elided. - QFontMetricsF metrics(layout.font()); - if (metrics.width(elideChar) + line.naturalTextWidth() >= lineWidth) - elideText = metrics.elidedText(elideText, Qt::TextElideMode(elideMode), lineWidth); + if (!styledText) { + // QFontMetrics won't help eliding styled text. + elideText[elideText.length() - 1] = elideChar; + // Appending the elide character may push the line over the maximum width + // in which case the elided text will need to be elided. + QFontMetricsF metrics(layout.font()); + if (metrics.width(elideChar) + line.naturalTextWidth() >= lineWidth) + elideText = metrics.elidedText(elideText, Qt::TextElideMode(elideMode), lineWidth); + } return elideText; } } @@ -690,9 +709,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) const bool customLayout = isLineLaidOutConnected(); const bool wasTruncated = truncated; - const bool singlelineElide = !styledText && elideMode != QQuickText::ElideNone && q->widthValid(); - const bool multilineElide = !styledText - && elideMode == QQuickText::ElideRight + const bool singlelineElide = elideMode != QQuickText::ElideNone && q->widthValid(); + const bool multilineElide = elideMode == QQuickText::ElideRight && q->widthValid() && (q->heightValid() || maximumLineCountValid); const bool canWrap = wrapMode != QQuickText::NoWrap && q->widthValid(); @@ -719,6 +737,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) qreal height = 0; QString elideText; bool once = true; + int elideStart = 0; + int elideEnd = 0; *naturalWidth = 0; @@ -773,6 +793,9 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) elideText = layoutText.at(line.textStart() - 1) != QChar::LineSeparator ? elidedText(lineWidth, previousLine, &line) : elidedText(lineWidth, previousLine); + elideStart = previousLine.textStart(); + // elideEnd isn't required for right eliding. + // The previous line is the last one visible so move the current one off somewhere // out of the way and back everything up one line. line.setLineWidth(0); @@ -800,6 +823,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) 0, line.textStart(), line.textLength()); + elideStart = line.textStart(); + elideEnd = elideStart + line.textLength(); } else { br = br.united(line.naturalTextRect()); } @@ -825,6 +850,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) elideText = wrappedLine ? elidedText(lineWidth, line, &nextLine) : elidedText(lineWidth, line); + elideStart = line.textStart(); + // elideEnd isn't required for right eliding. } else { br = br.united(line.naturalTextRect()); } @@ -917,6 +944,33 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth) if (elide) { if (!elideLayout) elideLayout = new QTextLayout; + if (styledText) { + QList formats; + switch (elideMode) { + case QQuickText::ElideRight: + elideFormats(elideStart, elideText.length() - 1, 0, &formats); + break; + case QQuickText::ElideLeft: + elideFormats(elideEnd - elideText.length() + 1, elideText.length() - 1, 1, &formats); + break; + case QQuickText::ElideMiddle: { + const int index = elideText.indexOf(elideChar); + if (index != -1) { + elideFormats(elideStart, index, 0, &formats); + elideFormats( + elideEnd - elideText.length() + index + 1, + elideText.length() - index - 1, + index + 1, + &formats); + } + break; + } + default: + break; + } + elideLayout->setAdditionalFormats(formats); + } + elideLayout->setFont(layout.font()); elideLayout->setTextOption(layout.textOption()); elideLayout->setText(elideText); diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index e61eea90ae..3be62541ea 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -82,7 +82,9 @@ class Q_AUTOTEST_EXPORT QQuickTextPrivate : public QQuickImplicitSizeItemPrivate void mirrorChange(); bool isLineLaidOutConnected(); void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); + QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; + void elideFormats(int start, int length, int offset, QList *elidedFormats); QRectF layedOutTextRect; diff --git a/tests/auto/qtquick2/qquicktext/data/fontSizeMode.qml b/tests/auto/qtquick2/qquicktext/data/fontSizeMode.qml index 20f7535365..84f7ce8d50 100644 --- a/tests/auto/qtquick2/qquicktext/data/fontSizeMode.qml +++ b/tests/auto/qtquick2/qquicktext/data/fontSizeMode.qml @@ -19,6 +19,4 @@ Item { font.pixelSize: 30 font.family: "Helvetica" } - - TextInput { focus: true; objectName: "input" } } diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp index 2be2dcd43d..3fd05dbcb2 100644 --- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp @@ -58,6 +58,8 @@ DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) +Q_DECLARE_METATYPE(QQuickText::TextFormat) + class tst_qquicktext : public QDeclarativeDataTest { Q_OBJECT @@ -69,6 +71,7 @@ private slots: void width(); void wrap(); void elide(); + void multilineElide_data(); void multilineElide(); void textFormat(); @@ -440,10 +443,12 @@ void tst_qquicktext::elide() QCOMPARE(textObject->elideMode(), m); QCOMPARE(textObject->width(), 100.); + if (m != QQuickText::ElideNone && !standard.at(i).contains('\n')) + QVERIFY(textObject->contentWidth() <= textObject->width()); + delete textObject; } - // richtext - does nothing for (int i = 0; i < richText.size(); i++) { QString componentStr = "import QtQuick 2.0\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; @@ -454,17 +459,29 @@ void tst_qquicktext::elide() QCOMPARE(textObject->elideMode(), m); QCOMPARE(textObject->width(), 100.); + if (m != QQuickText::ElideNone && standard.at(i).contains("
          ")) + QVERIFY(textObject->contentWidth() <= textObject->width()); + delete textObject; } } } +void tst_qquicktext::multilineElide_data() +{ + QTest::addColumn("format"); + QTest::newRow("plain") << QQuickText::PlainText; + QTest::newRow("styled") << QQuickText::StyledText; +} + void tst_qquicktext::multilineElide() { + QFETCH(QQuickText::TextFormat, format); QQuickView *canvas = createView(testFile("multilineelide.qml")); QQuickText *myText = qobject_cast(canvas->rootObject()); QVERIFY(myText != 0); + myText->setTextFormat(format); QCOMPARE(myText->lineCount(), 3); QCOMPARE(myText->truncated(), true); @@ -1843,17 +1860,15 @@ void tst_qquicktext::imgTagsError() void tst_qquicktext::fontSizeMode_data() { QTest::addColumn("text"); - QTest::addColumn("canElide"); - QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << true; - QTest::newRow("richtext") << "The quick red fox jumped over the lazy brown dog" << false; + QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog"; + QTest::newRow("styled") << "The quick red fox jumped over the lazy brown dog"; } void tst_qquicktext::fontSizeMode() { QFETCH(QString, text); - QFETCH(bool, canElide); - QQuickView *canvas = createView(testFile("fontSizeMode.qml")); + QScopedPointer canvas(createView(testFile("fontSizeMode.qml"))); canvas->show(); QQuickText *myText = canvas->rootObject()->findChild("myText"); @@ -1881,29 +1896,27 @@ void tst_qquicktext::fontSizeMode() QVERIFY(horizontalFitWidth <= myText->width() + 2); // rounding QVERIFY(horizontalFitHeight <= myText->height() + 2); - if (canElide) { - // Elide won't affect the size with HorizontalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Elide won't affect the size with HorizontalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -1913,29 +1926,27 @@ void tst_qquicktext::fontSizeMode() QVERIFY(verticalFitHeight <= myText->height() + 2); QVERIFY(verticalFitHeight > originalHeight); - if (canElide) { - // Elide won't affect the height of a single line with VerticalFit but will crop the width. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Elide won't affect the height of a single line with VerticalFit but will crop the width. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -1943,29 +1954,27 @@ void tst_qquicktext::fontSizeMode() QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::FixedSize); myText->setWrapMode(QQuickText::Wrap); @@ -1985,17 +1994,15 @@ void tst_qquicktext::fontSizeMode() QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); - if (canElide) { - // Elide won't affect the size with HorizontalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); + // Elide won't affect the size with HorizontalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2006,17 +2013,15 @@ void tst_qquicktext::fontSizeMode() QVERIFY(verticalFitHeight <= myText->height() + 2); QVERIFY(verticalFitHeight < originalHeight); - if (canElide) { - // Elide won't affect the height or width of a wrapped text with VerticalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the height or width of a wrapped text with VerticalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2024,17 +2029,15 @@ void tst_qquicktext::fontSizeMode() QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::FixedSize); myText->setMaximumLineCount(2); @@ -2051,17 +2054,15 @@ void tst_qquicktext::fontSizeMode() QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); - if (canElide) { - // Elide won't affect the size with HorizontalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); + // Elide won't affect the size with HorizontalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2072,17 +2073,15 @@ void tst_qquicktext::fontSizeMode() QVERIFY(verticalFitHeight <= myText->height() + 2); QVERIFY(verticalFitHeight < originalHeight); - if (canElide) { - // Elide won't affect the height or width of a wrapped text with VerticalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the height or width of a wrapped text with VerticalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2090,33 +2089,29 @@ void tst_qquicktext::fontSizeMode() QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); } void tst_qquicktext::fontSizeModeMultiline_data() { QTest::addColumn("text"); - QTest::addColumn("canElide"); - QTest::newRow("plain") << "The quick red fox jumped\n over the lazy brown dog" << true; - QTest::newRow("richtext") << "The quick red fox jumped
          over the lazy brown dog
          " << false; + QTest::newRow("plain") << "The quick red fox jumped\n over the lazy brown dog"; + QTest::newRow("styledtext") << "The quick red fox jumped
          over the lazy brown dog
          "; } void tst_qquicktext::fontSizeModeMultiline() { QFETCH(QString, text); - QFETCH(bool, canElide); - QQuickView *canvas = createView(testFile("fontSizeMode.qml")); + QScopedPointer canvas(createView(testFile("fontSizeMode.qml"))); canvas->show(); QQuickText *myText = canvas->rootObject()->findChild("myText"); @@ -2146,31 +2141,29 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(horizontalFitWidth <= myText->width() + 2); // rounding QVERIFY(horizontalFitHeight > myText->height()); - if (canElide) { - // Right eliding will remove the last line - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QCOMPARE(myText->lineCount(), 1); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QVERIFY(myText->contentHeight() <= myText->height() + 2); - - // Left or middle eliding wont have any effect. - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), horizontalFitWidth); - QCOMPARE(myText->contentHeight(), horizontalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Right eliding will remove the last line + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QCOMPARE(myText->lineCount(), 1); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QVERIFY(myText->contentHeight() <= myText->height() + 2); + + // Left or middle eliding wont have any effect. + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), horizontalFitWidth); + QCOMPARE(myText->contentHeight(), horizontalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2180,30 +2173,28 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(verticalFitWidth <= myText->width() + 2); QVERIFY(verticalFitHeight <= myText->height() + 2); - if (canElide) { - // Elide will have no effect. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Elide will have no effect. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2211,29 +2202,27 @@ void tst_qquicktext::fontSizeModeMultiline() QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideLeft); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideMiddle); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); - - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideLeft); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideMiddle); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); + + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::FixedSize); myText->setWrapMode(QQuickText::Wrap); @@ -2253,17 +2242,15 @@ void tst_qquicktext::fontSizeModeMultiline() QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); - if (canElide) { - // Text will be elided vertically with HorizontalFit - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QVERIFY(myText->contentHeight() <= myText->height() + 2); + // Text will be elided vertically with HorizontalFit + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QVERIFY(myText->contentHeight() <= myText->height() + 2); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2274,17 +2261,15 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(verticalFitHeight <= myText->height() + 2); QVERIFY(verticalFitHeight < originalHeight); - if (canElide) { - // Elide won't affect the height or width of a wrapped text with VerticalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the height or width of a wrapped text with VerticalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2292,17 +2277,15 @@ void tst_qquicktext::fontSizeModeMultiline() QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::FixedSize); myText->setMaximumLineCount(2); @@ -2319,17 +2302,15 @@ void tst_qquicktext::fontSizeModeMultiline() QCOMPARE(myText->contentWidth(), horizontalFitWidth); QCOMPARE(myText->contentHeight(), horizontalFitHeight); - if (canElide) { - // Elide won't affect the size with HorizontalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(myText->truncated()); - QVERIFY(myText->contentWidth() <= myText->width() + 2); - QVERIFY(myText->contentHeight() <= myText->height() + 2); + // Elide won't affect the size with HorizontalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(myText->truncated()); + QVERIFY(myText->contentWidth() <= myText->width() + 2); + QVERIFY(myText->contentHeight() <= myText->height() + 2); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::VerticalFit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2340,17 +2321,15 @@ void tst_qquicktext::fontSizeModeMultiline() QVERIFY(verticalFitHeight <= myText->height() + 2); QVERIFY(verticalFitHeight < originalHeight); - if (canElide) { - // Elide won't affect the height or width of a wrapped text with VerticalFit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the height or width of a wrapped text with VerticalFit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); myText->setFontSizeMode(QQuickText::Fit); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -2358,17 +2337,15 @@ void tst_qquicktext::fontSizeModeMultiline() QCOMPARE(myText->contentWidth(), verticalFitWidth); QCOMPARE(myText->contentHeight(), verticalFitHeight); - if (canElide) { - // Elide won't affect the size with Fit. - myText->setElideMode(QQuickText::ElideRight); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - QVERIFY(!myText->truncated()); - QCOMPARE(myText->contentWidth(), verticalFitWidth); - QCOMPARE(myText->contentHeight(), verticalFitHeight); + // Elide won't affect the size with Fit. + myText->setElideMode(QQuickText::ElideRight); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->contentWidth(), verticalFitWidth); + QCOMPARE(myText->contentHeight(), verticalFitHeight); - myText->setElideMode(QQuickText::ElideNone); - QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); - } + myText->setElideMode(QQuickText::ElideNone); + QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); } void tst_qquicktext::multilengthStrings_data() From 22a5c42b83c5bff8d3b47b3b7f0d096fa212d0a6 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Thu, 1 Mar 2012 08:57:32 +1000 Subject: [PATCH 62/82] Fix material compare for distance field glyph nodes. The compare function did not take into account the GL texture ID when comparing materials. This could result in a renderer merging glyph nodes into a single batch incorrectly. Change-Id: Ib62c43f93fb1bbbc231197323dced4254ffa12aa Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index e525d2a458..f9c8349c2c 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -233,7 +233,11 @@ int QSGDistanceFieldTextMaterial::compare(const QSGMaterial *o) const } QRgb c1 = m_color.rgba(); QRgb c2 = other->m_color.rgba(); - return int(c2 < c1) - int(c1 < c2); + if (c1 != c2) + return int(c2 < c1) - int(c1 < c2); + int t0 = m_texture ? m_texture->textureId : -1; + int t1 = other->m_texture ? other->m_texture->textureId : -1; + return t0 - t1; } From 5422a86b39490c30ca86a272a111c3d7da15fb3f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Mar 2012 10:40:22 +1000 Subject: [PATCH 63/82] No double click event in QML_TRANSLATE_TOUCH_TO_MOUSE mode Since double clicks are delivered before the click, the initial grab may not have been established. Change-Id: Id9282489f0551d421da800294e88ead0915482cc Reviewed-by: Michael Brasser --- src/quick/items/qquickcanvas.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index e6a3e87401..670baa8df7 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -378,10 +378,17 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonDblClick, p); me.setTimestamp(event->timestamp()); me.setAccepted(false); - deliverMouseEvent(&me); - if (me.isAccepted()) { - touchMouseId = p.id(); - event->setAccepted(true); + if (!mouseGrabberItem) { + if (deliverInitialMousePressEvent(rootItem, &me)) { + touchMouseId = p.id(); + event->setAccepted(true); + } + } else { + deliverMouseEvent(&me); + if (me.isAccepted()) { + touchMouseId = p.id(); + event->setAccepted(true); + } } } QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonPress, p); @@ -391,8 +398,9 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) if (me.isAccepted()) { touchMouseId = p.id(); event->setAccepted(true); - break; } + if (touchMouseId != -1) + break; } else if (p.id() == touchMouseId) { if (p.state() & Qt::TouchPointMoved) { QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseMove, p); From c0da7869001a52668f4ffaa851e05dd0ca6e6d67 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 1 Mar 2012 11:24:57 +0100 Subject: [PATCH 64/82] Avoid unnecessary updates when using in-process cache Whenever an in-process cache is updated, it will emit itemsAvailable() signals to all listening glyph caches. This will in turn cause each of the glyph caches to update and each of the glyph nodes to be preprocessed (the entire scene graph will be updated.) This happens even if the changes to the in-process cache are requested by an external client, due to a cross-process cache sharing mechanism. However, itemsAvailable() signals are only interesting if the items were requested by the in-process cache. We therefore add a mechanism now to check if the glyphs were actually requested by the cache before updating anything. Change-Id: I529f94b3928c2a5e06fec354014fa11d21671057 Reviewed-by: Jiang Jiang --- .../qsgshareddistancefieldglyphcache.cpp | 39 ++++++++++++++++--- .../qsgshareddistancefieldglyphcache_p.h | 2 + 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp index e762898602..951ee210c5 100644 --- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp @@ -90,7 +90,7 @@ QSGSharedDistanceFieldGlyphCache::QSGSharedDistanceFieldGlyphCache(const QByteAr this, SLOT(reportItemsAvailable(QByteArray,void*,QSize,QVector,QVector)), Qt::DirectConnection); connect(sharedGraphicsCache, SIGNAL(itemsUpdated(QByteArray,void*,QSize,QVector,QVector)), - this, SLOT(reportItemsAvailable(QByteArray,void*,QSize,QVector,QVector)), + this, SLOT(reportItemsUpdated(QByteArray,void*,QSize,QVector,QVector)), Qt::DirectConnection); connect(sharedGraphicsCache, SIGNAL(itemsInvalidated(QByteArray,QVector)), this, SLOT(reportItemsInvalidated(QByteArray,QVector)), @@ -542,9 +542,38 @@ void QSGSharedDistanceFieldGlyphCache::processPendingGlyphs() } void QSGSharedDistanceFieldGlyphCache::reportItemsAvailable(const QByteArray &cacheId, - void *bufferId, const QSize &bufferSize, - const QVector &itemIds, - const QVector &positions) + void *bufferId, + const QSize &bufferSize, + const QVector &itemIds, + const QVector &positions) +{ + bool requestedItemsInList = false; + { + QMutexLocker locker(&m_pendingGlyphsMutex); + if (m_cacheId != cacheId) + return; + +#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) + qDebug("QSGSharedDistanceFieldGlyphCache::reportItemsAvailable() called for %s (%d glyphs, bufferSize: %dx%d)", + cacheId.constData(), itemIds.size(), bufferSize.width(), bufferSize.height()); +#endif + + for (int i=0; i &itemIds, + const QVector &positions) { { QMutexLocker locker(&m_pendingGlyphsMutex); @@ -554,7 +583,7 @@ void QSGSharedDistanceFieldGlyphCache::reportItemsAvailable(const QByteArray &ca Q_ASSERT(itemIds.size() == positions.size()); #if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG) - qDebug("QSGSharedDistanceFieldGlyphCache::reportItemsAvailable() called for %s (%d glyphs, bufferSize: %dx%d)", + qDebug("QSGSharedDistanceFieldGlyphCache::reportItemsUpdated() called for %s (%d glyphs, bufferSize: %dx%d)", cacheId.constData(), itemIds.size(), bufferSize.width(), bufferSize.height()); #endif diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h index cadf4bc55b..8250b9706e 100644 --- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h @@ -78,6 +78,8 @@ private Q_SLOTS: void reportItemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, const QVector &itemIds, const QVector &positions); + void reportItemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, + const QVector &itemIds, const QVector &positions); void reportItemsInvalidated(const QByteArray &cacheId, const QVector &itemIds); private: From 6c5955e58f885cf5b4597b8fb0a059d204e2a5e1 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 1 Mar 2012 12:34:48 +0100 Subject: [PATCH 65/82] Set bind options before uploading to give hints to the driver This can prevent allocation of unused mipmap levels on some drivers. Change-Id: I2d730c04e120872367078b17a344c01b4d4aa87a Reviewed-by: Kim M. Kalland --- src/quick/scenegraph/util/qsgtexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 7ccedc4c48..4dff1b2a3d 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -496,6 +496,8 @@ void QSGPlainTexture::bind() ? m_image : m_image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + updateBindOptions(m_dirty_bind_options); + #ifdef QT_OPENGL_ES swizzleBGRAToRGBA(&tmp); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmp.constBits()); @@ -512,7 +514,6 @@ void QSGPlainTexture::bind() m_texture_size = QSize(w, h); m_texture_rect = QRectF(0, 0, 1, 1); - updateBindOptions(m_dirty_bind_options); m_dirty_bind_options = false; } From 8af34203ec302c5ab630d2fba700a6f60d9c8096 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 29 Feb 2012 13:28:51 +0100 Subject: [PATCH 66/82] Profiler: Remove unused method Change-Id: I74ba20b495760034bc714d92bcf016feddf87c2c Reviewed-by: Christiaan Janssen --- src/declarative/debugger/qdeclarativeprofilerservice.cpp | 5 ----- src/declarative/debugger/qdeclarativeprofilerservice_p.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/declarative/debugger/qdeclarativeprofilerservice.cpp b/src/declarative/debugger/qdeclarativeprofilerservice.cpp index 17ee3e5836..074355fe97 100644 --- a/src/declarative/debugger/qdeclarativeprofilerservice.cpp +++ b/src/declarative/debugger/qdeclarativeprofilerservice.cpp @@ -144,11 +144,6 @@ void QDeclarativeProfilerService::rangeData(RangeType t, const QString &data) profilerInstance()->rangeDataImpl(t, data); } -void QDeclarativeProfilerService::rangeData(RangeType t, const QUrl &data) -{ - profilerInstance()->rangeDataImpl(t, data); -} - void QDeclarativeProfilerService::rangeLocation(RangeType t, const QString &fileName, int line, int column) { profilerInstance()->rangeLocationImpl(t, fileName, line, column); diff --git a/src/declarative/debugger/qdeclarativeprofilerservice_p.h b/src/declarative/debugger/qdeclarativeprofilerservice_p.h index d29690b6d6..d2f263cca6 100644 --- a/src/declarative/debugger/qdeclarativeprofilerservice_p.h +++ b/src/declarative/debugger/qdeclarativeprofilerservice_p.h @@ -134,7 +134,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeProfilerService : public QDeclarativeDebu static void addEvent(EventType); static void startRange(RangeType); static void rangeData(RangeType, const QString &); - static void rangeData(RangeType, const QUrl &); static void rangeLocation(RangeType, const QString &, int, int); static void rangeLocation(RangeType, const QUrl &, int, int); static void endRange(RangeType); From df014e5f3ea16dfaecb6852fbc2b2ab8351afafe Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 29 Feb 2012 13:29:06 +0100 Subject: [PATCH 67/82] Profiler: Avoid QString->QUrl->QString conversion Change-Id: Ib39b94bf6c76638dce96d6cc20a4a8f307e37878 Reviewed-by: Christiaan Janssen --- src/declarative/qml/qdeclarativetypeloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index 0524d5d661..a07e4fb04b 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -1583,7 +1583,7 @@ void QDeclarativeTypeData::compile() m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); m_compiledData->url = finalUrl(); m_compiledData->name = finalUrlString(); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Compiling, QUrl(m_compiledData->name),1,1); + QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Compiling, m_compiledData->name,1,1); QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Compiling, m_compiledData->name); QDeclarativeCompiler compiler(&scriptParser._pool); From 07aea54a90c9bee45420893be1be9761a3a488d9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 2 Mar 2012 11:53:29 +1000 Subject: [PATCH 68/82] Pin to a working qtbase SHA1 A bug with qmake was introduced which is impeding the compilation of modules we depend on. Use an older qtbase and qmake until this is fixed. Task-number: QTBUG-24608 Change-Id: I7f6f1f383d4c9339e5f4c699cb8900a3b1c776e3 Reviewed-by: Toby Tomkins --- sync.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.profile b/sync.profile index efde01d952..0265d1dbe9 100644 --- a/sync.profile +++ b/sync.profile @@ -31,7 +31,7 @@ # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) # %dependencies = ( - "qtbase" => "refs/heads/master", + "qtbase" => "95c5be8bc1c8f9ff8e7f95e52a8abd3cd7976ba1", "qtxmlpatterns" => "refs/heads/master", "qtjsbackend" => "refs/heads/master", ); From a7c56b79d2f682b1e82b6b92d11fc942148d8c3b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 1 Mar 2012 10:34:01 +1000 Subject: [PATCH 69/82] More verbose compiler stats. Report shared and unshared v8 bindings separately. Change-Id: Iaa198dcc93035a778b13d7137742a7b308aa782f Reviewed-by: Chris Adams --- src/declarative/qml/qdeclarativecompiler.cpp | 28 +++++++++++++++++--- src/declarative/qml/qdeclarativecompiler_p.h | 1 + 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b7b882cd97..aaa1acaaa3 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -3613,12 +3613,15 @@ bool QDeclarativeCompiler::completeComponentBuild() binding.property->type != qMetaTypeId()) { binding.dataType = BindingReference::V8; sharedBindings.append(b); + + if (componentStats) + componentStats->componentStat.sharedBindings.append(b->value->location); } else { binding.dataType = BindingReference::QtScript; - } - if (componentStats) - componentStats->componentStat.scriptBindings.append(b->value->location); + if (componentStats) + componentStats->componentStat.scriptBindings.append(b->value->location); + } } if (!sharedBindings.isEmpty()) { @@ -3699,6 +3702,25 @@ void QDeclarativeCompiler::dumpStats() qWarning().nospace() << output.constData(); } + qWarning().nospace() << " Shared Bindings: " << stat.sharedBindings.count(); + { + QByteArray output; + for (int ii = 0; ii < stat.sharedBindings.count(); ++ii) { + if (0 == (ii % 10)) { + if (ii) output.append("\n"); + output.append(" "); + } + + output.append("("); + output.append(QByteArray::number(stat.sharedBindings.at(ii).start.line)); + output.append(":"); + output.append(QByteArray::number(stat.sharedBindings.at(ii).start.column)); + output.append(") "); + } + if (!output.isEmpty()) + qWarning().nospace() << output.constData(); + } + qWarning().nospace() << " QScript Bindings: " << stat.scriptBindings.count(); { QByteArray output; diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 637cd80569..3ef4668b79 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -450,6 +450,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeCompiler int ids; QList scriptBindings; + QList sharedBindings; QList optimizedBindings; int objects; }; From 61ab01252d928576bf9ef1d8c6cc421e1a825dde Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 29 Feb 2012 13:54:16 +1000 Subject: [PATCH 70/82] Reenable value type binding auto removal tests. Change-Id: I349017bf24f9f2f18024d1257eeaebb348cc8503 Reviewed-by: Chris Adams --- .../qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index e701efa2a4..15001f70c8 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -951,7 +951,6 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() delete object; } - /* { QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml")); MyTypeObject *object = qobject_cast(component.create()); @@ -976,6 +975,8 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() { QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml")); + QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QRect"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); MyTypeObject *object = qobject_cast(component.create()); QVERIFY(object != 0); @@ -993,7 +994,6 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() delete object; } -*/ } // Test that property value sources assign to value types From 8bcedb39a738e417fb9c159dc2eb003873d60271 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Mar 2012 19:04:29 +1000 Subject: [PATCH 71/82] V4 handles a maximum of 32 temporary registers. Drop back to V8 if there are more than 32 being used. Change-Id: I11f6e84746d897cd9b6789a5e9e4d2848909de00 Reviewed-by: Roberto Raggi --- src/declarative/qml/v4/qv4compiler.cpp | 5 +++-- src/declarative/qml/v4/qv4compiler_p_p.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/v4/qv4compiler.cpp b/src/declarative/qml/v4/qv4compiler.cpp index 42e56d12c9..29023ae66e 100644 --- a/src/declarative/qml/v4/qv4compiler.cpp +++ b/src/declarative/qml/v4/qv4compiler.cpp @@ -62,7 +62,7 @@ static bool qmlEnableV4 = true; using namespace QDeclarativeJS; QV4CompilerPrivate::QV4CompilerPrivate() -: _function(0) , _block(0) , _discarded(false) + : _function(0) , _block(0) , _discarded(false), registerCount(0) { } @@ -74,6 +74,7 @@ void QV4CompilerPrivate::trace(int line, int column) bytecode.clear(); this->currentReg = _function->tempCount; + this->registerCount = qMax(this->registerCount, this->currentReg); foreach (IR::BasicBlock *bb, _function->basicBlocks) { if (! bb->isTerminated() && (bb->index + 1) < _function->basicBlocks.size()) @@ -1118,7 +1119,7 @@ bool QV4CompilerPrivate::compile(QDeclarativeJS::AST::Node *node) qerr << endl; } - if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF) + if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF || registerCount > 31) return false; return true; diff --git a/src/declarative/qml/v4/qv4compiler_p_p.h b/src/declarative/qml/v4/qv4compiler_p_p.h index 85a7c36f87..c43140663e 100644 --- a/src/declarative/qml/v4/qv4compiler_p_p.h +++ b/src/declarative/qml/v4/qv4compiler_p_p.h @@ -231,6 +231,7 @@ class QV4CompilerPrivate: protected QDeclarativeJS::IR::ExprVisitor, void discard() { _discarded = true; } bool _discarded; quint8 currentReg; + quint8 registerCount; bool usedSubscriptionIdsChanged; quint32 currentBlockMask; From e8ee323b9f7889ec1423cece7a3ab6f116a6ff14 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 2 Mar 2012 11:54:58 +1000 Subject: [PATCH 72/82] Correct QDeclarativeInspectorInterface iid Change-Id: I874c501dc1839712d2da663f13e437e3c7a0e4fe Reviewed-by: Matthew Vogt --- src/declarative/debugger/qdeclarativeinspectorinterface_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h index adfd94333d..77f208ce5b 100644 --- a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h +++ b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h @@ -74,7 +74,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeInspectorInterface virtual void clientMessage(const QByteArray &message) = 0; }; -#define QDeclarativeInspectorInterface_iid "org.qt-project.Qt." +#define QDeclarativeInspectorInterface_iid "org.qt-project.Qt.QDeclarativeInspectorInterface" Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, QDeclarativeInspectorInterface_iid) From 3b01983d4f21cbd53745bb9132b9b2fffb019077 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 1 Mar 2012 17:37:11 +1000 Subject: [PATCH 73/82] Fix if transitioner is deleted before transition job finishes Don't let TransitionJob call finishedTransition() on a deleted transitioner. Also don't use target transitions that are not enabled. Change-Id: I94d58e8c7b072f7f3d76533956cac2d63ac33ff6 Reviewed-by: Alan Alpert --- src/quick/items/qquickitemviewtransition.cpp | 163 ++++++++++++------- src/quick/items/qquickitemviewtransition_p.h | 10 +- 2 files changed, 111 insertions(+), 62 deletions(-) diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index ea81e14871..9235321418 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -45,14 +45,17 @@ QT_BEGIN_NAMESPACE +static QList qquickitemviewtransition_emptyIndexes = QList(); +static QList qquickitemviewtransition_emptyTargets = QList(); + class QQuickItemViewTransitionJob : public QDeclarativeTransitionManager { public: - QQuickItemViewTransitionJob(QQuickItemViewTransitioner *transitioner); + QQuickItemViewTransitionJob(); ~QQuickItemViewTransitionJob(); - void startTransition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem); + void startTransition(QQuickViewItem *item, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem); QQuickItemViewTransitioner *m_transitioner; QQuickViewItem *m_item; @@ -65,59 +68,41 @@ class QQuickItemViewTransitionJob : public QDeclarativeTransitionManager }; -QQuickItemViewTransitionJob::QQuickItemViewTransitionJob(QQuickItemViewTransitioner *transitioner) - : m_transitioner(transitioner) - , m_item(0), m_type(QQuickItemViewTransitioner::NoTransition), m_isTarget(false) +QQuickItemViewTransitionJob::QQuickItemViewTransitionJob() + : m_transitioner(0) + , m_item(0) + , m_type(QQuickItemViewTransitioner::NoTransition) + , m_isTarget(false) { } QQuickItemViewTransitionJob::~QQuickItemViewTransitionJob() { + if (m_transitioner) + m_transitioner->runningJobs.remove(this); } -void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem) +void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem) { + if (type == QQuickItemViewTransitioner::NoTransition) + return; if (!item) { qWarning("startTransition(): invalid item"); return; } - - QDeclarativeTransition *trans = 0; - switch (type) { - case QQuickItemViewTransitioner::NoTransition: - break; - case QQuickItemViewTransitioner::PopulateTransition: - trans = m_transitioner->populateTransition; - break; - case QQuickItemViewTransitioner::AddTransition: - if (isTargetItem) - trans = m_transitioner->addTransition; - else - trans = (m_transitioner->addDisplacedTransition && m_transitioner->addDisplacedTransition->enabled()) ? - m_transitioner->addDisplacedTransition : m_transitioner->displacedTransition; - break; - case QQuickItemViewTransitioner::MoveTransition: - if (isTargetItem) - trans = m_transitioner->moveTransition; - else - trans = (m_transitioner->moveDisplacedTransition && m_transitioner->moveDisplacedTransition->enabled()) ? - m_transitioner->moveDisplacedTransition : m_transitioner->displacedTransition; - break; - case QQuickItemViewTransitioner::RemoveTransition: - if (isTargetItem) - trans = m_transitioner->removeTransition; - else - trans = (m_transitioner->removeDisplacedTransition && m_transitioner->removeDisplacedTransition->enabled()) ? - m_transitioner->removeDisplacedTransition : m_transitioner->displacedTransition; - break; + if (!transitioner) { + qWarning("startTransition(): invalid transitioner"); + return; } + QDeclarativeTransition *trans = transitioner->transitionObject(type, isTargetItem); if (!trans) { qWarning("QQuickItemView: invalid view transition!"); return; } m_item = item; + m_transitioner = transitioner; m_toPos = to; m_type = type; m_isTarget = isTargetItem; @@ -128,23 +113,8 @@ void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickIt attached->m_index = item->index; attached->m_item = item->item; attached->m_destination = to; - switch (type) { - case QQuickItemViewTransitioner::NoTransition: - break; - case QQuickItemViewTransitioner::PopulateTransition: - case QQuickItemViewTransitioner::AddTransition: - attached->m_targetIndexes = m_transitioner->addTransitionIndexes; - attached->m_targetItems = m_transitioner->addTransitionTargets; - break; - case QQuickItemViewTransitioner::MoveTransition: - attached->m_targetIndexes = m_transitioner->moveTransitionIndexes; - attached->m_targetItems = m_transitioner->moveTransitionTargets; - break; - case QQuickItemViewTransitioner::RemoveTransition: - attached->m_targetIndexes = m_transitioner->removeTransitionIndexes; - attached->m_targetItems = m_transitioner->removeTransitionTargets; - break; - } + attached->m_targetIndexes = m_transitioner->targetIndexes(type); + attached->m_targetItems = m_transitioner->targetItems(type); emit attached->indexChanged(); emit attached->itemChanged(); emit attached->destinationChanged(); @@ -156,6 +126,7 @@ void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickIt actions << QDeclarativeAction(item->item, QLatin1String("x"), QVariant(to.x())); actions << QDeclarativeAction(item->item, QLatin1String("y"), QVariant(to.y())); + m_transitioner->runningJobs << this; QDeclarativeTransitionManager::transition(actions, trans, item->item); } @@ -164,7 +135,7 @@ void QQuickItemViewTransitionJob::finished() QDeclarativeTransitionManager::finished(); if (m_transitioner) - m_transitioner->finishedTransition(m_item); + m_transitioner->finishedTransition(this, m_item); m_item = 0; m_toPos.setX(0); @@ -185,6 +156,12 @@ QQuickItemViewTransitioner::QQuickItemViewTransitioner() { } +QQuickItemViewTransitioner::~QQuickItemViewTransitioner() +{ + for (QSet::iterator it = runningJobs.begin(); it != runningJobs.end(); ++it) + (*it)->m_transitioner = 0; +} + bool QQuickItemViewTransitioner::canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const { if (!asTarget @@ -241,8 +218,78 @@ void QQuickItemViewTransitioner::transitionNextReposition(QQuickViewItem *item, } } -void QQuickItemViewTransitioner::finishedTransition(QQuickViewItem *item) +QDeclarativeTransition *QQuickItemViewTransitioner::transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget) { + if (type == QQuickItemViewTransitioner::NoTransition) + return 0; + + if (type == PopulateTransition) + asTarget = true; // no separate displaced transition + + QDeclarativeTransition *trans = 0; + switch (type) { + case NoTransition: + break; + case PopulateTransition: + trans = populateTransition; + break; + case AddTransition: + trans = asTarget ? addTransition : addDisplacedTransition; + break; + case MoveTransition: + trans = asTarget ? moveTransition : moveDisplacedTransition; + break; + case RemoveTransition: + trans = asTarget ? removeTransition : removeDisplacedTransition; + break; + } + + if (!asTarget && (!trans || !trans->enabled())) + trans = displacedTransition; + if (trans && trans->enabled()) + return trans; + return 0; +} + +const QList &QQuickItemViewTransitioner::targetIndexes(QQuickItemViewTransitioner::TransitionType type) const +{ + switch (type) { + case QQuickItemViewTransitioner::NoTransition: + break; + case QQuickItemViewTransitioner::PopulateTransition: + case QQuickItemViewTransitioner::AddTransition: + return addTransitionIndexes; + case QQuickItemViewTransitioner::MoveTransition: + return moveTransitionIndexes; + case QQuickItemViewTransitioner::RemoveTransition: + return removeTransitionIndexes; + } + + return qquickitemviewtransition_emptyIndexes; +} + +const QList &QQuickItemViewTransitioner::targetItems(QQuickItemViewTransitioner::TransitionType type) const +{ + switch (type) { + case QQuickItemViewTransitioner::NoTransition: + break; + case QQuickItemViewTransitioner::PopulateTransition: + case QQuickItemViewTransitioner::AddTransition: + return addTransitionTargets; + case QQuickItemViewTransitioner::MoveTransition: + return moveTransitionTargets; + case QQuickItemViewTransitioner::RemoveTransition: + return removeTransitionTargets; + } + + return qquickitemviewtransition_emptyTargets; +} + +void QQuickItemViewTransitioner::finishedTransition(QQuickItemViewTransitionJob *job, QQuickViewItem *item) +{ + if (!runningJobs.contains(job)) + return; + runningJobs.remove(job); if (item) { item->finishedTransition(); if (changeListener) @@ -263,10 +310,6 @@ QQuickViewItem::QQuickViewItem(QQuickItem *i) QQuickViewItem::~QQuickViewItem() { - if (transition) { - transition->m_item = 0; - transition->m_transitioner = 0; - } delete transition; } @@ -385,7 +428,7 @@ void QQuickViewItem::startTransition(QQuickItemViewTransitioner *transitioner) if (!transition || transition->m_type != nextTransitionType || transition->m_isTarget != isTransitionTarget) { delete transition; - transition = new QQuickItemViewTransitionJob(transitioner); + transition = new QQuickItemViewTransitionJob; } // if item is not already moving somewhere, set it to not move anywhere @@ -393,7 +436,7 @@ void QQuickViewItem::startTransition(QQuickItemViewTransitioner *transitioner) if (!nextTransitionToSet) moveTo(item->pos()); - transition->startTransition(this, nextTransitionType, nextTransitionTo, isTransitionTarget); + transition->startTransition(this, transitioner, nextTransitionType, nextTransitionTo, isTransitionTarget); nextTransitionType = QQuickItemViewTransitioner::NoTransition; } diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index 8dd2f86899..1ebc52c185 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -77,14 +77,20 @@ class QQuickItemViewTransitioner }; QQuickItemViewTransitioner(); - virtual ~QQuickItemViewTransitioner() {} + virtual ~QQuickItemViewTransitioner(); bool canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const; void transitionNextReposition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget); + QDeclarativeTransition *transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget); + const QList &targetIndexes(QQuickItemViewTransitioner::TransitionType type) const; + const QList &targetItems(QQuickItemViewTransitioner::TransitionType type) const; + inline void setPopulateTransitionEnabled(bool b) { usePopulateTransition = b; } inline void setChangeListener(QQuickItemViewTransitionChangeListener *obj) { changeListener = obj; } + QSet runningJobs; + QList addTransitionIndexes; QList moveTransitionIndexes; QList removeTransitionIndexes; @@ -107,7 +113,7 @@ class QQuickItemViewTransitioner QQuickItemViewTransitionChangeListener *changeListener; bool usePopulateTransition; - void finishedTransition(QQuickViewItem *item); + void finishedTransition(QQuickItemViewTransitionJob *job, QQuickViewItem *item); }; From 79608d6f72ea5963aed2fa161b9ef6781adbc41e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 27 Feb 2012 13:16:11 +1000 Subject: [PATCH 74/82] Improved transitions for Row, Column, Grid, Flow The view transitions functionality for ListView and GridView has been integrated into the positioner elements. Not all of this functionality is available for positioners, though, since they don't have models (and thus cannot identify certain model operations) and they don't manage the lifetime of their children. Task-number: QTBUG-24336 Change-Id: I71588de289555d2ef5a763af11358bc0af7b31a7 Reviewed-by: Alan Alpert --- doc/src/whatsnew.qdoc | 7 +- src/quick/items/qquickitemviewtransition.cpp | 34 +- src/quick/items/qquickpositioners.cpp | 370 +++++++------- src/quick/items/qquickpositioners_p.h | 16 +- src/quick/items/qquickpositioners_p_p.h | 11 +- .../qquickpositioners/data/transitions.qml | 196 ++++++++ .../qquickpositioners/qquickpositioners.pro | 1 + .../tst_qquickpositioners.cpp | 455 ++++++++++++++++++ tests/auto/qtquick2/shared/viewtestutil.h | 1 + 9 files changed, 908 insertions(+), 183 deletions(-) create mode 100644 tests/auto/qtquick2/qquickpositioners/data/transitions.qml diff --git a/doc/src/whatsnew.qdoc b/doc/src/whatsnew.qdoc index 88d5e91d76..1c92cdb16b 100644 --- a/doc/src/whatsnew.qdoc +++ b/doc/src/whatsnew.qdoc @@ -112,8 +112,11 @@ Setting Image sourceSize.width and sourceSize.height will now fit the image to t Grid now has rowSpacing and columnSpacing properties. Spacing properties on positioners are now real numbers instead of integers. -Positioners now have attached properties that can be used to determine a subitem's location within a -container such as Column or Row: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem. +Positioner (Row, Column, Grid, Flow) improvements: +\list +\o Transitions used for \c add and \c move now have improved features: they can access a ViewTransition attached property (see the ViewTransition documentation for examples) and can now animate arbitrary item properties (instead of being restricted to animating an item's position). +\o Items in a positioner now have attached properties that can be used to determine a subitem's location: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem. +\endlist Loader improvements: - "active" property added to Loader, to allow delaying instantiation of a Loader element's item property diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 9235321418..abff768ad3 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -377,6 +377,12 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) { bool doTransition = false; + // If item is not already moving somewhere, set it to not move anywhere. + // This ensures that removed targets don't transition to the default (0,0) and that + // items set for other transition types only transition if they actually move somewhere. + if (nextTransitionType != QQuickItemViewTransitioner::NoTransition && !nextTransitionToSet) + moveTo(item->pos()); + switch (nextTransitionType) { case QQuickItemViewTransitioner::NoTransition: { @@ -390,7 +396,12 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) case QQuickItemViewTransitioner::RemoveTransition: // For Add targets, do transition if item is moving into visible area // For Remove targets, do transition if item is currently in visible area - if (isTransitionTarget) { + if (viewBounds.isNull()) { + if (isTransitionTarget) + doTransition = true; + else + doTransition = (nextTransitionTo != item->pos()); + } else if (isTransitionTarget) { doTransition = (nextTransitionType == QQuickItemViewTransitioner::AddTransition) ? viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())) : viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())); @@ -408,7 +419,8 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) case QQuickItemViewTransitioner::MoveTransition: // do transition if moving from or into visible area if (nextTransitionTo != item->pos()) { - doTransition = viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) + doTransition = viewBounds.isNull() + || viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())); if (!doTransition) item->setPos(nextTransitionTo); @@ -503,7 +515,19 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) generic displaced transition if specified) \endlist - Such view transitions additionally have access to a ViewTransition attached property that + For the \l Row, \l Column, \l Grid and \l Flow positioner elements, which operate with collections of child + items rather than data models, the following properties are used instead: + + \list + \o \c add - the transition to apply to items that are created for the positioner, added to + or reparented to the positioner, or items that have become \l {Item::}{visible} + \o \c move - the transition to apply to items that have moved within the positioner, including + when they are displaced due to the addition or removal of other items, or when items are otherwise + rearranged within the positioner, or when items are repositioned due to the resizing of other + items in the positioner + \endlist + + View transitions have access to a ViewTransition attached property that provides details of the items that are under transition and the operation that triggered the transition. Since view transitions are run once per item, these details can be used to customise each transition for each individual item. @@ -525,6 +549,10 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) \o ViewTransition.targetItems - the target items themselves \endlist + (Note that for the \l Row, \l Column, \l Grid and \l Flow positioner elements, the \c move transition only + provides these two additional details when the transition is triggered by the addition of items + to a positioner.) + View transitions can be written without referring to any of the attributes listed above. These attributes merely provide extra details that are useful for customising view transitions. diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 95ee9bfb58..6ed35a9f42 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -109,6 +109,7 @@ QQuickBasePositioner::QQuickBasePositioner(QQuickBasePositionerPrivate &dd, Posi QQuickBasePositioner::~QQuickBasePositioner() { Q_D(QQuickBasePositioner); + delete d->transitioner; for (int i = 0; i < positionedItems.count(); ++i) d->unwatchChanges(positionedItems.at(i).item); for (int i = 0; i < unpositionedItems.count(); ++i) @@ -142,31 +143,36 @@ void QQuickBasePositioner::setSpacing(qreal s) QDeclarativeTransition *QQuickBasePositioner::move() const { Q_D(const QQuickBasePositioner); - return d->moveTransition; + return d->transitioner ? d->transitioner->displacedTransition : 0; } void QQuickBasePositioner::setMove(QDeclarativeTransition *mt) { Q_D(QQuickBasePositioner); - if (mt == d->moveTransition) + if (!d->transitioner) + d->transitioner = new QQuickItemViewTransitioner; + if (mt == d->transitioner->displacedTransition) return; - d->moveTransition = mt; + + d->transitioner->displacedTransition = mt; emit moveChanged(); } QDeclarativeTransition *QQuickBasePositioner::add() const { Q_D(const QQuickBasePositioner); - return d->addTransition; + return d->transitioner ? d->transitioner->addTransition : 0; } void QQuickBasePositioner::setAdd(QDeclarativeTransition *add) { Q_D(QQuickBasePositioner); - if (add == d->addTransition) + if (!d->transitioner) + d->transitioner = new QQuickItemViewTransitioner; + if (add == d->transitioner->addTransition) return; - d->addTransition = add; + d->transitioner->addTransition = add; emit addChanged(); } @@ -218,6 +224,7 @@ void QQuickBasePositioner::prePositioning() for (int ii = 0; ii < unpositionedItems.count(); ii++) oldItems.append(unpositionedItems[ii]); unpositionedItems.clear(); + int addedIndex = -1; for (int ii = 0; ii < children.count(); ++ii) { QQuickItem *child = children.at(ii); @@ -229,9 +236,22 @@ void QQuickBasePositioner::prePositioning() posItem.isNew = true; if (!childPrivate->explicitVisible || !child->width() || !child->height()) { posItem.isVisible = false; + posItem.index = -1; unpositionedItems.append(posItem); } else { + posItem.index = positionedItems.count(); positionedItems.append(posItem); + + if (d->transitioner) { + if (addedIndex < 0) + addedIndex = posItem.index; + PositionedItem *theItem = &positionedItems[positionedItems.count()-1]; + + d->transitioner->transitionNextReposition(theItem, + QQuickItemViewTransitioner::AddTransition, true); + d->transitioner->addTransitionIndexes << posItem.index; + d->transitioner->addTransitionTargets << posItem.item; + } } } else { PositionedItem *item = &oldItems[wIdx]; @@ -239,75 +259,93 @@ void QQuickBasePositioner::prePositioning() // i.e. their positioning is not affected if an ancestor is hidden. if (!childPrivate->explicitVisible || !child->width() || !child->height()) { item->isVisible = false; + item->index = -1; unpositionedItems.append(*item); } else if (!item->isVisible) { + // item changed from non-visible to visible, treat it as a "new" item item->isVisible = true; item->isNew = true; + item->index = positionedItems.count(); positionedItems.append(*item); + + if (d->transitioner) { + if (addedIndex < 0) + addedIndex = item->index; + d->transitioner->transitionNextReposition(&positionedItems[positionedItems.count()-1], + QQuickItemViewTransitioner::AddTransition, true); + d->transitioner->addTransitionIndexes << item->index; + d->transitioner->addTransitionTargets << item->item; + } } else { item->isNew = false; + item->index = positionedItems.count(); positionedItems.append(*item); } } } + + if (d->transitioner) { + for (int i=0; i= 0) { + d->transitioner->transitionNextReposition(&positionedItems[i], QQuickItemViewTransitioner::AddTransition, false); + } else { + // just queue the item for a move-type displace - if the item hasn't + // moved anywhere, it won't be transitioned anyway + d->transitioner->transitionNextReposition(&positionedItems[i], QQuickItemViewTransitioner::MoveTransition, false); + } + } + } + } + QSizeF contentSize(0,0); reportConflictingAnchors(); if (!d->anchorConflict) { doPositioning(&contentSize); updateAttachedProperties(); } - if (!d->addActions.isEmpty() || !d->moveActions.isEmpty()) - finishApplyTransitions(); + + if (d->transitioner) { + QRectF viewBounds; + for (int i=0; itransitioner); + } + d->transitioner->addTransitionIndexes.clear(); + d->transitioner->addTransitionTargets.clear(); + } + d->doingPositioning = false; + //Set implicit size to the size of its children setImplicitSize(contentSize.width(), contentSize.height()); } -void QQuickBasePositioner::positionX(qreal x, const PositionedItem &target) +void QQuickBasePositioner::positionItem(qreal x, qreal y, PositionedItem *target) { Q_D(QQuickBasePositioner); - if (d->type == Horizontal || d->type == Both) { - if (target.isNew) { - if (!d->addTransition || !d->addTransition->enabled()) - target.item->setX(x); - else - d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x)); - } else if (x != target.item->x()) { - if (!d->moveTransition || !d->moveTransition->enabled()) - target.item->setX(x); - else - d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x)); - } + if ( (target->itemX() != x || target->itemY() != y) + && d->type == Both) { + target->moveTo(QPointF(x, y)); } } -void QQuickBasePositioner::positionY(qreal y, const PositionedItem &target) +void QQuickBasePositioner::positionItemX(qreal x, PositionedItem *target) { Q_D(QQuickBasePositioner); - if (d->type == Vertical || d->type == Both) { - if (target.isNew) { - if (!d->addTransition || !d->addTransition->enabled()) - target.item->setY(y); - else - d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y)); - } else if (y != target.item->y()) { - if (!d->moveTransition || !d->moveTransition->enabled()) - target.item->setY(y); - else - d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y)); - } + if (target->itemX() != x + && (d->type == Horizontal || d->type == Both)) { + target->moveTo(QPointF(x, target->itemY())); } } -void QQuickBasePositioner::finishApplyTransitions() +void QQuickBasePositioner::positionItemY(qreal y, PositionedItem *target) { Q_D(QQuickBasePositioner); - // Note that if a transition is not set the transition manager will - // apply the changes directly, in the case add/move aren't set - d->addTransitionManager.transition(d->addActions, d->addTransition); - d->moveTransitionManager.transition(d->moveActions, d->moveTransition); - d->addActions.clear(); - d->moveActions.clear(); + if (target->itemY() != y + && (d->type == Vertical || d->type == Both)) { + target->moveTo(QPointF(target->itemX(), y)); + } } QQuickPositionerAttached *QQuickBasePositioner::qmlAttachedProperties(QObject *obj) @@ -501,30 +539,42 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) /*! \qmlproperty Transition QtQuick2::Column::add - This property holds the transition to be applied when adding an - item to the positioner. The transition will only be applied to the - added item(s). Positioner transitions will only affect the - position (x, y) of items. + This property holds the transition to be run for items that are added to this + positioner. For a positioner, this applies to: + + \list + \o Items that are created or reparented as a child of the positioner + \o Child items that change their \l visible property from false to true, and thus + are now visible + \endlist - For a positioner, adding an item can mean that either the object - has been created or reparented, and thus is now a child or the - positioner, or that the object has changed its \l visible property - from false to true, and thus is now visible. + The transition can use the \l ViewTransition property to access more details about + the item that is being added. See the \l ViewTransition documentation for more details + and examples on using these transitions. - \sa move + \sa move, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition QtQuick2::Column::move - This property holds the transition to apply to any item that has moved - within the positioner. Positioner transitions will only affect - the position (x, y) of items. + This property holds the transition to run for items that have moved within the + positioner. For a positioner, this applies to: - This transition is applied to items that are displaced as a result of the - addition or removal of other items in the positioner, or when items move due to - a move operation in a related model, or when items resize themselves. + \list + \o Child items that move when they are displaced due to the addition, removal or + rearrangement of other items in the positioner + \o Child items that are repositioned due to the resizing of other items in the positioner + \endlist + + The transition can use the \l ViewTransition property to access more details about + the item that is being moved. Note, however, that for this move transition, the + ViewTransition.targetIndexes and ViewTransition.targetItems lists are only set when + this transition is triggered by the addition of other items in the positioner; in other + cases, these lists will be empty. + + See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty real QtQuick2::Column::spacing @@ -545,11 +595,8 @@ void QQuickColumn::doPositioning(QSizeF *contentSize) qreal voffset = 0; for (int ii = 0; ii < positionedItems.count(); ++ii) { - const PositionedItem &child = positionedItems.at(ii); - - if (child.item->y() != voffset) - positionY(voffset, child); - + PositionedItem &child = positionedItems[ii]; + positionItemY(voffset, &child); contentSize->setWidth(qMax(contentSize->width(), child.item->width())); voffset += child.item->height(); @@ -625,42 +672,42 @@ void QQuickColumn::reportConflictingAnchors() /*! \qmlproperty Transition QtQuick2::Row::add - This property holds the transition to be applied when adding an - item to the positioner. The transition will only be applied to the - added item(s). Positioner transitions will only affect the - position (x, y) of items. + This property holds the transition to be run for items that are added to this + positioner. For a positioner, this applies to: - For a positioner, adding an item can mean that either the object - has been created or reparented, and thus is now a child or the - positioner, or that the object has changed its \l visible property - from false to true, and thus is now visible. + \list + \o Items that are created or reparented as a child of the positioner + \o Child items that change their \l visible property from false to true, and thus + are now visible + \endlist + + The transition can use the \l ViewTransition property to access more details about + the item that is being added. See the \l ViewTransition documentation for more details + and examples on using these transitions. - \sa move + \sa move, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition QtQuick2::Row::move - This property holds the transition to apply to any item that has moved - within the positioner. Positioner transitions will only affect - the position (x, y) of items. - - This transition is applied to items that are displaced as a result of the - addition or removal of other items in the positioner, or when items move due to - a move operation in a related model, or when items resize themselves. - - \qml - Row { - id: positioner - move: Transition { - NumberAnimation { - properties: "x" - duration: 1000 - } - } - } - \endqml + This property holds the transition to run for items that have moved within the + positioner. For a positioner, this applies to: + + \list + \o Child items that move when they are displaced due to the addition, removal or + rearrangement of other items in the positioner + \o Child items that are repositioned due to the resizing of other items in the positioner + \endlist + + The transition can use the \l ViewTransition property to access more details about + the item that is being moved. Note, however, that for this move transition, the + ViewTransition.targetIndexes and ViewTransition.targetItems lists are only set when + this transition is triggered by the addition of other items in the positioner; in other + cases, these lists will be empty. - \sa add, {declarative/positioners}{Positioners example} + See the \l ViewTransition documentation for more details and examples on using these transitions. + + \sa add, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty real QtQuick2::Row::spacing @@ -736,11 +783,10 @@ void QQuickRow::doPositioning(QSizeF *contentSize) QList hoffsets; for (int ii = 0; ii < positionedItems.count(); ++ii) { - const PositionedItem &child = positionedItems.at(ii); + PositionedItem &child = positionedItems[ii]; if (d->isLeftToRight()) { - if (child.item->x() != hoffset) - positionX(hoffset, child); + positionItemX(hoffset, &child); } else { hoffsets << hoffset; } @@ -767,10 +813,9 @@ void QQuickRow::doPositioning(QSizeF *contentSize) int acc = 0; for (int ii = 0; ii < positionedItems.count(); ++ii) { - const PositionedItem &child = positionedItems.at(ii); + PositionedItem &child = positionedItems[ii]; hoffset = end - hoffsets[acc++] - child.item->width(); - if (child.item->x() != hoffset) - positionX(hoffset, child); + positionItemX(hoffset, &child); } } @@ -839,41 +884,42 @@ void QQuickRow::reportConflictingAnchors() /*! \qmlproperty Transition QtQuick2::Grid::add - This property holds the transition to be applied when adding an - item to the positioner. The transition will only be applied to the - added item(s). Positioner transitions will only affect the - position (x, y) of items. + This property holds the transition to be run for items that are added to this + positioner. For a positioner, this applies to: + + \list + \o Items that are created or reparented as a child of the positioner + \o Child items that change their \l visible property from false to true, and thus + are now visible + \endlist - For a positioner, adding an item can mean that either the object - has been created or reparented, and thus is now a child or the - positioner, or that the object has changed its \l visible property - from false to true, and thus is now visible. + The transition can use the \l ViewTransition property to access more details about + the item that is being added. See the \l ViewTransition documentation for more details + and examples on using these transitions. - \sa move + \sa move, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition QtQuick2::Grid::move - This property holds the transition to apply to any item that has moved - within the positioner. Positioner transitions will only affect - the position (x, y) of items. + This property holds the transition to run for items that have moved within the + positioner. For a positioner, this applies to: + + \list + \o Child items that move when they are displaced due to the addition, removal or + rearrangement of other items in the positioner + \o Child items that are repositioned due to the resizing of other items in the positioner + \endlist - This transition is applied to items that are displaced as a result of the - addition or removal of other items in the positioner, or when items move due to - a move operation in a related model, or when items resize themselves. + The transition can use the \l ViewTransition property to access more details about + the item that is being moved. Note, however, that for this move transition, the + ViewTransition.targetIndexes and ViewTransition.targetItems lists are only set when + this transition is triggered by the addition of other items in the positioner; in other + cases, these lists will be empty. - \qml - Grid { - move: Transition { - NumberAnimation { - properties: "x,y" - duration: 1000 - } - } - } - \endqml + See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty qreal QtQuick2::Grid::spacing @@ -1160,14 +1206,11 @@ void QQuickGrid::doPositioning(QSizeF *contentSize) int curRow =0; int curCol =0; for (int i = 0; i < positionedItems.count(); ++i) { - const PositionedItem &child = positionedItems.at(i); + PositionedItem &child = positionedItems[i]; qreal childXOffset = xoffset; if (!d->isLeftToRight()) childXOffset -= child.item->width(); - if ((child.item->x() != childXOffset) || (child.item->y() != yoffset)) { - positionX(childXOffset, child); - positionY(yoffset, child); - } + positionItem(childXOffset, yoffset, &child); if (m_flow == LeftToRight) { if (d->isLeftToRight()) @@ -1254,42 +1297,42 @@ void QQuickGrid::reportConflictingAnchors() /*! \qmlproperty Transition QtQuick2::Flow::add - This property holds the transition to be applied when adding an - item to the positioner. The transition will only be applied to the - added item(s). Positioner transitions will only affect the - position (x, y) of items. + This property holds the transition to be run for items that are added to this + positioner. For a positioner, this applies to: + + \list + \o Items that are created or reparented as a child of the positioner + \o Child items that change their \l visible property from false to true, and thus + are now visible + \endlist - For a positioner, adding an item can mean that either the object - has been created or reparented, and thus is now a child or the - positioner, or that the object has changed its \l visible property - from false to true, and thus is now visible. + The transition can use the \l ViewTransition property to access more details about + the item that is being added. See the \l ViewTransition documentation for more details + and examples on using these transitions. - \sa move + \sa move, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition QtQuick2::Flow::move - This property holds the transition to apply to any item that has moved - within the positioner. Positioner transitions will only affect - the position (x, y) of items. - - This transition is applied to items that are displaced as a result of the - addition or removal of other items in the positioner, or when items move due to - a move operation in a related model, or when items resize themselves. - - \qml - Flow { - id: positioner - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" - } - } - } - \endqml + This property holds the transition to run for items that have moved within the + positioner. For a positioner, this applies to: + + \list + \o Child items that move when they are displaced due to the addition, removal or + rearrangement of other items in the positioner + \o Child items that are repositioned due to the resizing of other items in the positioner + \endlist + + The transition can use the \l ViewTransition property to access more details about + the item that is being moved. Note, however, that for this move transition, the + ViewTransition.targetIndexes and ViewTransition.targetItems lists are only set when + this transition is triggered by the addition of other items in the positioner; in other + cases, these lists will be empty. + + See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {declarative/positioners}{Positioners example} */ /*! \qmlproperty real QtQuick2::Flow::spacing @@ -1414,7 +1457,7 @@ void QQuickFlow::doPositioning(QSizeF *contentSize) QList hoffsets; for (int i = 0; i < positionedItems.count(); ++i) { - const PositionedItem &child = positionedItems.at(i); + PositionedItem &child = positionedItems[i]; if (d->flow == LeftToRight) { if (widthValid() && hoffset && hoffset + child.item->width() > width()) { @@ -1431,13 +1474,11 @@ void QQuickFlow::doPositioning(QSizeF *contentSize) } if (d->isLeftToRight()) { - if (child.item->x() != hoffset) - positionX(hoffset, child); + positionItem(hoffset, voffset, &child); } else { hoffsets << hoffset; + positionItemY(voffset, &child); } - if (child.item->y() != voffset) - positionY(voffset, child); contentSize->setWidth(qMax(contentSize->width(), hoffset + child.item->width())); contentSize->setHeight(qMax(contentSize->height(), voffset + child.item->height())); @@ -1462,10 +1503,9 @@ void QQuickFlow::doPositioning(QSizeF *contentSize) end = contentSize->width(); int acc = 0; for (int i = 0; i < positionedItems.count(); ++i) { - const PositionedItem &child = positionedItems.at(i); + PositionedItem &child = positionedItems[i]; hoffset = end - hoffsets[acc++] - child.item->width(); - if (child.item->x() != hoffset) - positionX(hoffset, child); + positionItemX(hoffset, &child); } } diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index a4f18cfc21..32dd9030fe 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -43,6 +43,7 @@ #define QQUICKPOSITIONERS_P_H #include "qquickimplicitsizeitem_p.h" +#include "qquickitemviewtransition_p.h" #include #include @@ -96,6 +97,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBasePositioner : public QQuickImplicitSizeIte Q_PROPERTY(QDeclarativeTransition *add READ add WRITE setAdd NOTIFY addChanged) public: enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; + QQuickBasePositioner(PositionerType, QQuickItem *parent); ~QQuickBasePositioner(); @@ -116,7 +118,6 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBasePositioner : public QQuickImplicitSizeIte QQuickBasePositioner(QQuickBasePositionerPrivate &dd, PositionerType at, QQuickItem *parent); virtual void componentComplete(); virtual void itemChange(ItemChange, const ItemChangeData &); - void finishApplyTransitions(); virtual void updatePolish(); @@ -131,19 +132,22 @@ protected Q_SLOTS: protected: virtual void doPositioning(QSizeF *contentSize)=0; virtual void reportConflictingAnchors()=0; - class PositionedItem { + + class PositionedItem : public QQuickViewItem + { public : - PositionedItem(QQuickItem *i) : item(i), isNew(false), isVisible(true) {} + PositionedItem(QQuickItem *i) : QQuickViewItem(i), isNew(false), isVisible(true) {} bool operator==(const PositionedItem &other) const { return other.item == item; } - QQuickItem *item; + bool isNew; bool isVisible; }; QPODVector positionedItems; QPODVector unpositionedItems;//Still 'in' the positioner, just not positioned - void positionX(qreal,const PositionedItem &target); - void positionY(qreal,const PositionedItem &target); + void positionItem(qreal x, qreal y, PositionedItem *target); + void positionItemX(qreal, PositionedItem *target); + void positionItemY(qreal, PositionedItem *target); private: Q_DISABLE_COPY(QQuickBasePositioner) diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h index d281f1a372..f1d174dc0a 100644 --- a/src/quick/items/qquickpositioners_p_p.h +++ b/src/quick/items/qquickpositioners_p_p.h @@ -66,6 +66,8 @@ QT_BEGIN_NAMESPACE +class QQuickItemViewTransitioner; + class QQuickBasePositionerPrivate : public QQuickImplicitSizeItemPrivate, public QQuickItemChangeListener { Q_DECLARE_PUBLIC(QQuickBasePositioner) @@ -73,7 +75,7 @@ class QQuickBasePositionerPrivate : public QQuickImplicitSizeItemPrivate, public public: QQuickBasePositionerPrivate() : spacing(0), type(QQuickBasePositioner::None) - , moveTransition(0), addTransition(0), positioningDirty(false) + , transitioner(0), positioningDirty(false) , doingPositioning(false), anchorConflict(false), layoutDirection(Qt::LeftToRight) { } @@ -87,12 +89,7 @@ class QQuickBasePositionerPrivate : public QQuickImplicitSizeItemPrivate, public qreal spacing; QQuickBasePositioner::PositionerType type; - QDeclarativeTransition *moveTransition; - QDeclarativeTransition *addTransition; - QDeclarativeStateOperation::ActionList addActions; - QDeclarativeStateOperation::ActionList moveActions; - QDeclarativeTransitionManager addTransitionManager; - QDeclarativeTransitionManager moveTransitionManager; + QQuickItemViewTransitioner *transitioner; void watchChanges(QQuickItem *other); void unwatchChanges(QQuickItem* other); diff --git a/tests/auto/qtquick2/qquickpositioners/data/transitions.qml b/tests/auto/qtquick2/qquickpositioners/data/transitions.qml new file mode 100644 index 0000000000..982e64141c --- /dev/null +++ b/tests/auto/qtquick2/qquickpositioners/data/transitions.qml @@ -0,0 +1,196 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 500 + height: 500 + + property int duration: 50 + + property int targetTransitionsDone + property int displaceTransitionsDone + + property var targetTrans_items: new Object() + property var targetTrans_targetIndexes: new Array() + property var targetTrans_targetItems: new Array() + + property var displacedTrans_items: new Object() + property var displacedTrans_targetIndexes: new Array() + property var displacedTrans_targetItems: new Array() + + // for QDeclarativeListProperty types + function copyList(propList) { + var temp = new Array() + for (var i=0; i #include #include +#include "../shared/viewtestutil.h" +#include "../shared/visualtestutil.h" #include "../../shared/util.h" +using namespace QQuickViewTestUtil; +using namespace QQuickVisualTestUtil; + class tst_qquickpositioners : public QDeclarativeDataTest { Q_OBJECT @@ -88,11 +93,145 @@ private slots: void test_attachedproperties(); void test_attachedproperties_data(); void test_attachedproperties_dynamic(); + void addTransitions_row(); + void addTransitions_row_data(); + void addTransitions_column(); + void addTransitions_column_data(); + void addTransitions_grid(); + void addTransitions_grid_data(); + void addTransitions_flow(); + void addTransitions_flow_data(); + void moveTransitions_row(); + void moveTransitions_row_data(); + void moveTransitions_column(); + void moveTransitions_column_data(); + void moveTransitions_grid(); + void moveTransitions_grid_data(); + void moveTransitions_flow(); + void moveTransitions_flow_data(); private: QQuickView *createView(const QString &filename, bool wait=true); + + void addTransitions(const QString &positionerObjectName); + void addTransitions_data(); + void moveTransitions(const QString &positionerObjectName); + void moveTransitions_data(); + void matchIndexLists(const QVariantList &indexLists, const QList &expectedIndexes); + void matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList &expectedIndexes); + void matchItemLists(const QVariantList &itemLists, const QList &expectedItems); + void checkItemPositions(QQuickItem *positioner, QaimModel *model, qreal incrementalSize); }; +void tst_qquickpositioners::addTransitions_row() +{ + addTransitions("row"); +} + +void tst_qquickpositioners::addTransitions_row_data() +{ + addTransitions_data(); +} + +void tst_qquickpositioners::addTransitions_column() +{ + addTransitions("column"); +} + +void tst_qquickpositioners::addTransitions_column_data() +{ + addTransitions_data(); +} + +void tst_qquickpositioners::addTransitions_grid() +{ + addTransitions("grid"); +} + +void tst_qquickpositioners::addTransitions_grid_data() +{ + // don't use addTransitions_data() because grid displaces items differently + // (adding items further down the grid can cause displace transitions at + // previous indexes, since grid is auto-resized to tightly fit all of its items) + + QTest::addColumn("initialItemCount"); + QTest::addColumn("insertionIndex"); + QTest::addColumn("insertionCount"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("add one @ start") << 10 << 0 << 1 << ListRange(0, 9); + QTest::newRow("add one @ middle") << 10 << 5 << 1 << ListRange(3, 3) + ListRange(5, 9); + QTest::newRow("add one @ end") << 10 << 10 << 1 << ListRange(3, 3) + ListRange(7, 7); + + QTest::newRow("add multiple @ start") << 10 << 0 << 3 << ListRange(0, 9); + QTest::newRow("add multiple @ middle") << 10 << 5 << 3 << ListRange(1, 3) + ListRange(5, 9); + QTest::newRow("add multiple @ end") << 10 << 10 << 3 << ListRange(1, 3) + ListRange(5, 7) + ListRange(9, 9); +} + +void tst_qquickpositioners::addTransitions_flow() +{ + addTransitions("flow"); +} + +void tst_qquickpositioners::addTransitions_flow_data() +{ + addTransitions_data(); +} + +void tst_qquickpositioners::moveTransitions_row() +{ + moveTransitions("row"); +} + +void tst_qquickpositioners::moveTransitions_row_data() +{ + moveTransitions_data(); +} + +void tst_qquickpositioners::moveTransitions_column() +{ + moveTransitions("column"); +} + +void tst_qquickpositioners::moveTransitions_column_data() +{ + moveTransitions_data(); +} + +void tst_qquickpositioners::moveTransitions_grid() +{ + moveTransitions("grid"); +} + +void tst_qquickpositioners::moveTransitions_grid_data() +{ + // don't use moveTransitions_data() because grid displaces items differently + // (removing items further down the grid can cause displace transitions at + // previous indexes, since grid is auto-resized to tightly fit all of its items) + + QTest::addColumn("initialItemCount"); + QTest::addColumn("change"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("remove one @ start") << 10 << ListChange::remove(0, 1) << ListRange(1, 9); + QTest::newRow("remove one @ middle") << 10 << ListChange::remove(4, 1) << ListRange(2, 3) + ListRange(5, 9); + QTest::newRow("remove one @ end") << 10 << ListChange::remove(9, 1) << ListRange(2, 3) + ListRange(6, 7); + + QTest::newRow("remove multiple @ start") << 10 << ListChange::remove(0, 3) << ListRange(3, 9); + QTest::newRow("remove multiple @ middle") << 10 << ListChange::remove(4, 3) << ListRange(1, 3) + ListRange(7, 9); + QTest::newRow("remove multiple @ end") << 10 << ListChange::remove(7, 3) << ListRange(1, 3) + ListRange(5, 6); +} + +void tst_qquickpositioners::moveTransitions_flow() +{ + moveTransitions("flow"); +} + +void tst_qquickpositioners::moveTransitions_flow_data() +{ + moveTransitions_data(); +} + tst_qquickpositioners::tst_qquickpositioners() { } @@ -370,6 +509,285 @@ void tst_qquickpositioners::test_horizontal_animated_disabled() delete canvas; } +void tst_qquickpositioners::addTransitions(const QString &positionerObjectName) +{ + QFETCH(int, initialItemCount); + QFETCH(int, insertionIndex); + QFETCH(int, insertionCount); + QFETCH(ListRange, expectedDisplacedIndexes); + + QPointF targetItems_transitionFrom(-50, -50); + QPointF displacedItems_transitionVia(100, 100); + + QaimModel model; + for (int i = 0; i < initialItemCount; i++) + model.addItem("Original item" + QString::number(i), ""); + QaimModel model_targetItems_transitionFrom; + QaimModel model_displacedItems_transitionVia; + + QQuickView *canvas = QQuickViewTestUtil::createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("enableAddTransition", true); + ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom); + ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia); + ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom); + ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia); + canvas->setSource(testFile("transitions.qml")); + canvas->show(); + qApp->processEvents(); + + QList > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); + + QQuickItem *positioner = canvas->rootObject()->findChild(positionerObjectName); + QVERIFY(positioner); + positioner->findChild("repeater")->setProperty("model", QVariant::fromValue(&model)); + + QList > targetData; + QList targetIndexes; + for (int i=0; i targetItems = findItems(positioner, "wrapper", targetIndexes); + + // check initial add transition + // (positioners run the add transition on all items that are initially created for the view) + QTRY_COMPARE(canvas->rootObject()->property("targetTransitionsDone").toInt(), initialItemCount); + QTRY_COMPARE(canvas->rootObject()->property("displaceTransitionsDone").toInt(), 0); + model_targetItems_transitionFrom.matchAgainst(targetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos"); + matchItemsAndIndexes(canvas->rootObject()->property("targetTrans_items").toMap(), model, targetIndexes); + matchIndexLists(canvas->rootObject()->property("targetTrans_targetIndexes").toList(), targetIndexes); + matchItemLists(canvas->rootObject()->property("targetTrans_targetItems").toList(), targetItems); + + model_targetItems_transitionFrom.clear(); + canvas->rootObject()->setProperty("targetTransitionsDone", 0); + canvas->rootObject()->setProperty("targetTrans_items", QVariantMap()); + canvas->rootObject()->setProperty("targetTrans_targetIndexes", QVariantList()); + canvas->rootObject()->setProperty("targetTrans_targetItems", QVariantList()); + + // do insertion + targetData.clear(); + targetIndexes.clear(); + for (int i=insertionIndex; iproperty("count").toInt()); + + targetItems = findItems(positioner, "wrapper", targetIndexes); + + QTRY_COMPARE(canvas->rootObject()->property("targetTransitionsDone").toInt(), targetData.count()); + QTRY_COMPARE(canvas->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count()); + + // check the target and displaced items were animated + model_targetItems_transitionFrom.matchAgainst(targetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos"); + model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim"); + + // check attached properties + matchItemsAndIndexes(canvas->rootObject()->property("targetTrans_items").toMap(), model, targetIndexes); + matchIndexLists(canvas->rootObject()->property("targetTrans_targetIndexes").toList(), targetIndexes); + matchItemLists(canvas->rootObject()->property("targetTrans_targetItems").toList(), targetItems); + if (expectedDisplacedIndexes.isValid()) { + // adjust expectedDisplacedIndexes to their final values after the move + QList displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, insertionIndex, insertionCount); + matchItemsAndIndexes(canvas->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes); + matchIndexLists(canvas->rootObject()->property("displacedTrans_targetIndexes").toList(), targetIndexes); + matchItemLists(canvas->rootObject()->property("displacedTrans_targetItems").toList(), targetItems); + } + + checkItemPositions(positioner, &model, 5.0); // XXX fetch from qml? + + delete canvas; +} + +void tst_qquickpositioners::addTransitions_data() +{ + // If this data changes, update addTransitions_grid_data() also + + QTest::addColumn("initialItemCount"); + QTest::addColumn("insertionIndex"); + QTest::addColumn("insertionCount"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("add one @ start") << 10 << 0 << 1 << ListRange(0, 9); + QTest::newRow("add one @ middle") << 10 << 5 << 1 << ListRange(5, 9); + QTest::newRow("add one @ end") << 10 << 10 << 1 << ListRange(); + + QTest::newRow("add multiple @ start") << 10 << 0 << 3 << ListRange(0, 9); + QTest::newRow("add multiple @ middle") << 10 << 5 << 3 << ListRange(5, 9); + QTest::newRow("add multiple @ end") << 10 << 10 << 3 << ListRange(); +} + +void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) +{ + QFETCH(int, initialItemCount); + QFETCH(ListChange, change); + QFETCH(ListRange, expectedDisplacedIndexes); + + QPointF targetItems_transitionFrom(-50, -50); + QPointF displacedItems_transitionVia(100, 100); + + QaimModel model; + for (int i = 0; i < initialItemCount; i++) + model.addItem("Item" + QString::number(i), ""); + QaimModel model_targetItems_transitionFrom; + QaimModel model_displacedItems_transitionVia; + + QQuickView *canvas = QQuickViewTestUtil::createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("enableAddTransition", false); + ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom); + ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia); + ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom); + ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia); + canvas->setSource(testFile("transitions.qml")); + canvas->show(); + qApp->processEvents(); + + QList > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); + + QQuickItem *positioner = canvas->rootObject()->findChild(positionerObjectName); + QVERIFY(positioner); + positioner->findChild("repeater")->setProperty("model", QVariant::fromValue(&model)); + QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false); + + switch (change.type) { + case ListChange::Removed: + model.removeItems(change.index, change.count); + QTRY_COMPARE(model.count(), positioner->property("count").toInt()); + break; + case ListChange::Moved: + model.moveItems(change.index, change.to, change.count); + QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false); + break; + case ListChange::Inserted: + case ListChange::SetCurrent: + case ListChange::SetContentY: + QVERIFY(false); + break; + } + + QTRY_COMPARE(canvas->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count()); + QCOMPARE(canvas->rootObject()->property("targetTransitionsDone").toInt(), 0); + + // check the target and displaced items were animated + QCOMPARE(model_targetItems_transitionFrom.count(), 0); + model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim"); + + // check attached properties + QCOMPARE(canvas->rootObject()->property("targetTrans_items").toMap().count(), 0); + QCOMPARE(canvas->rootObject()->property("targetTrans_targetIndexes").toList().count(), 0); + QCOMPARE(canvas->rootObject()->property("targetTrans_targetItems").toList().count(), 0); + if (expectedDisplacedIndexes.isValid()) { + // adjust expectedDisplacedIndexes to their final values after the move + QList displacedIndexes; + if (change.type == ListChange::Inserted) + displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, change.index, change.count); + else if (change.type == ListChange::Moved) + displacedIndexes = adjustIndexesForMove(expectedDisplacedIndexes.indexes, change.index, change.to, change.count); + else if (change.type == ListChange::Removed) + displacedIndexes = adjustIndexesForRemoveDisplaced(expectedDisplacedIndexes.indexes, change.index, change.count); + else + QVERIFY(false); + matchItemsAndIndexes(canvas->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes); + + QVariantList listOfEmptyIntLists; + for (int i=0; i()); + QCOMPARE(canvas->rootObject()->property("displacedTrans_targetIndexes").toList(), listOfEmptyIntLists); + QVariantList listOfEmptyObjectLists; + for (int i=0; irootObject()->property("displacedTrans_targetItems").toList(), listOfEmptyObjectLists); + } + + checkItemPositions(positioner, &model, 5.0); + + delete canvas; +} + +void tst_qquickpositioners::moveTransitions_data() +{ + // If this data changes, update moveTransitions_grid_data() also + + QTest::addColumn("initialItemCount"); + QTest::addColumn("change"); + QTest::addColumn("expectedDisplacedIndexes"); + + QTest::newRow("remove one @ start") << 10 << ListChange::remove(0, 1) << ListRange(1, 9); + QTest::newRow("remove one @ middle") << 10 << ListChange::remove(4, 1) << ListRange(5, 9); + QTest::newRow("remove one @ end") << 10 << ListChange::remove(9, 1) << ListRange(); + + QTest::newRow("remove multiple @ start") << 10 << ListChange::remove(0, 3) << ListRange(3, 9); + QTest::newRow("remove multiple @ middle") << 10 << ListChange::remove(4, 3) << ListRange(7, 9); + QTest::newRow("remove multiple @ end") << 10 << ListChange::remove(7, 3) << ListRange(); +} + + +void tst_qquickpositioners::checkItemPositions(QQuickItem *positioner, QaimModel *model, qreal incrementalSize) +{ + QVERIFY(model->count() > 0); + qreal padding = 0; + qreal currentSize = 30; + qreal rowX = 0; + qreal rowY = 0; + + for (int i=0; icount(); ++i) { + QQuickItem *item = findItem(positioner, "wrapper", i); + QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); + + QCOMPARE(item->width(), currentSize); + QCOMPARE(item->height(), currentSize); + + if (qobject_cast(positioner)) { + QCOMPARE(item->x(), (i * 30.0) + padding); + QCOMPARE(item->y(), 0.0); + } else if (qobject_cast(positioner)) { + QCOMPARE(item->x(), 0.0); + QCOMPARE(item->y(), (i * 30.0) + padding); + } else if (qobject_cast(positioner)) { + int columns = 4; + int rows = qCeil(model->count() / qreal(columns)); + int lastMatchingRowIndex = (rows * columns) - (columns - i%columns); + if (lastMatchingRowIndex >= model->count()) + lastMatchingRowIndex -= columns; + if (i % columns > 0) { + QQuickItem *finalAlignedRowItem = findItem(positioner, "wrapper", lastMatchingRowIndex); + QVERIFY(finalAlignedRowItem); + QCOMPARE(item->x(), finalAlignedRowItem->x()); + } else { + QCOMPARE(item->x(), 0.0); + } + if (i / columns > 0) { + QQuickItem *prevRowLastItem = findItem(positioner, "wrapper", (i/columns * columns) - 1); + QVERIFY(prevRowLastItem); + QCOMPARE(item->y(), prevRowLastItem->y() + prevRowLastItem->height()); + } else { + QCOMPARE(item->y(), 0.0); + } + } else if (qobject_cast(positioner)) { + if (rowX + item->width() > positioner->width()) { + QQuickItem *prevItem = findItem(positioner, "wrapper", i-1); + QVERIFY(prevItem); + rowX = 0; + rowY = prevItem->y() + prevItem->height(); + } + QCOMPARE(item->x(), rowX); + QCOMPARE(item->y(), rowY); + rowX += item->width(); + } else { + QVERIFY2(false, "Unknown positioner type"); + } + QQuickText *name = findItem(positioner, "name", i); + QVERIFY(name != 0); + QTRY_COMPARE(name->text(), model->name(i)); + + padding += i * incrementalSize; + currentSize += incrementalSize; + } +} + void tst_qquickpositioners::test_vertical() { QQuickView *canvas = createView(testFile("vertical.qml")); @@ -1466,6 +1884,43 @@ QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait return canvas; } +void tst_qquickpositioners::matchIndexLists(const QVariantList &indexLists, const QList &expectedIndexes) +{ + for (int i=0; i current = indexLists[i].value >().toSet(); + if (current != expectedIndexes.toSet()) + qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes; + QCOMPARE(current, expectedIndexes.toSet()); + } +} + +void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList &expectedIndexes) +{ + for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) { + QVERIFY(it.value().type() == QVariant::Int); + QString name = it.key(); + int itemIndex = it.value().toInt(); + QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex))); + if (model.name(itemIndex) != name) + qDebug() << itemIndex; + QCOMPARE(model.name(itemIndex), name); + } + QCOMPARE(items.count(), expectedIndexes.count()); +} + +void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QList &expectedItems) +{ + for (int i=0; i(current[j].value()); + QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j))); + QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j))); + } + QCOMPARE(current.count(), expectedItems.count()); + } +} QTEST_MAIN(tst_qquickpositioners) diff --git a/tests/auto/qtquick2/shared/viewtestutil.h b/tests/auto/qtquick2/shared/viewtestutil.h index ebee1787d3..9833fcd5cc 100644 --- a/tests/auto/qtquick2/shared/viewtestutil.h +++ b/tests/auto/qtquick2/shared/viewtestutil.h @@ -174,6 +174,7 @@ namespace QQuickViewTestUtil }; } +Q_DECLARE_METATYPE(QQuickViewTestUtil::QaimModel*) Q_DECLARE_METATYPE(QQuickViewTestUtil::ListChange) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QQuickViewTestUtil::ListRange) From 04fb631120590c55812a11a576dca48dafec6aea Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 29 Feb 2012 13:55:58 +1000 Subject: [PATCH 75/82] Return correct propertyIndex for v4 bindings. Change-Id: I4aa37491d36331889f6b30c4d4af8b56cef96225 Reviewed-by: Matthew Vogt --- src/declarative/qml/v4/qv4bindings.cpp | 3 ++- src/declarative/qml/v4/qv4bindings_p.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/v4/qv4bindings.cpp b/src/declarative/qml/v4/qv4bindings.cpp index 2c26fff3d8..319dbf51bb 100644 --- a/src/declarative/qml/v4/qv4bindings.cpp +++ b/src/declarative/qml/v4/qv4bindings.cpp @@ -256,7 +256,8 @@ void QV4Bindings::Binding::destroy() int QV4Bindings::Binding::propertyIndex() const { - return property; + //mask out the type information set for value types + return property & 0xFF00FFFF; } QObject *QV4Bindings::Binding::object() const diff --git a/src/declarative/qml/v4/qv4bindings_p.h b/src/declarative/qml/v4/qv4bindings_p.h index 58dd4328af..a447481a4c 100644 --- a/src/declarative/qml/v4/qv4bindings_p.h +++ b/src/declarative/qml/v4/qv4bindings_p.h @@ -96,6 +96,8 @@ class QV4Bindings : public QDeclarativeAbstractExpression, int index:30; bool enabled:1; bool updating:1; + // Encoding of property is coreIndex | (propType << 16) | (valueTypeIndex << 24) + // propType and valueTypeIndex are only set if the property is a value type property int property; QObject *scope; int line; From 4dde313139960d706a747d0c3260c774c3966c3d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Feb 2012 16:32:45 +1000 Subject: [PATCH 76/82] Add QColor support to v4. Change-Id: I033e92007f894d45695ea48d7f954d534a2fadee Reviewed-by: Chris Adams Reviewed-by: Matthew Vogt Reviewed-by: Martin Jones Reviewed-by: Roberto Raggi --- src/declarative/qml/v4/qv4bindings.cpp | 76 ++++++++++++++++++++ src/declarative/qml/v4/qv4compiler.cpp | 20 ++++++ src/declarative/qml/v4/qv4instruction.cpp | 9 +++ src/declarative/qml/v4/qv4instruction_p.h | 3 + src/declarative/qml/v4/qv4ir.cpp | 3 +- src/declarative/qml/v4/qv4ir_p.h | 1 + src/declarative/qml/v4/qv4irbuilder.cpp | 3 + src/declarative/qml/v4/qv4program_p.h | 1 + tests/auto/declarative/v4/data/colorType.qml | 18 +++++ tests/auto/declarative/v4/tst_v4.cpp | 18 +++++ 10 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/v4/data/colorType.qml diff --git a/src/declarative/qml/v4/qv4bindings.cpp b/src/declarative/qml/v4/qv4bindings.cpp index 319dbf51bb..ecd18cd73f 100644 --- a/src/declarative/qml/v4/qv4bindings.cpp +++ b/src/declarative/qml/v4/qv4bindings.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -86,9 +87,11 @@ struct Register { QVariant *getvariantptr() { return (QVariant *)typeDataPtr(); } QString *getstringptr() { return (QString *)typeDataPtr(); } QUrl *geturlptr() { return (QUrl *)typeDataPtr(); } + QColor *getcolorptr() { return (QColor *)typeDataPtr(); } const QVariant *getvariantptr() const { return (QVariant *)typeDataPtr(); } const QString *getstringptr() const { return (QString *)typeDataPtr(); } const QUrl *geturlptr() const { return (QUrl *)typeDataPtr(); } + const QColor *getcolorptr() const { return (QColor *)typeDataPtr(); } void *typeDataPtr() { return (void *)&data; } void *typeMemory() { return (void *)data; } @@ -112,6 +115,7 @@ struct Register { inline void cleanup(); inline void cleanupString(); inline void cleanupUrl(); + inline void cleanupColor(); inline void cleanupVariant(); inline void copy(const Register &other); @@ -135,6 +139,8 @@ void Register::cleanup() getstringptr()->~QString(); } else if (dataType == QUrlType) { geturlptr()->~QUrl(); + } else if (dataType == QColorType) { + getcolorptr()->~QColor(); } else if (dataType == QVariantType) { getvariantptr()->~QVariant(); } @@ -154,6 +160,12 @@ void Register::cleanupUrl() setUndefined(); } +void Register::cleanupColor() +{ + getcolorptr()->~QColor(); + setUndefined(); +} + void Register::cleanupVariant() { getvariantptr()->~QVariant(); @@ -168,6 +180,8 @@ void Register::copy(const Register &other) new (getstringptr()) QString(*other.getstringptr()); else if (other.dataType == QUrlType) new (geturlptr()) QUrl(*other.geturlptr()); + else if (other.dataType == QColorType) + new (getcolorptr()) QColor(*other.getcolorptr()); else if (other.dataType == QVariantType) new (getvariantptr()) QVariant(*other.getvariantptr()); } @@ -181,6 +195,8 @@ void Register::init(Type type) new (getstringptr()) QString(); else if (dataType == QUrlType) new (geturlptr()) QUrl(); + else if (dataType == QColorType) + new (getcolorptr()) QColor(); else if (dataType == QVariantType) new (getvariantptr()) QVariant(); } @@ -663,6 +679,11 @@ inline quint32 QV4Bindings::toUint32(qreal n) MARK_REGISTER(reg); \ } +#define COLOR_REGISTER(reg) { \ + registers[(reg)].settype(QColorType); \ + MARK_REGISTER(reg); \ +} + #define VARIANT_REGISTER(reg) { \ registers[(reg)].settype(QVariantType); \ MARK_REGISTER(reg); \ @@ -1023,6 +1044,27 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(ConvertStringToUrl, unaryop) + QML_V4_BEGIN_INSTR(ConvertStringToColor, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + const QString tmp(*src.getstringptr()); + if (instr->unaryop.src == instr->unaryop.output) { + output.cleanupString(); + MARK_CLEAN_REGISTER(instr->unaryop.output); + } + QColor *colorPtr = output.getcolorptr(); + new (colorPtr) QColor(QDeclarativeStringConverters::colorFromString(tmp)); + + COLOR_REGISTER(instr->unaryop.output); + } + } + QML_V4_END_INSTR(ConvertStringToUrl, unaryop) + QML_V4_BEGIN_INSTR(ConvertUrlToBool, unaryop) { const Register &src = registers[instr->unaryop.src]; @@ -1060,6 +1102,40 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(ConvertUrlToString, unaryop) + QML_V4_BEGIN_INSTR(ConvertColorToBool, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + // for compatibility with color behavior in v8, always true + output.setbool(true); + } + } + QML_V4_END_INSTR(ConvertColorToBool, unaryop) + + QML_V4_BEGIN_INSTR(ConvertColorToString, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + const QColor tmp(*src.getcolorptr()); + if (instr->unaryop.src == instr->unaryop.output) { + output.cleanupColor(); + MARK_CLEAN_REGISTER(instr->unaryop.output); + } + // to maintain behaviour with QtQuick 1.0, we just output normal toString() value. + new (output.getstringptr()) QString(QVariant(tmp).toString()); + STRING_REGISTER(instr->unaryop.output); + } + } + QML_V4_END_INSTR(ConvertColorToString, unaryop) + QML_V4_BEGIN_INSTR(ResolveUrl, unaryop) { const Register &src = registers[instr->unaryop.src]; diff --git a/src/declarative/qml/v4/qv4compiler.cpp b/src/declarative/qml/v4/qv4compiler.cpp index 29023ae66e..0a0269d903 100644 --- a/src/declarative/qml/v4/qv4compiler.cpp +++ b/src/declarative/qml/v4/qv4compiler.cpp @@ -344,6 +344,9 @@ void QV4CompilerPrivate::visitName(IR::Name *e) case QMetaType::QUrl: regType = QUrlType; break; + case QMetaType::QColor: + regType = QColorType; + break; default: if (propTy == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) { @@ -581,6 +584,12 @@ void QV4CompilerPrivate::convertToBool(IR::Expr *expr, int reg) gen(i); } return; + case IR::ColorType: { + Instr::ConvertColorToBool i; + i.output = i.src = reg; + gen(i); + } return; + default: discard(); break; @@ -880,6 +889,7 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::RealType: opcode = V4Instr::ConvertRealToBool; break; case IR::StringType: opcode = V4Instr::ConvertStringToBool; break; case IR::UrlType: opcode = V4Instr::ConvertUrlToBool; break; + case IR::ColorType: opcode = V4Instr::ConvertColorToBool; break; default: break; } // switch } else if (targetTy == IR::IntType) { @@ -908,6 +918,7 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::IntType: opcode = V4Instr::ConvertIntToString; break; case IR::RealType: opcode = V4Instr::ConvertRealToString; break; case IR::UrlType: opcode = V4Instr::ConvertUrlToString; break; + case IR::ColorType: opcode = V4Instr::ConvertColorToString; break; default: break; } // switch } else if (targetTy == IR::UrlType) { @@ -920,11 +931,17 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::BoolType: gen(V4Instr::ConvertBoolToString, convToString); sourceTy = IR::StringType; break; case IR::IntType: gen(V4Instr::ConvertIntToString, convToString); sourceTy = IR::StringType; break; case IR::RealType: gen(V4Instr::ConvertRealToString, convToString); sourceTy = IR::StringType; break; + case IR::ColorType: gen(V4Instr::ConvertColorToString, convToString); sourceTy = IR::StringType; break; default: break; } // switch if (sourceTy == IR::StringType) opcode = V4Instr::ConvertStringToUrl; + } else if (targetTy == IR::ColorType) { + switch (sourceTy) { + case IR::StringType: opcode = V4Instr::ConvertStringToColor; break; + default: break; + } // switch } if (opcode != V4Instr::Noop) { V4Instr conv; @@ -989,6 +1006,9 @@ void QV4CompilerPrivate::visitRet(IR::Ret *s) case IR::UrlType: test.regType = QMetaType::QUrl; break; + case IR::ColorType: + test.regType = QMetaType::QColor; + break; case IR::SGAnchorLineType: test.regType = QDeclarativeMetaType::QQuickAnchorLineMetaTypeId(); break; diff --git a/src/declarative/qml/v4/qv4instruction.cpp b/src/declarative/qml/v4/qv4instruction.cpp index d470b5b841..e9213f5e3f 100644 --- a/src/declarative/qml/v4/qv4instruction.cpp +++ b/src/declarative/qml/v4/qv4instruction.cpp @@ -171,12 +171,21 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::ConvertStringToUrl: INSTR_DUMP << "\t" << "ConvertStringToUrl" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::ConvertStringToColor: + INSTR_DUMP << "\t" << "ConvertStringToColor" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::ConvertUrlToBool: INSTR_DUMP << "\t" << "ConvertUrlToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; case V4Instr::ConvertUrlToString: INSTR_DUMP << "\t" << "ConvertUrlToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::ConvertColorToBool: + INSTR_DUMP << "\t" << "ConvertColorToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; + case V4Instr::ConvertColorToString: + INSTR_DUMP << "\t" << "ConvertColorToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::ResolveUrl: INSTR_DUMP << "\t" << "ResolveUrl" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; diff --git a/src/declarative/qml/v4/qv4instruction_p.h b/src/declarative/qml/v4/qv4instruction_p.h index 477a085dd7..d243d3fb9d 100644 --- a/src/declarative/qml/v4/qv4instruction_p.h +++ b/src/declarative/qml/v4/qv4instruction_p.h @@ -92,8 +92,11 @@ QT_BEGIN_NAMESPACE F(ConvertStringToInt, unaryop) \ F(ConvertStringToReal, unaryop) \ F(ConvertStringToUrl, unaryop) \ + F(ConvertStringToColor, unaryop) \ F(ConvertUrlToBool, unaryop) \ F(ConvertUrlToString, unaryop) \ + F(ConvertColorToBool, unaryop) \ + F(ConvertColorToString, unaryop) \ F(ResolveUrl, unaryop) \ F(MathSinReal, unaryop) \ F(MathCosReal, unaryop) \ diff --git a/src/declarative/qml/v4/qv4ir.cpp b/src/declarative/qml/v4/qv4ir.cpp index 149479d757..6a30e93227 100644 --- a/src/declarative/qml/v4/qv4ir.cpp +++ b/src/declarative/qml/v4/qv4ir.cpp @@ -59,6 +59,7 @@ inline const char *typeName(Type t) case VoidType: return "void"; case StringType: return "string"; case UrlType: return "url"; + case ColorType: return "color"; case SGAnchorLineType: return "SGAnchorLine"; case AttachType: return "AttachType"; case ObjectType: return "object"; @@ -77,7 +78,7 @@ inline bool isNumberType(IR::Type ty) inline bool isStringType(IR::Type ty) { - return ty == IR::StringType || ty == IR::UrlType; + return ty == IR::StringType || ty == IR::UrlType || ty == IR::ColorType; } IR::Type maxType(IR::Type left, IR::Type right) diff --git a/src/declarative/qml/v4/qv4ir_p.h b/src/declarative/qml/v4/qv4ir_p.h index 746995e5be..f6aae06f44 100644 --- a/src/declarative/qml/v4/qv4ir_p.h +++ b/src/declarative/qml/v4/qv4ir_p.h @@ -142,6 +142,7 @@ enum Type { VoidType, StringType, UrlType, + ColorType, SGAnchorLineType, AttachType, ObjectType, diff --git a/src/declarative/qml/v4/qv4irbuilder.cpp b/src/declarative/qml/v4/qv4irbuilder.cpp index 522bc01684..e9f02b0c2f 100644 --- a/src/declarative/qml/v4/qv4irbuilder.cpp +++ b/src/declarative/qml/v4/qv4irbuilder.cpp @@ -69,6 +69,9 @@ static IR::Type irTypeFromVariantType(int t, QDeclarativeEnginePrivate *engine, case QMetaType::QUrl: return IR::UrlType; + case QMetaType::QColor: + return IR::ColorType; + default: if (t == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) { return IR::SGAnchorLineType; diff --git a/src/declarative/qml/v4/qv4program_p.h b/src/declarative/qml/v4/qv4program_p.h index 1f37786307..6792ccb783 100644 --- a/src/declarative/qml/v4/qv4program_p.h +++ b/src/declarative/qml/v4/qv4program_p.h @@ -96,6 +96,7 @@ enum QDeclarativeRegisterType { QStringType = FirstCleanupType, QUrlType, QVariantType, + QColorType }; const char *QV4Program::data() const diff --git a/tests/auto/declarative/v4/data/colorType.qml b/tests/auto/declarative/v4/data/colorType.qml new file mode 100644 index 0000000000..f6a98a4a3e --- /dev/null +++ b/tests/auto/declarative/v4/data/colorType.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +QtObject { + property bool useMyColor: true + property color myColor: "red" + property color myOtherColor: "green" + + property color test1: useMyColor ? myColor : myOtherColor + property color test2: useMyColor ? "red" : "green" + property color test3: useMyColor ? myColor : "green" + + property bool test4: !myColor ? false : true + + property bool test5: myColor != "red" + property bool test6: myColor == "#ff0000" + property bool test7: myColor != "#00ff00" +} + diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp index 927dc0f082..99e3f3255f 100644 --- a/tests/auto/declarative/v4/tst_v4.cpp +++ b/tests/auto/declarative/v4/tst_v4.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -73,6 +74,7 @@ private slots: void stringComparison(); void unaryMinus(); void unaryPlus(); + void colorType(); private: QDeclarativeEngine engine; @@ -348,6 +350,22 @@ void tst_v4::unaryPlus() delete o; } +void tst_v4::colorType() +{ + QDeclarativeComponent component(&engine, testFileUrl("colorType.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").value(), QColor("red")); + QCOMPARE(o->property("test2").value(), QColor("red")); + QCOMPARE(o->property("test3").value(), QColor("red")); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toBool(), true); + QCOMPARE(o->property("test7").toBool(), true); + delete o; +} + QTEST_MAIN(tst_v4) #include "tst_v4.moc" From 3c42ca87fac3326bb86a8bb816de07223b7b2e9d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 2 Mar 2012 10:36:10 +1000 Subject: [PATCH 77/82] Treat parentless items as focus scopes The root item of a tree is implicitly a focus scope simply because it is the root of the tree. QQuickRootItem could gain the focus scope flag in order to solve this for most cases, but there would still be a possiblity of a crash for disconnected trees. Change-Id: I6e04f11df4268fb3b96660d50707d70935a5dc5e Reviewed-by: Martin Jones --- src/quick/items/qquickitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 04f4c1f801..7ca683fac3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2121,7 +2121,7 @@ QQuickItem *QQuickItemPrivate::InitializationState::getFocusScope(QQuickItem *it { if (!focusScope) { QQuickItem *fs = item->parentItem(); - while (!fs->isFocusScope()) + while (fs->parentItem() && !fs->isFocusScope()) fs = fs->parentItem(); focusScope = fs; } From 82a252afdd0f920357b1e543f2ee97f92c34919b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Mar 2012 13:45:29 +0200 Subject: [PATCH 78/82] Use velocity from touch events only when they are valid Add the capability flags to the extended mouse events. Otherwise it is not possible to tell if the velocity is valid. While the original version is fine if velocity is guaranteed to be available whenever QT_TRANSLATE_TOUCH_TO_MOUSE is set, some platform and driver combinations, e.g. the evdevtouch plugin that comes with Qt, do not provide velocity data in touch events. The touch-only mode of QML may be very useful in these cases too, we just need to fall back to the built-in velocity calculation. Change-Id: Iec5e7632a66380dc04c9435b09f5c173107bbe00 Reviewed-by: Martin Jones --- src/quick/items/qquickcanvas.cpp | 4 ++++ src/quick/items/qquickevents_p_p.h | 14 ++++++++++++-- src/quick/items/qquickflickable.cpp | 17 +++++++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index 670baa8df7..f135975b3c 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -378,6 +378,7 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonDblClick, p); me.setTimestamp(event->timestamp()); me.setAccepted(false); + me.setCapabilities(event->device()->capabilities()); if (!mouseGrabberItem) { if (deliverInitialMousePressEvent(rootItem, &me)) { touchMouseId = p.id(); @@ -394,6 +395,7 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonPress, p); me.setTimestamp(event->timestamp()); me.setAccepted(false); + me.setCapabilities(event->device()->capabilities()); deliverMouseEvent(&me); if (me.isAccepted()) { touchMouseId = p.id(); @@ -405,6 +407,7 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) if (p.state() & Qt::TouchPointMoved) { QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseMove, p); me.setTimestamp(event->timestamp()); + me.setCapabilities(event->device()->capabilities()); if (!mouseGrabberItem) { if (lastMousePosition.isNull()) lastMousePosition = me.windowPos(); @@ -428,6 +431,7 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) return; QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonRelease, p); me.setTimestamp(event->timestamp()); + me.setCapabilities(event->device()->capabilities()); deliverMouseEvent(&me); mouseGrabberItem = 0; } diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 1d13a19fed..7ff4835b4c 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -163,8 +163,11 @@ class QQuickMouseEventEx : public QMouseEvent QQuickMouseEventEx(const QMouseEvent &event) : QMouseEvent(event) { - if (extended(&event)) - setVelocity(extended(&event)->velocity()); + const QQuickMouseEventEx *eventEx = extended(&event); + if (eventEx) { + setVelocity(eventEx->velocity()); + setCapabilities(eventEx->capabilities()); + } } static const QQuickMouseEventEx *extended(const QMouseEvent *e) { @@ -186,8 +189,15 @@ class QQuickMouseEventEx : public QMouseEvent } QVector2D velocity() const { return _velocity; } + void setCapabilities(QTouchDevice::Capabilities caps) { + setExtended(); + _capabilities = caps; + } + QTouchDevice::Capabilities capabilities() const { return _capabilities; } + private: QVector2D _velocity; + QTouchDevice::Capabilities _capabilities; }; diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 43aaf92b1a..0e8097af15 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -975,7 +975,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) lastPosTime = currentTimestamp; QQuickMouseEventEx *extended = QQuickMouseEventEx::extended(event); if (q->yflick() && !rejectY) { - if (extended) { + if (extended && extended->capabilities().testFlag(QTouchDevice::Velocity)) { vData.addVelocitySample(extended->velocity().y(), maxVelocity); } else { qreal dy = event->localPos().y()-lastPos.y(); @@ -983,7 +983,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } } if (q->xflick() && !rejectX) { - if (extended) { + if (extended && extended->capabilities().testFlag(QTouchDevice::Velocity)) { hData.addVelocitySample(extended->velocity().x(), maxVelocity); } else { qreal dx = event->localPos().x()-lastPos.x(); @@ -1020,7 +1020,8 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) qreal vVelocity = 0; if (elapsed < 100 && vData.velocity != 0.) { QQuickMouseEventEx *extended = QQuickMouseEventEx::extended(event); - vVelocity = extended ? extended->velocity().y() : vData.velocity; + vVelocity = (extended && extended->capabilities().testFlag(QTouchDevice::Velocity)) + ? extended->velocity().y() : vData.velocity; } if (vData.atBeginning || vData.atEnd) { vVelocity /= 2; @@ -1035,7 +1036,8 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) qreal hVelocity = 0; if (elapsed < 100 && hData.velocity != 0.) { QQuickMouseEventEx *extended = QQuickMouseEventEx::extended(event); - hVelocity = extended ? extended->velocity().x() : hData.velocity; + hVelocity = (extended && extended->capabilities().testFlag(QTouchDevice::Velocity)) + ? extended->velocity().x() : hData.velocity; } if (hData.atBeginning || hData.atEnd) { hVelocity /= 2; @@ -1769,8 +1771,11 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event) QQuickMouseEventEx mouseEvent(event->type(), mapFromScene(event->windowPos()), event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); - if (QQuickMouseEventEx::extended(event)) - mouseEvent.setVelocity(QQuickMouseEventEx::extended(event)->velocity()); + QQuickMouseEventEx *eventEx = QQuickMouseEventEx::extended(event); + if (eventEx) { + mouseEvent.setVelocity(eventEx->velocity()); + mouseEvent.setCapabilities(eventEx->capabilities()); + } mouseEvent.setTimestamp(event->timestamp()); mouseEvent.setAccepted(false); From cc462d6a161b453e57523e71cd5d11deb4840f21 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 28 Feb 2012 12:00:26 +1000 Subject: [PATCH 79/82] Use view transitions in drag'n'drop example Change-Id: Idc661225acf9e517d26928cafba650ac48ca880a Reviewed-by: Andrew den Exter --- examples/qtquick/draganddrop/views/gridview.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/qtquick/draganddrop/views/gridview.qml b/examples/qtquick/draganddrop/views/gridview.qml index 04d8dee463..b18078f48d 100644 --- a/examples/qtquick/draganddrop/views/gridview.qml +++ b/examples/qtquick/draganddrop/views/gridview.qml @@ -45,6 +45,10 @@ GridView { width: 320; height: 480 cellWidth: 80; cellHeight: 80 + displaced: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } + } + model: VisualDataModel { id: visualModel model: ListModel { @@ -93,7 +97,7 @@ GridView { color: model.color radius: 3 - Drag.active: delegateRoot.pressed + Drag.active: delegateRoot.drag.active Drag.source: delegateRoot Drag.hotSpot.x: 36 Drag.hotSpot.y: 36 From d290cb3a499a0c3a71ab1f63cbd2fc45b0f5835f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 27 Feb 2012 16:26:05 +1000 Subject: [PATCH 80/82] Fix when animating items that are already moving The view must transition displaced/moved items that are currently transitioning to another position; check against the current transition-to position, not just the current item position. Task-number: QTBUG-24522 Change-Id: Icf1c290f76ceb8c93716f1562ae0bc5a75445b78 Reviewed-by: Martin Jones --- src/quick/items/qquickitemviewtransition.cpp | 20 +++++++++--- src/quick/items/qquickitemviewtransition_p.h | 1 + .../data/multipleTransitions.qml | 28 +++++++++++++++- .../qquickgridview/tst_qquickgridview.cpp | 32 ++++++++++++++++--- .../data/multipleTransitions.qml | 27 ++++++++++++++++ .../qquicklistview/tst_qquicklistview.cpp | 28 +++++++++++++--- 6 files changed, 121 insertions(+), 15 deletions(-) diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index abff768ad3..3febc9b113 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -383,6 +383,9 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) if (nextTransitionType != QQuickItemViewTransitioner::NoTransition && !nextTransitionToSet) moveTo(item->pos()); + // For move transitions (both target and displaced) and displaced transitions of other + // types, only run the transition if the item is actually moving to another position. + switch (nextTransitionType) { case QQuickItemViewTransitioner::NoTransition: { @@ -394,14 +397,14 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) } case QQuickItemViewTransitioner::AddTransition: case QQuickItemViewTransitioner::RemoveTransition: - // For Add targets, do transition if item is moving into visible area - // For Remove targets, do transition if item is currently in visible area if (viewBounds.isNull()) { if (isTransitionTarget) doTransition = true; else - doTransition = (nextTransitionTo != item->pos()); + doTransition = transitionWillChangePosition(); } else if (isTransitionTarget) { + // For Add targets, do transition if item is moving into visible area + // For Remove targets, do transition if item is currently in visible area doTransition = (nextTransitionType == QQuickItemViewTransitioner::AddTransition) ? viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())) : viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())); @@ -410,7 +413,7 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) } else { if (viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height()))) { - doTransition = (nextTransitionTo != item->pos()); + doTransition = transitionWillChangePosition(); } else { item->setPos(nextTransitionTo); } @@ -418,7 +421,7 @@ bool QQuickViewItem::prepareTransition(const QRectF &viewBounds) break; case QQuickItemViewTransitioner::MoveTransition: // do transition if moving from or into visible area - if (nextTransitionTo != item->pos()) { + if (transitionWillChangePosition()) { doTransition = viewBounds.isNull() || viewBounds.intersects(QRectF(item->x(), item->y(), item->width(), item->height())) || viewBounds.intersects(QRectF(nextTransitionTo.x(), nextTransitionTo.y(), item->width(), item->height())); @@ -472,6 +475,13 @@ void QQuickViewItem::setNextTransition(QQuickItemViewTransitioner::TransitionTyp isTransitionTarget = isTargetItem; } +bool QQuickViewItem::transitionWillChangePosition() const +{ + if (transitionRunning() && transition->m_toPos != nextTransitionTo) + return true; + return nextTransitionTo != item->pos(); +} + void QQuickViewItem::finishedTransition() { nextTransitionToSet = false; diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index 1ebc52c185..57ea85bae6 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -152,6 +152,7 @@ class QQuickViewItem friend class QQuickItemViewTransitioner; friend class QQuickItemViewTransitionJob; void setNextTransition(QQuickItemViewTransitioner::TransitionType, bool isTargetItem); + bool transitionWillChangePosition() const; void finishedTransition(); void resetTransitionData(); }; diff --git a/tests/auto/qtquick2/qquickgridview/data/multipleTransitions.qml b/tests/auto/qtquick2/qquickgridview/data/multipleTransitions.qml index 45b86e22cf..909ec3a0b7 100644 --- a/tests/auto/qtquick2/qquickgridview/data/multipleTransitions.qml +++ b/tests/auto/qtquick2/qquickgridview/data/multipleTransitions.qml @@ -10,7 +10,7 @@ Rectangle { // interrupting transitions will still produce the correct result) property int timeBetweenActions: duration / 2 - property int duration: 100 + property int duration: 300 property int count: grid.count @@ -46,6 +46,8 @@ Rectangle { property bool runningAddDisplaced: false property bool runningMoveTargets: false property bool runningMoveDisplaced: false + property bool runningRemoveTargets: false + property bool runningRemoveDisplaced: false objectName: "grid" width: 240 @@ -103,6 +105,30 @@ Rectangle { ScriptAction { script: grid.runningMoveDisplaced = false } } } + + remove: Transition { + id: removeTargets + SequentialAnimation { + ScriptAction { script: grid.runningRemoveTargets = true } + ParallelAnimation { + NumberAnimation { properties: "x"; to: removeTargets_transitionTo.x; duration: root.duration } + NumberAnimation { properties: "y"; to: removeTargets_transitionTo.y; duration: root.duration } + } + ScriptAction { script: grid.runningRemoveTargets = false } + } + } + + removeDisplaced: Transition { + id: removeDisplaced + SequentialAnimation { + ScriptAction { script: grid.runningRemoveDisplaced = true } + ParallelAnimation { + NumberAnimation { properties: "x"; from: removeDisplaced_transitionFrom.x; duration: root.duration } + NumberAnimation { properties: "y"; from: removeDisplaced_transitionFrom.y; duration: root.duration } + } + ScriptAction { script: grid.runningRemoveDisplaced = false } + } + } } Rectangle { diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp index 6d755a64c7..077cd2b26a 100644 --- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp @@ -4776,12 +4776,15 @@ void tst_QQuickGridView::multipleTransitions() QFETCH(int, initialCount); QFETCH(qreal, contentY); QFETCH(QList, changes); + QFETCH(bool, rippleAddDisplaced); // add transitions on the left, moves on the right QPointF addTargets_transitionFrom(-50, -50); QPointF addDisplaced_transitionFrom(-50, 50); QPointF moveTargets_transitionFrom(50, -50); QPointF moveDisplaced_transitionFrom(50, 50); + QPointF removeTargets_transitionTo(-100, 300); + QPointF removeDisplaced_transitionFrom(100, 300); QmlListModel model; for (int i = 0; i < initialCount; i++) @@ -4794,8 +4797,12 @@ void tst_QQuickGridView::multipleTransitions() ctxt->setContextProperty("addDisplaced_transitionFrom", addDisplaced_transitionFrom); ctxt->setContextProperty("moveTargets_transitionFrom", moveTargets_transitionFrom); ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom); + ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo); + ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom); + ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced); canvas->setSource(testFileUrl("multipleTransitions.qml")); canvas->show(); + QTest::qWaitForWindowShown(canvas); QQuickGridView *gridview = findItem(canvas->rootObject(), "grid"); QTRY_VERIFY(gridview != 0); @@ -4803,6 +4810,11 @@ void tst_QQuickGridView::multipleTransitions() QVERIFY(contentItem != 0); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + if (contentY != 0) { + gridview->setContentY(contentY); + QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); + } + int timeBetweenActions = canvas->rootObject()->property("timeBetweenActions").toInt(); QList > targetItems; @@ -4894,18 +4906,21 @@ void tst_QQuickGridView::multipleTransitions_data() QTest::addColumn("initialCount"); QTest::addColumn("contentY"); QTest::addColumn >("changes"); + QTest::addColumn("rippleAddDisplaced"); // the added item and displaced items should move to final dest correctly QTest::newRow("add item, then move it immediately") << 10 << 0.0 << (QList() - << ListChange::insert(0, 1) - << ListChange::move(0, 3, 1) - ); + << ListChange::insert(0, 1) + << ListChange::move(0, 3, 1) + ) + << false; // items affected by the add should change from move to add transition QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList() << ListChange::move(1, 10, 3) << ListChange::insert(0, 1) - ); + ) + << false; // items should be placed correctly if you trigger a transition then refill for that index QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList() @@ -4913,7 +4928,14 @@ void tst_QQuickGridView::multipleTransitions_data() << ListChange::setContentY(160.0) << ListChange::setContentY(0.0) << ListChange::insert(0, 1) - ); + ) + << false; + + QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList() + << ListChange::insert(1, 1) + << ListChange::remove(1, 1) + ) + << true; } void tst_QQuickGridView::cacheBuffer() diff --git a/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml b/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml index 3e3248535b..8264b42b64 100644 --- a/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml +++ b/tests/auto/qtquick2/qquicklistview/data/multipleTransitions.qml @@ -45,6 +45,8 @@ Rectangle { property bool runningAddDisplaced: false property bool runningMoveTargets: false property bool runningMoveDisplaced: false + property bool runningRemoveTargets: false + property bool runningRemoveDisplaced: false objectName: "list" focus: true @@ -70,6 +72,7 @@ Rectangle { id: addDisplaced SequentialAnimation { ScriptAction { script: list.runningAddDisplaced = true } + PauseAnimation { duration: rippleAddDisplaced ? addDisplaced.ViewTransition.index * root.duration/10 : 0 } ParallelAnimation { NumberAnimation { properties: "x"; from: addDisplaced_transitionFrom.x; duration: root.duration } NumberAnimation { properties: "y"; from: addDisplaced_transitionFrom.y; duration: root.duration } @@ -101,6 +104,30 @@ Rectangle { ScriptAction { script: list.runningMoveDisplaced = false } } } + + remove: Transition { + id: removeTargets + SequentialAnimation { + ScriptAction { script: list.runningRemoveTargets = true } + ParallelAnimation { + NumberAnimation { properties: "x"; to: removeTargets_transitionTo.x; duration: root.duration } + NumberAnimation { properties: "y"; to: removeTargets_transitionTo.y; duration: root.duration } + } + ScriptAction { script: list.runningRemoveTargets = false } + } + } + + removeDisplaced: Transition { + id: removeDisplaced + SequentialAnimation { + ScriptAction { script: list.runningRemoveDisplaced = true } + ParallelAnimation { + NumberAnimation { properties: "x"; from: removeDisplaced_transitionFrom.x; duration: root.duration } + NumberAnimation { properties: "y"; from: removeDisplaced_transitionFrom.y; duration: root.duration } + } + ScriptAction { script: list.runningRemoveDisplaced = false } + } + } } Rectangle { diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp index a834f1aa03..8f1527fa36 100644 --- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp @@ -5787,12 +5787,14 @@ void tst_QQuickListView::multipleTransitions() QFETCH(int, initialCount); QFETCH(qreal, contentY); QFETCH(QList, changes); + QFETCH(bool, rippleAddDisplaced); - // add transitions on the left, moves on the right QPointF addTargets_transitionFrom(-50, -50); QPointF addDisplaced_transitionFrom(-50, 50); QPointF moveTargets_transitionFrom(50, -50); QPointF moveDisplaced_transitionFrom(50, 50); + QPointF removeTargets_transitionTo(-100, 300); + QPointF removeDisplaced_transitionFrom(100, 300); QmlListModel model; for (int i = 0; i < initialCount; i++) @@ -5807,6 +5809,9 @@ void tst_QQuickListView::multipleTransitions() ctxt->setContextProperty("addDisplaced_transitionFrom", addDisplaced_transitionFrom); ctxt->setContextProperty("moveTargets_transitionFrom", moveTargets_transitionFrom); ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom); + ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo); + ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom); + ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced); canvas->setSource(testFileUrl("multipleTransitions.qml")); canvas->show(); QTest::qWaitForWindowShown(canvas); @@ -5817,6 +5822,11 @@ void tst_QQuickListView::multipleTransitions() QVERIFY(contentItem != 0); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + if (contentY != 0) { + listview->setContentY(contentY); + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + } + int timeBetweenActions = canvas->rootObject()->property("timeBetweenActions").toInt(); QList > targetItems; @@ -5897,18 +5907,21 @@ void tst_QQuickListView::multipleTransitions_data() QTest::addColumn("initialCount"); QTest::addColumn("contentY"); QTest::addColumn >("changes"); + QTest::addColumn("rippleAddDisplaced"); // the added item and displaced items should move to final dest correctly QTest::newRow("add item, then move it immediately") << 10 << 0.0 << (QList() << ListChange::insert(0, 1) << ListChange::move(0, 3, 1) - ); + ) + << false; // items affected by the add should change from move to add transition QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList() << ListChange::move(1, 10, 3) << ListChange::insert(0, 1) - ); + ) + << false; // items should be placed correctly if you trigger a transition then refill for that index QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList() @@ -5916,7 +5929,14 @@ void tst_QQuickListView::multipleTransitions_data() << ListChange::setContentY(80.0) << ListChange::setContentY(0.0) << ListChange::insert(0, 1) - ); + ) + << false; + + QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList() + << ListChange::insert(1, 1) + << ListChange::remove(1, 1) + ) + << true; } QList tst_QQuickListView::toIntList(const QVariantList &list) From 181545935323c74c2ec9c5a89ff51606008e30c0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 29 Feb 2012 14:59:49 +0100 Subject: [PATCH 81/82] Profiler: Use RAII helper structs for ranges Exclusively use RAII helper structs for ranges. Change-Id: Ief9ab25a9e49e1b2c3c091e5d9de6479e36eaa50 Reviewed-by: Christiaan Janssen --- .../debugger/qdeclarativeprofilerservice.cpp | 57 ++----- .../debugger/qdeclarativeprofilerservice_p.h | 156 ++++++++++++++++-- .../qml/qdeclarativeboundsignal.cpp | 15 +- src/declarative/qml/qdeclarativecomponent.cpp | 21 +-- src/declarative/qml/qdeclarativecomponent_p.h | 4 +- src/declarative/qml/qdeclarativeengine.cpp | 11 +- .../qml/qdeclarativetypeloader.cpp | 6 +- .../qdeclarativeprofilerservice.pro | 2 +- 8 files changed, 180 insertions(+), 92 deletions(-) diff --git a/src/declarative/debugger/qdeclarativeprofilerservice.cpp b/src/declarative/debugger/qdeclarativeprofilerservice.cpp index 074355fe97..3ad87495bb 100644 --- a/src/declarative/debugger/qdeclarativeprofilerservice.cpp +++ b/src/declarative/debugger/qdeclarativeprofilerservice.cpp @@ -52,23 +52,10 @@ QT_BEGIN_NAMESPACE +// instance will be set, unset in constructor. Allows static methods to be inlined. +QDeclarativeProfilerService *QDeclarativeProfilerService::instance = 0; Q_GLOBAL_STATIC(QDeclarativeProfilerService, profilerInstance) -QDeclarativeBindingProfiler::QDeclarativeBindingProfiler(const QString &url, int line, int column) -{ - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::Binding); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Binding, url, line, column); -} - -QDeclarativeBindingProfiler::~QDeclarativeBindingProfiler() -{ - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::Binding); -} - -void QDeclarativeBindingProfiler::addDetail(const QString &details) -{ - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Binding, details); -} // convert to a QByteArray that can be sent to the debug client // use of QDataStream can skew results @@ -106,12 +93,13 @@ QDeclarativeProfilerService::QDeclarativeProfilerService() QDeclarativeProfilerService::~QDeclarativeProfilerService() { + instance = 0; } void QDeclarativeProfilerService::initialize() { // just make sure that the service is properly registered - profilerInstance(); + instance = profilerInstance(); } bool QDeclarativeProfilerService::startProfiling() @@ -134,31 +122,6 @@ void QDeclarativeProfilerService::addEvent(EventType t) profilerInstance()->addEventImpl(t); } -void QDeclarativeProfilerService::startRange(RangeType t) -{ - profilerInstance()->startRangeImpl(t); -} - -void QDeclarativeProfilerService::rangeData(RangeType t, const QString &data) -{ - profilerInstance()->rangeDataImpl(t, data); -} - -void QDeclarativeProfilerService::rangeLocation(RangeType t, const QString &fileName, int line, int column) -{ - profilerInstance()->rangeLocationImpl(t, fileName, line, column); -} - -void QDeclarativeProfilerService::rangeLocation(RangeType t, const QUrl &fileName, int line, int column) -{ - profilerInstance()->rangeLocationImpl(t, fileName, line, column); -} - -void QDeclarativeProfilerService::endRange(RangeType t) -{ - profilerInstance()->endRangeImpl(t); -} - void QDeclarativeProfilerService::animationFrame(qint64 delta) { profilerInstance()->animationFrameImpl(delta); @@ -209,7 +172,7 @@ void QDeclarativeProfilerService::addEventImpl(EventType event) processMessage(ed); } -void QDeclarativeProfilerService::startRangeImpl(RangeType range) +void QDeclarativeProfilerService::startRange(RangeType range) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -218,7 +181,7 @@ void QDeclarativeProfilerService::startRangeImpl(RangeType range) processMessage(rd); } -void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QString &rData) +void QDeclarativeProfilerService::rangeData(RangeType range, const QString &rData) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -227,7 +190,7 @@ void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QString & processMessage(rd); } -void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QUrl &rData) +void QDeclarativeProfilerService::rangeData(RangeType range, const QUrl &rData) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -236,7 +199,7 @@ void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QUrl &rDa processMessage(rd); } -void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QString &fileName, int line, int column) +void QDeclarativeProfilerService::rangeLocation(RangeType range, const QString &fileName, int line, int column) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -245,7 +208,7 @@ void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QStri processMessage(rd); } -void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QUrl &fileName, int line, int column) +void QDeclarativeProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -254,7 +217,7 @@ void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QUrl processMessage(rd); } -void QDeclarativeProfilerService::endRangeImpl(RangeType range) +void QDeclarativeProfilerService::endRange(RangeType range) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; diff --git a/src/declarative/debugger/qdeclarativeprofilerservice_p.h b/src/declarative/debugger/qdeclarativeprofilerservice_p.h index d2f263cca6..ef92e6800e 100644 --- a/src/declarative/debugger/qdeclarativeprofilerservice_p.h +++ b/src/declarative/debugger/qdeclarativeprofilerservice_p.h @@ -57,6 +57,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -83,13 +84,6 @@ Q_DECLARE_TYPEINFO(QDeclarativeProfilerData, Q_MOVABLE_TYPE); class QUrl; class QDeclarativeEngine; -// RAII -class Q_AUTOTEST_EXPORT QDeclarativeBindingProfiler { -public: - QDeclarativeBindingProfiler(const QString &url, int line, int column); - ~QDeclarativeBindingProfiler(); - void addDetail(const QString &details); -}; class Q_DECLARATIVE_EXPORT QDeclarativeProfilerService : public QDeclarativeDebugService { @@ -132,11 +126,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeProfilerService : public QDeclarativeDebu static bool stopProfiling(); static void sendStartedProfilingMessage(); static void addEvent(EventType); - static void startRange(RangeType); - static void rangeData(RangeType, const QString &); - static void rangeLocation(RangeType, const QString &, int, int); - static void rangeLocation(RangeType, const QUrl &, int, int); - static void endRange(RangeType); static void animationFrame(qint64); static void sendProfilingData(); @@ -153,14 +142,16 @@ class Q_DECLARATIVE_EXPORT QDeclarativeProfilerService : public QDeclarativeDebu bool stopProfilingImpl(); void sendStartedProfilingMessageImpl(); void addEventImpl(EventType); - void startRangeImpl(RangeType); - void rangeDataImpl(RangeType, const QString &); - void rangeDataImpl(RangeType, const QUrl &); - void rangeLocationImpl(RangeType, const QString &, int, int); - void rangeLocationImpl(RangeType, const QUrl &, int, int); - void endRangeImpl(RangeType); void animationFrameImpl(qint64); + void startRange(RangeType); + void rangeData(RangeType, const QString &); + void rangeData(RangeType, const QUrl &); + void rangeLocation(RangeType, const QString &, int, int); + void rangeLocation(RangeType, const QUrl &, int, int); + void endRange(RangeType); + + bool profilingEnabled(); void setProfilingEnabled(bool enable); void sendMessages(); @@ -172,6 +163,135 @@ class Q_DECLARATIVE_EXPORT QDeclarativeProfilerService : public QDeclarativeDebu bool m_messageReceived; QVector m_data; QMutex m_mutex; + + static QDeclarativeProfilerService *instance; + + friend struct QDeclarativeBindingProfiler; + friend struct QDeclarativeHandlingSignalProfiler; + friend struct QDeclarativeObjectCreatingProfiler; + friend struct QDeclarativeCompilingProfiler; +}; + +// +// RAII helper structs +// + +struct QDeclarativeBindingProfiler { + QDeclarativeBindingProfiler(const QString &url, int line, int column) + { + QDeclarativeProfilerService *instance = QDeclarativeProfilerService::instance; + enabled = instance ? instance->profilingEnabled() : false; + if (enabled) { + instance->startRange(QDeclarativeProfilerService::Binding); + instance->rangeLocation(QDeclarativeProfilerService::Binding, url, line, column); + } + } + + ~QDeclarativeBindingProfiler() + { + if (enabled) + QDeclarativeProfilerService::instance->endRange(QDeclarativeProfilerService::Binding); + } + + void addDetail(const QString &details) + { + if (enabled) + QDeclarativeProfilerService::instance->rangeData(QDeclarativeProfilerService::Binding, + details); + } +\ + bool enabled; +}; + +struct QDeclarativeHandlingSignalProfiler { + QDeclarativeHandlingSignalProfiler() + { + enabled = QDeclarativeProfilerService::instance + ? QDeclarativeProfilerService::instance->profilingEnabled() : false; + if (enabled) { + QDeclarativeProfilerService::instance->startRange( + QDeclarativeProfilerService::HandlingSignal); + } + } + + void setSignalInfo(const QString &name, const QString &expression) + { + if (enabled) + QDeclarativeProfilerService::instance->rangeData( + QDeclarativeProfilerService::HandlingSignal, + name % QLatin1String(": ") % expression); + } + + void setLocation(const QString &file, int line, int column) + { + if (enabled) + QDeclarativeProfilerService::instance->rangeLocation( + QDeclarativeProfilerService::HandlingSignal, file, line, column); + } + + ~QDeclarativeHandlingSignalProfiler() + { + if (enabled) + QDeclarativeProfilerService::instance->endRange( + QDeclarativeProfilerService::HandlingSignal); + } + + bool enabled; +}; + +struct QDeclarativeObjectCreatingProfiler { + QDeclarativeObjectCreatingProfiler() + { + QDeclarativeProfilerService *instance = QDeclarativeProfilerService::instance; + enabled = instance ? + instance->profilingEnabled() : false; + if (enabled) + instance->startRange(QDeclarativeProfilerService::Creating); + } + + void setTypeName(const QString &typeName) + { + if (enabled) + QDeclarativeProfilerService::instance->rangeData( + QDeclarativeProfilerService::Creating, typeName); + } + + void setLocation(const QUrl &url, int line, int column) + { + if (enabled) + QDeclarativeProfilerService::instance->rangeLocation( + QDeclarativeProfilerService::Creating, url, line, column); + } + + ~QDeclarativeObjectCreatingProfiler() + { + if (enabled) + QDeclarativeProfilerService::instance->endRange(QDeclarativeProfilerService::Creating); + } + + bool enabled; +}; + +struct QDeclarativeCompilingProfiler { + QDeclarativeCompilingProfiler(const QString &name) + { + QDeclarativeProfilerService *instance = QDeclarativeProfilerService::instance; + enabled = instance ? + instance->profilingEnabled() : false; + if (enabled) { + instance->startRange(QDeclarativeProfilerService::Compiling); + instance->rangeLocation(QDeclarativeProfilerService::Compiling, name, 1, 1); + instance->rangeData(QDeclarativeProfilerService::Compiling, name); + } + } + + ~QDeclarativeCompilingProfiler() + { + if (enabled) + QDeclarativeProfilerService::instance->endRange(QDeclarativeProfilerService::Compiling); + } + + bool enabled; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 5d1c28b095..bf96f03016 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -170,12 +170,18 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { if (!m_expression) return -1; - if (QDeclarativeDebugService::isDebuggingEnabled()) { - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::HandlingSignal); - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::HandlingSignal, QLatin1String(m_signal.signature()) % QLatin1String(": ") % m_expression->expression()); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::HandlingSignal, m_expression->sourceFile(), m_expression->lineNumber(), m_expression->columnNumber()); + + if (QDeclarativeDebugService::isDebuggingEnabled()) QV8DebugService::instance()->signalEmitted(QString::fromAscii(m_signal.signature())); + + QDeclarativeHandlingSignalProfiler prof; + if (prof.enabled) { + prof.setSignalInfo(QString::fromLatin1(m_signal.signature()), + m_expression->expression()); + prof.setLocation(m_expression->sourceFile(), m_expression->lineNumber(), + m_expression->columnNumber()); } + m_isEvaluating = true; if (!m_paramsValid) { if (!m_signal.parameterTypes().isEmpty()) @@ -191,7 +197,6 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } if (m_params) m_params->clearValues(); m_isEvaluating = false; - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::HandlingSignal); return -1; } else { return QObject::qt_metacall(c, id, a); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index c168c8f4eb..57c30748f3 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -739,14 +739,15 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context) QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); - bool isRoot = enginePriv->inProgressCreations == 0; + if (enginePriv->inProgressCreations == 0) { + // only track root, since further ones might not be properly nested + profiler = new QDeclarativeObjectCreatingProfiler(); + } + enginePriv->inProgressCreations++; state.errors.clear(); state.completePending = true; - if (isRoot) - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::Creating); - enginePriv->referenceScarceResources(); state.vme.init(context, cc, start, creationContext); QObject *rv = state.vme.execute(&state.errors); @@ -762,13 +763,12 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context) if (!context->isInternal) context->asQDeclarativeContextPrivate()->instances.append(rv); QDeclarativeEngineDebugService::instance()->objectCreated(engine, rv); - if (isRoot) { - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Creating, - buildTypeNameForDebug(rv->metaObject())); + + if (profiler && profiler->enabled) { + profiler->setTypeName(buildTypeNameForDebug(rv->metaObject())); QDeclarativeData *data = QDeclarativeData::get(rv); Q_ASSERT(data); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Creating, - cc->url, data->lineNumber, data->columnNumber); + profiler->setLocation(cc->url, data->lineNumber, data->columnNumber); } } @@ -824,7 +824,8 @@ void QDeclarativeComponentPrivate::completeCreate() QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); complete(ep, &state); - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::Creating); + delete profiler; + profiler = 0; } } diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index 2a237366d8..6824bd2927 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -62,6 +62,7 @@ #include "qdeclarativevme_p.h" #include "qdeclarativeerror.h" #include "qdeclarative.h" +#include "../debugger/qdeclarativeprofilerservice_p.h" #include #include @@ -83,7 +84,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeComponentPrivate : public QObject Q_DECLARE_PUBLIC(QDeclarativeComponent) public: - QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), cc(0), engine(0), creationContext(0) {} + QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), cc(0), engine(0), creationContext(0), profiler(0) {} QObject *beginCreate(QDeclarativeContextData *); void completeCreate(); @@ -116,6 +117,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeComponentPrivate : public QObject QDeclarativeEngine *engine; QDeclarativeGuardedContextData creationContext; + QDeclarativeObjectCreatingProfiler *profiler; void clear(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index dca0ef2faf..963bec57b5 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -966,13 +966,13 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) QDeclarativeData *data = QDeclarativeData::get(object); if (data && data->deferredComponent) { - if (QDeclarativeDebugService::isDebuggingEnabled()) { - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::Creating); + QDeclarativeObjectCreatingProfiler prof; + if (prof.enabled) { QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject()); - QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(object->metaObject()->className()); - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Creating, typeName); + prof.setTypeName(type ? type->qmlTypeName() + : QString::fromUtf8(object->metaObject()->className())); if (data->outerContext) - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Creating, data->outerContext->url, data->lineNumber, data->columnNumber); + prof.setLocation(data->outerContext->url, data->lineNumber, data->columnNumber); } QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine); @@ -983,7 +983,6 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) data->deferredComponent = 0; QDeclarativeComponentPrivate::complete(ep, &state); - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::Creating); } } diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index a07e4fb04b..92dac182c7 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -1578,13 +1578,12 @@ void QDeclarativeTypeData::downloadProgressChanged(qreal p) void QDeclarativeTypeData::compile() { Q_ASSERT(m_compiledData == 0); - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::Compiling); m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); m_compiledData->url = finalUrl(); m_compiledData->name = finalUrlString(); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Compiling, m_compiledData->name,1,1); - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Compiling, m_compiledData->name); + + QDeclarativeCompilingProfiler prof(m_compiledData->name); QDeclarativeCompiler compiler(&scriptParser._pool); if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { @@ -1592,7 +1591,6 @@ void QDeclarativeTypeData::compile() m_compiledData->release(); m_compiledData = 0; } - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::Compiling); } void QDeclarativeTypeData::resolveTypes() diff --git a/tests/auto/declarative/debugger/qdeclarativeprofilerservice/qdeclarativeprofilerservice.pro b/tests/auto/declarative/debugger/qdeclarativeprofilerservice/qdeclarativeprofilerservice.pro index 564945faf7..52139bf569 100644 --- a/tests/auto/declarative/debugger/qdeclarativeprofilerservice/qdeclarativeprofilerservice.pro +++ b/tests/auto/declarative/debugger/qdeclarativeprofilerservice/qdeclarativeprofilerservice.pro @@ -12,4 +12,4 @@ include (../../../shared/util.pri) CONFIG += parallel_test declarative_debug -QT += declarative-private testlib +QT += core-private v8-private declarative-private testlib From 36bd7f616f37f5f60e59bce1f0d8970248d627de Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 29 Feb 2012 10:10:11 +1000 Subject: [PATCH 82/82] More documentation about importing LocalStorage module from Javascript Task-number:QTBUG-24478 Change-Id: Iad0fe15e8b2f1fcfa82b1654c3fd606d08563457 Reviewed-by: Martin Jones --- doc/src/localstorage/localstorage.qdoc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/src/localstorage/localstorage.qdoc b/doc/src/localstorage/localstorage.qdoc index bee491f9b9..7f4c2b021e 100644 --- a/doc/src/localstorage/localstorage.qdoc +++ b/doc/src/localstorage/localstorage.qdoc @@ -33,9 +33,24 @@ The local storage API provides a JavaScript interface to an SQL relational database. The QtQuick.LocalStorage module contains the API and it may be given a namespace. +Import QtQuick.LocalStorage module from QML: \code -import QtQuick.LocalStorage 2.0 as SQL +//sql.qml + +import QtQuick.LocalStorage 2.0 as Sql +\endcode + + +Import QtQuick.LocalStorage module from JavaScript: +\code +//sql.js +.import QtQuick.LocalStorage 2.0 as Sql \endcode + +Note, importing a module from JavaScript is different from importing from QML. +The \l{JavaScript Code} article contains detailed information on importing in JavaScript code. + + \section2 Database API The \c openDatabaseSync() and related functions