diff options
Diffstat (limited to 'src')
71 files changed, 397 insertions, 250 deletions
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index 12ea9334f8..e5381629cc 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -880,7 +880,7 @@ Module { values: { "XAxis": 1, "YAxis": 2, - "XandYAxis": 3 + "XAndYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -2337,7 +2337,7 @@ Module { "NoDrag": 0, "XAxis": 1, "YAxis": 2, - "XandYAxis": 3 + "XAndYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } diff --git a/src/particles/particles.pro b/src/particles/particles.pro index de855faf8a..632856ccca 100644 --- a/src/particles/particles.pro +++ b/src/particles/particles.pro @@ -1,6 +1,6 @@ TARGET = QtQuickParticles -CONFIG += dll warn_on internal_module +CONFIG += internal_module QT = core-private gui-private qml-private quick-private QT_PRIVATE = v8-private diff --git a/src/plugins/accessible/quick/main.cpp b/src/plugins/accessible/quick/main.cpp index 882cbcda4f..cac5d7e58d 100644 --- a/src/plugins/accessible/quick/main.cpp +++ b/src/plugins/accessible/quick/main.cpp @@ -92,22 +92,7 @@ QAccessibleInterface *AccessibleQuickFactory::create(const QString &classname, Q QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); if (!itemPrivate->isAccessible) return 0; - - QVariant v = QQuickAccessibleAttached::property(item, "role"); - bool ok; - QAccessible::Role role = (QAccessible::Role)v.toInt(&ok); - if (!ok) // Not sure if this check is needed. - return new QAccessibleQuickItem(item); - - switch (role) { - case QAccessible::Slider: - case QAccessible::SpinBox: - case QAccessible::Dial: - case QAccessible::ScrollBar: - return new QAccessibleQuickItemValueInterface(item); - default: - return new QAccessibleQuickItem(item); - } + return new QAccessibleQuickItem(item); } return 0; diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp index 2d41379940..8d36834d48 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp @@ -228,7 +228,7 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const break; } - // the following blocks handles item-specific behavior + // the following block handles item-specific behavior if (role() == QAccessible::EditableText) { if (textType == QAccessible::Value) { QVariant text = object()->property("text"); @@ -241,34 +241,44 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const return QString(); } -void *QAccessibleQuickItemValueInterface::interface_cast(QAccessible::InterfaceType t) +void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t) { - if (t == QAccessible::ValueInterface) + QAccessible::Role r = role(); + if (t == QAccessible::ValueInterface && + (r == QAccessible::Slider || + r == QAccessible::SpinBox || + r == QAccessible::Dial || + r == QAccessible::ScrollBar)) return static_cast<QAccessibleValueInterface*>(this); - return QAccessibleQuickItem::interface_cast(t); + + if (t == QAccessible::TextInterface && + (r == QAccessible::EditableText)) + return static_cast<QAccessibleTextInterface*>(this); + + return QQmlAccessible::interface_cast(t); } -QVariant QAccessibleQuickItemValueInterface::currentValue() const +QVariant QAccessibleQuickItem::currentValue() const { return item()->property("value"); } -void QAccessibleQuickItemValueInterface::setCurrentValue(const QVariant &value) +void QAccessibleQuickItem::setCurrentValue(const QVariant &value) { item()->setProperty("value", value); } -QVariant QAccessibleQuickItemValueInterface::maximumValue() const +QVariant QAccessibleQuickItem::maximumValue() const { return item()->property("maximumValue"); } -QVariant QAccessibleQuickItemValueInterface::minimumValue() const +QVariant QAccessibleQuickItem::minimumValue() const { return item()->property("minimumValue"); } -QVariant QAccessibleQuickItemValueInterface::minimumStepSize() const +QVariant QAccessibleQuickItem::minimumStepSize() const { return item()->property("stepSize"); } diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.h b/src/plugins/accessible/quick/qaccessiblequickitem.h index 0d31749ee0..46f573cc75 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.h +++ b/src/plugins/accessible/quick/qaccessiblequickitem.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_ACCESSIBILITY -class QAccessibleQuickItem : public QQmlAccessible +class QAccessibleQuickItem : public QQmlAccessible, public QAccessibleValueInterface, public QAccessibleTextInterface { public: QAccessibleQuickItem(QQuickItem *item); @@ -72,28 +72,51 @@ public: bool isAccessible() const; -protected: - QQuickItem *item() const { return static_cast<QQuickItem*>(object()); } -}; - -QRect itemScreenRect(QQuickItem *item); - - -class QAccessibleQuickItemValueInterface: public QAccessibleQuickItem, public QAccessibleValueInterface -{ -public: - QAccessibleQuickItemValueInterface(QQuickItem *item) : QAccessibleQuickItem(item) - {} - - void *interface_cast(QAccessible::InterfaceType t); - + // Value Interface QVariant currentValue() const; void setCurrentValue(const QVariant &value); QVariant maximumValue() const; QVariant minimumValue() const; QVariant minimumStepSize() const; + + + // Text Interface + // selection (ignored for now) + void selection(int selectionIndex, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; } + int selectionCount() const { return 0; } + void addSelection(int startOffset, int endOffset) {} + void removeSelection(int selectionIndex) {} + void setSelection(int selectionIndex, int startOffset, int endOffset) {} + + // cursor + int cursorPosition() const { return 0; } + void setCursorPosition(int position) {} + + // text + QString text(int startOffset, int endOffset) const { return text(QAccessible::Name).mid(startOffset, endOffset - startOffset); } +// QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, +// int *startOffset, int *endOffset) const; +// QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, +// int *startOffset, int *endOffset) const; +// QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, +// int *startOffset, int *endOffset) const; + int characterCount() const { return text(QAccessible::Name).count(); } + + // character <-> geometry + QRect characterRect(int offset) const { return QRect(); } + int offsetAtPoint(const QPoint &point) const { return -1; } + + void scrollToSubstring(int startIndex, int endIndex) {} + QString attributes(int offset, int *startOffset, int *endOffset) const { return QString(); } + +protected: + QQuickItem *item() const { return static_cast<QQuickItem*>(object()); } + void *interface_cast(QAccessible::InterfaceType t); }; +QRect itemScreenRect(QQuickItem *item); + + #endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE diff --git a/src/plugins/accessible/quick/quick.pro b/src/plugins/accessible/quick/quick.pro index eabe44848b..d3a730c396 100644 --- a/src/plugins/accessible/quick/quick.pro +++ b/src/plugins/accessible/quick/quick.pro @@ -1,6 +1,7 @@ TARGET = qtaccessiblequick PLUGIN_TYPE = accessible +PLUGIN_CLASS_NAME = AccessibleQuickFactory load(qt_plugin) include ($$PWD/../shared/qaccessiblebase.pri) diff --git a/src/plugins/accessible/shared/qaccessiblebase.pri b/src/plugins/accessible/shared/qaccessiblebase.pri index 061d154277..827df0f132 100644 --- a/src/plugins/accessible/shared/qaccessiblebase.pri +++ b/src/plugins/accessible/shared/qaccessiblebase.pri @@ -1,4 +1,3 @@ INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD SOURCES += $$PWD/qqmlaccessible.cpp HEADERS += $$PWD/qqmlaccessible.h diff --git a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro index 6d486ecc2f..6172ee95cf 100644 --- a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro +++ b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro @@ -2,6 +2,7 @@ TARGET = qmldbg_ost QT += qml network PLUGIN_TYPE = qmltooling +PLUGIN_CLASS_NAME = QmlOstPlugin load(qt_plugin) SOURCES += \ diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp index d05f4b9b59..93cbdf3018 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp @@ -166,6 +166,7 @@ void InspectTool::hoverMoveEvent(QMouseEvent *event) } } +#ifndef QT_NO_WHEELEVENT void InspectTool::wheelEvent(QWheelEvent *event) { if (event->orientation() != Qt::Vertical) @@ -184,6 +185,7 @@ void InspectTool::wheelEvent(QWheelEvent *event) } } } +#endif void InspectTool::keyReleaseEvent(QKeyEvent *event) { diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h index 5c480697af..5ed243d361 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h @@ -79,7 +79,9 @@ public: void mouseDoubleClickEvent(QMouseEvent *); void hoverMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif void keyPressEvent(QKeyEvent *) {} void keyReleaseEvent(QKeyEvent *); diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro index 6c672c2417..d11ef590bd 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro @@ -2,6 +2,7 @@ TARGET = qmldbg_qtquick2 QT += qml-private quick-private core-private gui-private v8-private PLUGIN_TYPE = qmltooling +PLUGIN_CLASS_NAME = QtQuick2Plugin load(qt_plugin) INCLUDEPATH *= $$PWD $$PWD/../shared diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro index 859aeeffdc..e9c97b875b 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro +++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro @@ -2,6 +2,7 @@ TARGET = qmldbg_tcp QT = qml-private network v8-private core-private PLUGIN_TYPE = qmltooling +PLUGIN_CLASS_NAME = QTcpServerConnection load(qt_plugin) SOURCES += \ diff --git a/src/plugins/qmltooling/shared/abstracttool.h b/src/plugins/qmltooling/shared/abstracttool.h index f29909baf0..6e7d0c09cb 100644 --- a/src/plugins/qmltooling/shared/abstracttool.h +++ b/src/plugins/qmltooling/shared/abstracttool.h @@ -74,7 +74,9 @@ public: virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0; virtual void hoverMoveEvent(QMouseEvent *event) = 0; +#ifndef QT_NO_WHEELEVENT virtual void wheelEvent(QWheelEvent *event) = 0; +#endif virtual void keyPressEvent(QKeyEvent *event) = 0; virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.cpp b/src/plugins/qmltooling/shared/abstractviewinspector.cpp index ed207c5f26..c1d0cf1343 100644 --- a/src/plugins/qmltooling/shared/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/shared/abstractviewinspector.cpp @@ -173,10 +173,12 @@ bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event) if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event))) return true; break; +#ifndef QT_NO_WHEELEVENT case QEvent::Wheel: if (wheelEvent(static_cast<QWheelEvent*>(event))) return true; break; +#endif case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -244,12 +246,14 @@ bool AbstractViewInspector::mouseDoubleClickEvent(QMouseEvent *event) return true; } +#ifndef QT_NO_WHEELEVENT bool AbstractViewInspector::wheelEvent(QWheelEvent *event) { foreach (AbstractTool *tool, m_tools) tool->wheelEvent(event); return true; } +#endif bool AbstractViewInspector::touchEvent(QTouchEvent *event) { diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.h b/src/plugins/qmltooling/shared/abstractviewinspector.h index d98707eaca..e0524c880c 100644 --- a/src/plugins/qmltooling/shared/abstractviewinspector.h +++ b/src/plugins/qmltooling/shared/abstractviewinspector.h @@ -107,7 +107,9 @@ protected: virtual bool keyPressEvent(QKeyEvent *event); virtual bool keyReleaseEvent(QKeyEvent *keyEvent); virtual bool mouseDoubleClickEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT virtual bool wheelEvent(QWheelEvent *event); +#endif virtual bool touchEvent(QTouchEvent *event); virtual void setShowAppOnTop(bool) = 0; diff --git a/src/plugins/qmltooling/shared/qpacketprotocol.cpp b/src/plugins/qmltooling/shared/qpacketprotocol.cpp index 205601c3bf..020e5dbe9d 100644 --- a/src/plugins/qmltooling/shared/qpacketprotocol.cpp +++ b/src/plugins/qmltooling/shared/qpacketprotocol.cpp @@ -290,6 +290,7 @@ void QPacketProtocol::send(const QPacket & p) d->sendingPackets.append(sendSize); qint32 sendSize32 = sendSize; qint64 writeBytes = d->dev->write((char *)&sendSize32, sizeof(qint32)); + Q_UNUSED(writeBytes); Q_ASSERT(writeBytes == sizeof(qint32)); writeBytes = d->dev->write(p.b); Q_ASSERT(writeBytes == p.b.size()); diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index df8431e746..67b3391c0c 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -463,7 +463,7 @@ void QAbstractAnimationJob::setCurrentTime(int msecs) // and has reached the end. if ((m_direction == Forward && m_totalCurrentTime == totalDura) || (m_direction == Backward && m_totalCurrentTime == 0)) { - stop(); + RETURN_IF_DELETED(stop()); } if (m_hasCurrentTimeChangeListeners) diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 301b6be660..06c1c42a92 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -3,41 +3,38 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQml description = Qt QML Reference Documentation url = http://qt-project.org/doc/qt-5.0/qtqml -version = 5.0.0 +version = 5.0.1 qhp.projects = QtQml qhp.QtQml.file = qtqml.qhp qhp.QtQml.namespace = org.qt-project.qtqml.500 -qhp.QtQml.virtualFolder = qdoc -qhp.QtQml.indexTitle = Qt QML Reference Documentation +qhp.QtQml.virtualFolder = qtqml +qhp.QtQml.indexTitle = Qt QML qhp.QtQml.indexRoot = -qhp.QtQml.filterAttributes = qtqml 5.0.0 qtrefdoc -qhp.QtQml.customFilters.Qt.name = QtQml 5.0.0 -qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.0 -qhp.QtQml.subprojects = classes overviews examples -qhp.QtQml.subprojects.classes.title = Classes -qhp.QtQml.subprojects.classes.indexTitle = Qt QML's Classes +qhp.QtQml.filterAttributes = qtqml 5.0.1 qtrefdoc +qhp.QtQml.customFilters.Qt.name = QtQml 5.0.1 +qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.1 +qhp.QtQml.subprojects = classes examples +qhp.QtQml.subprojects.classes.title = C++ Classes +qhp.QtQml.subprojects.classes.indexTitle = Qt QML Module C++ Classes qhp.QtQml.subprojects.classes.selectors = class fake:headerfile qhp.QtQml.subprojects.classes.sortPages = true -qhp.QtQml.subprojects.overviews.title = Overviews -qhp.QtQml.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.QtQml.subprojects.overviews.selectors = fake:page,group,module -qhp.QtQml.subprojects.examples.title = Qt QML Examples -qhp.QtQml.subprojects.examples.indexTitle = Qt QML Examples +qhp.QtQml.subprojects.examples.title = Examples +qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples qhp.QtQml.subprojects.examples.selectors = fake:example + tagfile = ../../../doc/qtqml/qtqml.tags -depends += qtcore qtxmlpatterns qtgui +depends += qtcore qtxmlpatterns qtgui qtquick headerdirs += .. sourcedirs += .. exampledirs += ../../../examples/qml \ - ../../.. \ ../ \ snippets diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc index d59a8cd827..8ed3aa8279 100644 --- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc +++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc @@ -44,12 +44,12 @@ examples/quick/tutorials/extending directory. Tutorial chapters: \list 1 -\li \l{examples/tutorials/extending/chapter1-basics}{Creating a New Type} -\li \l{examples/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} -\li \l{examples/tutorials/extending/chapter3-bindings}{Property Binding} -\li \l{examples/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} -\li \l{examples/tutorials/extending/chapter5-listproperties}{Using List Property Types} -\li \l{examples/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} +\li \l{examples/quick/tutorials/extending/chapter1-basics}{Creating a New Type} +\li \l{examples/quick/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} +\li \l{examples/quick/tutorials/extending/chapter3-bindings}{Property Binding} +\li \l{examples/quick/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} +\li \l{examples/quick/tutorials/extending/chapter5-listproperties}{Using List Property Types} +\li \l{examples/quick/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} \li \l{qml-extending-tutorial7.html}{In Summary} \endlist @@ -64,7 +64,7 @@ and \l {qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}. /*! \title Chapter 1: Creating a New Type -\example examples/tutorials/extending/chapter1-basics +\example examples/quick/tutorials/extending/chapter1-basics A common task when extending QML is to provide a new QML type that supports some custom functionality beyond what is provided by the built-in \l {Qt Quick QML Types}{QtQuick types}. @@ -104,7 +104,7 @@ this new class must: Here is our \c PieChart class, defined in \c piechart.h: -\snippet examples/tutorials/extending/chapter1-basics/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.h 0 The class inherits from QQuickPaintedItem because we want to override QQuickPaintedItem::paint() in perform drawing operations with the QPainter API. @@ -120,15 +120,15 @@ simply sets and returns the \c m_name and \c m_color values as appropriate, and implements \c paint() to draw a simple pie chart. It also turns off the QGraphicsItem::ItemHasNoContents flag to enable painting: -\snippet examples/tutorials/extending/chapter1-basics/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.cpp 0 \dots 0 -\snippet examples/tutorials/extending/chapter1-basics/piechart.cpp 1 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.cpp 1 Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml file creates a \c PieChart item and display the pie chart's details using a standard QML \l Text item: -\snippet examples/tutorials/extending/chapter1-basics/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/app.qml 0 Notice that although the color is specified as a string in QML, it is automatically converted to a QColor object for the PieChart \c color property. Automatic conversions are @@ -142,46 +142,46 @@ you don't register the type, \c app.qml won't be able to create a \c PieChart. Here is the application \c main.cpp: -\snippet examples/tutorials/extending/chapter1-basics/main.cpp 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/main.cpp 0 This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart", in a type namespace called "Charts", with a version of 1.0. Lastly, we write a \c .pro project file that includes the files and the \c declarative library: -\quotefile examples/tutorials/extending/chapter1-basics/chapter1-basics.pro +\quotefile examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro Now we can build and run the application: \image extending-tutorial-chapter1.png -Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-basics directory. +Try it yourself with the code in Qt's \c examples/quick/tutorials/extending/chapter1-basics directory. */ /*! \title Chapter 2: Connecting to C++ Methods and Signals -\example examples/tutorials/extending/chapter2-methods +\example examples/quick/tutorials/extending/chapter2-methods Suppose we want \c PieChart to have a "clearChart()" method that erases the chart and then emits a "chartCleared" signal. Our \c app.qml would be able to call \c clearChart() and receive \c chartCleared() signals like this: -\snippet examples/tutorials/extending/chapter2-methods/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/app.qml 0 \image extending-tutorial-chapter2.png To do this, we add a \c clearChart() method and a \c chartCleared() signal to our C++ class: -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 3 The use of Q_INVOKABLE makes the \c clearChart() method available to the Qt Meta-Object system, and in turn, to QML. Note that it could have @@ -191,7 +191,7 @@ slots are also callable from QML. Both of these approaches are valid. The \c clearChart() method simply changes the color to Qt::transparent, repaints the chart, then emits the \c chartCleared() signal: -\snippet examples/tutorials/extending/chapter2-methods/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.cpp 0 Now when we run the application and click the window, the pie chart disappears, and the application outputs: @@ -200,14 +200,14 @@ disappears, and the application outputs: The chart has been cleared \endcode -Try out the example yourself with the updated code in Qt's \c examples/tutorials/extending/chapter2-methods directory. +Try out the example yourself with the updated code in Qt's \c examples/quick/tutorials/extending/chapter2-methods directory. */ /*! \title Chapter 3: Adding Property Bindings -\example examples/tutorials/extending/chapter3-bindings +\example examples/quick/tutorials/extending/chapter3-bindings Property binding is a powerful feature of QML that allows values of different elements to be synchronized automatically. It uses signals to notify and update @@ -216,7 +216,7 @@ other elements' values when property values are changed. Let's enable property bindings for the \c color property. That means if we have code like this: -\snippet examples/tutorials/extending/chapter3-bindings/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/app.qml 0 \image extending-tutorial-chapter3.png @@ -231,17 +231,17 @@ It's easy to enable property binding for the \c color property. We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal is emitted whenever the value changes. -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 3 Then, we emit this signal in \c setPieSlice(): -\snippet examples/tutorials/extending/chapter3-bindings/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp 0 It's important for \c setColor() to check that the color value has actually changed before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and @@ -259,7 +259,7 @@ custom QML types may see unexpected behavior if bindings are not implemented. /*! \title Chapter 4: Using Custom Property Types -\example examples/tutorials/extending/chapter4-customPropertyTypes +\example examples/quick/tutorials/extending/chapter4-customPropertyTypes The \c PieChart type currently has a string-type property and a color-type property. It could have many other types of properties. For example, it could have an @@ -299,43 +299,43 @@ For example, let's replace the use of the \c property with a type called "PieSlice" that has a \c color property. Instead of assigning a color, we assign an \c PieSlice value which itself contains a \c color: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 Like \c PieChart, this new \c PieSlice type inherits from QQuickPaintedItem and declares its properties with Q_PROPERTY(): -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 To use it in \c PieChart, we modify the \c color property declaration and associated method signatures: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice is a visual item, so it must be set as a child of the \c PieChart using QQuickItem::setParentItem() so that the \c PieChart knows to paint this child item when its contents are drawn: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 Like the \c PieChart type, the \c PieSlice type has to be registered using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the type to the "Charts" type namespace, version 1.0: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 -Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-customPropertyTypes directory. +Try it out with the code in Qt's \c examples/quick/tutorials/extending/chapter4-customPropertyTypes directory. */ @@ -343,13 +343,13 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom /*! \title Chapter 5: Using List Property Types -\example examples/tutorials/extending/chapter5-listproperties +\example examples/quick/tutorials/extending/chapter5-listproperties Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would have multiple slices, with different colors and sizes. To do this, we could have a \c slices property that accepts a list of \c PieSlice items: -\snippet examples/tutorials/extending/chapter5-listproperties/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/app.qml 0 \image extending-tutorial-chapter5.png @@ -360,11 +360,11 @@ function with a \c slices() function that returns a list of slices, and add an internal \c append_slice() function (discussed below). We also use a QList to store the internal list of slices as \c m_slices: -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 2 Although the \c slices property does not have an associated \c WRITE function, it is still modifiable because of the way QQmlListProperty works. @@ -373,7 +373,7 @@ return a QQmlListProperty value and indicate that the internal \c PieChart::append_slice() function is to be called whenever a request is made from QML to add items to the list: -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp 0 The \c append_slice() function simply sets the parent item as before, and adds the new item to the \c m_slices list. As you can see, the append function for a @@ -384,7 +384,7 @@ The \c PieSlice class has also been modified to include \c fromAngle and \c angl properties and to draw the slice according to these values. This is a straightforward modification if you have read the previous pages in this tutorial, so the code is not shown here. -The complete code can be seen in the updated \c examples/tutorials/extending/chapter5-listproperties directory. +The complete code can be seen in the updated \c examples/quick/tutorials/extending/chapter5-listproperties directory. */ @@ -392,7 +392,7 @@ The complete code can be seen in the updated \c examples/tutorials/extending/cha /*! \title Chapter 6: Writing an Extension Plugin -\example examples/tutorials/extending/chapter6-plugins +\example examples/quick/tutorials/extending/chapter6-plugins Currently the \c PieChart and \c PieSlice types are used by \c app.qml, which is displayed using a QQuickView in a C++ application. An alternative @@ -407,22 +407,22 @@ and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerT Here is the \c ChartsPlugin definition in \c chartsplugin.h: -\snippet examples/tutorials/extending/chapter6-plugins/chartsplugin.h 0 +\snippet examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h 0 And its implementation in \c chartsplugin.cpp: -\snippet examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 +\snippet examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 Then, we write a \c .pro project file that defines the project as a plugin library and specifies with DESTDIR that library files should be built into a "lib" subdirectory: -\quotefile examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +\quotefile examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro Finally, we add a \l{qtqml-modules-qmldir.html}{qmldir} file that is parsed by the QML engine. In this file, we specify that a plugin named "chapter6-plugin" (the name of the example project) can be found in the "lib" subdirectory: -\quotefile examples/tutorials/extending/chapter6-plugins/Charts/qmldir +\quotefile examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build the project and then load the QML file using the \l{Prototyping with qmlscene}{qmlscene tool}, diff --git a/src/qml/doc/src/external-resources.qdoc b/src/qml/doc/src/external-resources.qdoc index f32f1d96c5..c9c661434f 100644 --- a/src/qml/doc/src/external-resources.qdoc +++ b/src/qml/doc/src/external-resources.qdoc @@ -28,7 +28,9 @@ /*! \externalpage http://www.ecma-international.org/publications/standards/Ecma-262.htm \title ECMA-262 +*/ +/*! \externalpage http://www.w3schools.com/jsref/default.asp \title W3Schools JavaScript Reference */ diff --git a/src/qml/qml/parser/qqmljskeywords_p.h b/src/qml/qml/parser/qqmljskeywords_p.h index d06c996099..ae8adcc30f 100644 --- a/src/qml/qml/parser/qqmljskeywords_p.h +++ b/src/qml/qml/parser/qqmljskeywords_p.h @@ -104,7 +104,7 @@ static inline int classify3(const QChar *s, bool qmlMode) { else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 't') { - return qmlMode ? Lexer::T_INT : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_INT) : int(Lexer::T_IDENTIFIER); } } } @@ -144,7 +144,7 @@ static inline int classify4(const QChar *s, bool qmlMode) { if (s[1].unicode() == 'y') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { - return qmlMode ? Lexer::T_BYTE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_BYTE) : int(Lexer::T_IDENTIFIER); } } } @@ -160,7 +160,7 @@ static inline int classify4(const QChar *s, bool qmlMode) { else if (s[1].unicode() == 'h') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'r') { - return qmlMode ? Lexer::T_CHAR : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_CHAR) : int(Lexer::T_IDENTIFIER); } } } @@ -185,7 +185,7 @@ static inline int classify4(const QChar *s, bool qmlMode) { if (s[1].unicode() == 'o') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'o') { - return qmlMode ? Lexer::T_GOTO : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_GOTO) : int(Lexer::T_IDENTIFIER); } } } @@ -194,7 +194,7 @@ static inline int classify4(const QChar *s, bool qmlMode) { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'g') { - return qmlMode ? Lexer::T_LONG : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_LONG) : int(Lexer::T_IDENTIFIER); } } } @@ -280,7 +280,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'n') { if (s[3].unicode() == 's') { if (s[4].unicode() == 't') { - return qmlMode ? Lexer::T_CONST : Lexer::T_RESERVED_WORD; + return qmlMode ? int(Lexer::T_CONST) : int(Lexer::T_RESERVED_WORD); } } } @@ -300,7 +300,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'l') { - return qmlMode ? Lexer::T_FINAL : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_FINAL) : int(Lexer::T_IDENTIFIER); } } } @@ -309,7 +309,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 't') { - return qmlMode ? Lexer::T_FLOAT : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_FLOAT) : int(Lexer::T_IDENTIFIER); } } } @@ -320,7 +320,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'r') { if (s[4].unicode() == 't') { - return qmlMode ? Lexer::T_SHORT : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_SHORT) : int(Lexer::T_IDENTIFIER); } } } @@ -329,7 +329,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { - return qmlMode ? Lexer::T_SUPER : Lexer::T_RESERVED_WORD; + return qmlMode ? int(Lexer::T_SUPER) : int(Lexer::T_RESERVED_WORD); } } } @@ -378,7 +378,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'b') { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'e') { - return qmlMode ? Lexer::T_DOUBLE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_DOUBLE) : int(Lexer::T_IDENTIFIER); } } } @@ -404,7 +404,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 't') { - return qmlMode ? Lexer::T_IMPORT : Lexer::T_RESERVED_WORD; + return qmlMode ? int(Lexer::T_IMPORT) : int(Lexer::T_RESERVED_WORD); } } } @@ -417,7 +417,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'i') { if (s[4].unicode() == 'v') { if (s[5].unicode() == 'e') { - return qmlMode ? Lexer::T_NATIVE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_NATIVE) : int(Lexer::T_IDENTIFIER); } } } @@ -467,7 +467,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 't') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'c') { - return qmlMode ? Lexer::T_STATIC : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_STATIC) : int(Lexer::T_IDENTIFIER); } } } @@ -491,7 +491,7 @@ static inline int classify6(const QChar *s, bool qmlMode) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { if (s[5].unicode() == 's') { - return qmlMode ? Lexer::T_THROWS : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_THROWS) : int(Lexer::T_IDENTIFIER); } } } @@ -520,7 +520,7 @@ static inline int classify7(const QChar *s, bool qmlMode) { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'n') { - return qmlMode ? Lexer::T_BOOLEAN : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_BOOLEAN) : int(Lexer::T_IDENTIFIER); } } } @@ -580,7 +580,7 @@ static inline int classify7(const QChar *s, bool qmlMode) { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'g') { if (s[6].unicode() == 'e') { - return qmlMode ? Lexer::T_PACKAGE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_PACKAGE) : int(Lexer::T_IDENTIFIER); } } } @@ -593,7 +593,7 @@ static inline int classify7(const QChar *s, bool qmlMode) { if (s[4].unicode() == 'a') { if (s[5].unicode() == 't') { if (s[6].unicode() == 'e') { - return qmlMode ? Lexer::T_PRIVATE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_PRIVATE) : int(Lexer::T_IDENTIFIER); } } } @@ -613,7 +613,7 @@ static inline int classify8(const QChar *s, bool qmlMode) { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'c') { if (s[7].unicode() == 't') { - return qmlMode ? Lexer::T_ABSTRACT : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_ABSTRACT) : int(Lexer::T_IDENTIFIER); } } } @@ -715,7 +715,7 @@ static inline int classify8(const QChar *s, bool qmlMode) { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'l') { if (s[7].unicode() == 'e') { - return qmlMode ? Lexer::T_VOLATILE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_VOLATILE) : int(Lexer::T_IDENTIFIER); } } } @@ -737,7 +737,7 @@ static inline int classify9(const QChar *s, bool qmlMode) { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'c') { if (s[8].unicode() == 'e') { - return qmlMode ? Lexer::T_INTERFACE : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_INTERFACE) : int(Lexer::T_IDENTIFIER); } } } @@ -756,7 +756,7 @@ static inline int classify9(const QChar *s, bool qmlMode) { if (s[6].unicode() == 't') { if (s[7].unicode() == 'e') { if (s[8].unicode() == 'd') { - return qmlMode ? Lexer::T_PROTECTED : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_PROTECTED) : int(Lexer::T_IDENTIFIER); } } } @@ -775,7 +775,7 @@ static inline int classify9(const QChar *s, bool qmlMode) { if (s[6].unicode() == 'e') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 't') { - return qmlMode ? Lexer::T_TRANSIENT : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_TRANSIENT) : int(Lexer::T_IDENTIFIER); } } } @@ -799,7 +799,7 @@ static inline int classify10(const QChar *s, bool qmlMode) { if (s[7].unicode() == 'n') { if (s[8].unicode() == 't') { if (s[9].unicode() == 's') { - return qmlMode ? Lexer::T_IMPLEMENTS : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_IMPLEMENTS) : int(Lexer::T_IDENTIFIER); } } } @@ -845,7 +845,7 @@ static inline int classify12(const QChar *s, bool qmlMode) { if (s[9].unicode() == 'z') { if (s[10].unicode() == 'e') { if (s[11].unicode() == 'd') { - return qmlMode ? Lexer::T_SYNCHRONIZED : Lexer::T_IDENTIFIER; + return qmlMode ? int(Lexer::T_SYNCHRONIZED) : int(Lexer::T_IDENTIFIER); } } } diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 234dee2918..276013e433 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -58,8 +58,6 @@ #include <QtCore/qstringbuilder.h> #include <QtCore/qdebug.h> -Q_DECLARE_METATYPE(QQmlV8Handle) - QT_BEGIN_NAMESPACE static QQmlJavaScriptExpression::VTable QQmlBoundSignalExpression_jsvtable = { diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 0b22228034..06a91e39b3 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -76,7 +76,6 @@ Q_DECLARE_METATYPE(QList<qreal>) Q_DECLARE_METATYPE(QList<bool>) Q_DECLARE_METATYPE(QList<QString>) Q_DECLARE_METATYPE(QList<QUrl>) -Q_DECLARE_METATYPE(QJSValue) QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 2a46cdb12e..d7b6f706d6 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -675,13 +675,13 @@ void QQmlEnginePrivate::init() firstTime = false; } - qRegisterMetaType<QVariant>("QVariant"); - qRegisterMetaType<QQmlScriptString>("QQmlScriptString"); - qRegisterMetaType<QJSValue>("QJSValue"); - qRegisterMetaType<QQmlComponent::Status>("QQmlComponent::Status"); - qRegisterMetaType<QList<QObject*> >("QList<QObject*>"); - qRegisterMetaType<QList<int> >("QList<int>"); - qRegisterMetaType<QQmlV8Handle>("QQmlV8Handle"); + qRegisterMetaType<QVariant>(); + qRegisterMetaType<QQmlScriptString>(); + qRegisterMetaType<QJSValue>(); + qRegisterMetaType<QQmlComponent::Status>(); + qRegisterMetaType<QList<QObject*> >(); + qRegisterMetaType<QList<int> >(); + qRegisterMetaType<QQmlV8Handle>(); v8engine()->setEngine(q); diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 7a2f4eaf34..adce26b76c 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -986,6 +986,7 @@ QQmlImportNamespace::Import *QQmlImportsPrivate::addImportToNamespace(QQmlImport { Q_ASSERT(nameSpace); Q_ASSERT(errors); + Q_UNUSED(errors); Q_ASSERT(url.isEmpty() || url.endsWith(Slash)); QQmlImportNamespace::Import *import = new QQmlImportNamespace::Import; diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index a2bd3742aa..62539b71e9 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -64,7 +64,6 @@ #include <math.h> -Q_DECLARE_METATYPE(QJSValue) Q_DECLARE_METATYPE(QList<int>) Q_DECLARE_METATYPE(QList<qreal>) Q_DECLARE_METATYPE(QList<bool>) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 8b023855ab..9922a82c3d 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -61,9 +61,6 @@ # pragma warning( disable : 4200 ) #endif -Q_DECLARE_METATYPE(QJSValue) -Q_DECLARE_METATYPE(QQmlV8Handle); - QT_BEGIN_NAMESPACE #define Q_INT16_MAX 32767 diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index da918c3c71..9db3ee5a4d 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -1244,6 +1244,7 @@ v8::Persistent<v8::Object> QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptD script->initialize(parentCtxt->engine); v8::Local<v8::Object> qmlglobal = v8engine->qmlScope(ctxt, 0); + v8engine->contextWrapper()->takeContextOwnership(qmlglobal); if (!script->m_program.IsEmpty()) { script->m_program->Run(qmlglobal); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 14d25b6a5e..8dc9943ddc 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -53,8 +53,6 @@ #include <private/qv8variantresource_p.h> #include <private/qqmlglobal_p.h> -Q_DECLARE_METATYPE(QJSValue); - QT_BEGIN_NAMESPACE QQmlVMEVariantQObjectPtr::QQmlVMEVariantQObjectPtr(bool isVar) diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 84bdbfda7a..48b2ad948a 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -68,8 +68,6 @@ #include <QtCore/qmath.h> #include <math.h> // ::fmod -Q_DECLARE_METATYPE(QJSValue) - #ifdef Q_CC_MSVC // MSVC2010 warns about 'unreferenced formal parameter', even if it's used in p->~T() # pragma warning( disable : 4100 ) diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp index 2b01acbddf..c12d59d420 100644 --- a/src/qml/qml/v4/qv4compiler.cpp +++ b/src/qml/qml/v4/qv4compiler.cpp @@ -50,8 +50,6 @@ #include <private/qqmlaccessors_p.h> #include <private/qqmljsengine_p.h> -Q_DECLARE_METATYPE(QJSValue) - QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(bindingsDump, QML_BINDINGS_DUMP) diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index bd875c185e..6e18091d6b 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -48,8 +48,6 @@ DEFINE_BOOL_CONFIG_OPTION(qmlVerboseCompiler, QML_VERBOSE_COMPILER) -Q_DECLARE_METATYPE(QJSValue) - QT_BEGIN_NAMESPACE using namespace QQmlJS; diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp index 5bb6db16e0..9698ed5e8a 100644 --- a/src/qml/qml/v8/qjsengine.cpp +++ b/src/qml/qml/v8/qjsengine.cpp @@ -68,7 +68,6 @@ #define Q_D(blah) #define Q_Q(blah) -Q_DECLARE_METATYPE(QJSValue) Q_DECLARE_METATYPE(QObjectList) Q_DECLARE_METATYPE(QList<int>) diff --git a/src/qml/qml/v8/qjsvalue.h b/src/qml/qml/v8/qjsvalue.h index 9223e57ee4..d13be2b8cc 100644 --- a/src/qml/qml/v8/qjsvalue.h +++ b/src/qml/qml/v8/qjsvalue.h @@ -155,6 +155,8 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QJSValue) + QT_END_HEADER #endif diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp index 9f18afc5cb..bc64189cbd 100644 --- a/src/qml/qml/v8/qv8contextwrapper.cpp +++ b/src/qml/qml/v8/qv8contextwrapper.cpp @@ -55,7 +55,7 @@ class QV8ContextResource : public QV8ObjectResource V8_RESOURCE_TYPE(ContextType); public: - QV8ContextResource(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject); + QV8ContextResource(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false); ~QV8ContextResource(); inline QQmlContextData *getContext() const; @@ -64,7 +64,8 @@ public: quint32 isSharedContext:1; quint32 hasSubContexts:1; quint32 readOnly:1; - quint32 dummy:29; + quint32 ownsContext:1; + quint32 dummy:28; // This is a pretty horrible hack, and an abuse of external strings. When we create a // sub-context (a context created by a Qt.include() in an external javascript file), @@ -86,15 +87,15 @@ private: }; -QV8ContextResource::QV8ContextResource(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject) -: QV8ObjectResource(engine), isSharedContext(false), hasSubContexts(false), readOnly(true), - context(context), scopeObject(scopeObject) +QV8ContextResource::QV8ContextResource(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext) +: QV8ObjectResource(engine), isSharedContext(false), hasSubContexts(false), readOnly(true), + ownsContext(ownsContext), context(context), scopeObject(scopeObject) { } QV8ContextResource::~QV8ContextResource() { - if (context && context->isJSContext) + if (context && ownsContext) context->destroy(); } @@ -186,7 +187,7 @@ v8::Local<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url) // XXX NewInstance() should be optimized v8::Local<v8::Object> rv = m_urlConstructor->NewInstance(); - QV8ContextResource *r = new QV8ContextResource(m_engine, context, 0); + QV8ContextResource *r = new QV8ContextResource(m_engine, context, 0, true); rv->SetExternalResource(r); return rv; } @@ -226,6 +227,12 @@ QQmlContextData *QV8ContextWrapper::context(v8::Handle<v8::Value> value) return r?r->getContext():0; } +void QV8ContextWrapper::takeContextOwnership(v8::Handle<v8::Object> qmlglobal) +{ + QV8ContextResource *r = v8_resource_cast<QV8ContextResource>(qmlglobal); + r->ownsContext = true; +} + v8::Handle<v8::Value> QV8ContextWrapper::NullGetter(v8::Local<v8::String>, const v8::AccessorInfo &) { diff --git a/src/qml/qml/v8/qv8contextwrapper_p.h b/src/qml/qml/v8/qv8contextwrapper_p.h index 1e62ea6480..43eeee05d3 100644 --- a/src/qml/qml/v8/qv8contextwrapper_p.h +++ b/src/qml/qml/v8/qv8contextwrapper_p.h @@ -54,6 +54,7 @@ // #include <QtCore/qglobal.h> +#include <private/qtqmlglobal_p.h> #include <private/qv8_p.h> QT_BEGIN_NAMESPACE @@ -62,7 +63,7 @@ class QUrl; class QObject; class QV8Engine; class QQmlContextData; -class QV8ContextWrapper +class Q_QML_PRIVATE_EXPORT QV8ContextWrapper { public: QV8ContextWrapper(); @@ -84,6 +85,8 @@ public: inline v8::Handle<v8::Object> sharedContext() const; + void takeContextOwnership(v8::Handle<v8::Object> qmlglobal); + private: static v8::Handle<v8::Value> NullGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 1544b0717b..806e3690b3 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -63,7 +63,6 @@ #include <QtCore/qjsonobject.h> #include <QtCore/qjsonvalue.h> -Q_DECLARE_METATYPE(QJSValue) Q_DECLARE_METATYPE(QList<int>) diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 12b0f4b6a1..75e4344fee 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -642,4 +642,6 @@ QV8Engine::Deletable *QV8Engine::extensionData(int index) const QT_END_NAMESPACE +Q_DECLARE_METATYPE(QQmlV8Handle) + #endif // QQMLV8ENGINE_P_H diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index fa818388fe..eac8c93c08 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -62,9 +62,6 @@ #include <QtCore/qtimer.h> #include <QtCore/qatomic.h> -Q_DECLARE_METATYPE(QJSValue); -Q_DECLARE_METATYPE(QQmlV8Handle); - QT_BEGIN_NAMESPACE #if defined(__GNUC__) && !defined(__INTEL_COMPILER) diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index 3fa9561a9d..9ed792748c 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -1,10 +1,14 @@ TARGET = QtQuickTest -CONFIG += dll warn_on DEFINES += QT_NO_URL_CAST_FROM_STRING QT = core QT_PRIVATE = testlib-private quick qml-private v8-private gui core-private +!contains(QT_CONFIG, no-widgets) { + QT += widgets + DEFINES += QT_QMLTEST_WITH_WIDGETS +} + load(qt_module) # Install qmltestcase.prf into the Qt mkspecs so that "CONFIG += qmltestcase" @@ -24,4 +28,4 @@ HEADERS += \ $$PWD/quicktestresult_p.h \ $$PWD/qtestoptions_p.h -DEFINES += QT_QML_DEBUG_NO_WARNING
\ No newline at end of file +DEFINES += QT_QML_DEBUG_NO_WARNING diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 6be10add38..705908c3c4 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -64,6 +64,10 @@ #include <QtCore/QTranslator> #include <QtTest/QSignalSpy> +#ifdef QT_QMLTEST_WITH_WIDGETS +#include <QtWidgets/QApplication> +#endif + QT_BEGIN_NAMESPACE class QTestRootObject : public QObject @@ -167,11 +171,6 @@ bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000) int quick_test_main(int argc, char **argv, const char *name, const char *sourceDir) { - QGuiApplication* app = 0; - if (!QCoreApplication::instance()) { - app = new QGuiApplication(argc, argv); - } - // Look for QML-specific command-line options. // -import dir Specify an import directory. // -input dir Specify the input directory for test cases. @@ -179,6 +178,9 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD QStringList imports; QString testPath; QString translationFile; +#ifdef QT_QMLTEST_WITH_WIDGETS + bool withWidgets = false; +#endif int outargc = 1; int index = 1; while (index < argc) { @@ -190,6 +192,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD index += 2; } else if (strcmp(argv[index], "-opengl") == 0) { ++index; +#ifdef QT_QMLTEST_WITH_WIDGETS + } else if (strcmp(argv[index], "-widgets") == 0) { + withWidgets = true; + ++index; +#endif } else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) { translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1])); index += 2; @@ -203,6 +210,18 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD argv[outargc] = 0; argc = outargc; + QCoreApplication* app = 0; + if (!QCoreApplication::instance()) { +#ifdef QT_QMLTEST_WITH_WIDGETS + if (withWidgets) + app = new QApplication(argc, argv); + else +#endif + { + app = new QGuiApplication(argc, argv); + } + } + // Parse the command-line arguments. // Setting currentAppname and currentTestObjectName (via setProgramName) are needed diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index 2fccf3cd72..20ede936fa 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -146,6 +146,7 @@ namespace QtQuickTest } } +#ifndef QT_NO_WHEELEVENT static void mouseWheel(QWindow* window, QObject* item, Qt::MouseButtons buttons, Qt::KeyboardModifiers stateKey, QPointF _pos, int xDelta, int yDelta, int delay = -1) @@ -172,6 +173,7 @@ namespace QtQuickTest if (!qApp->notify(window, &we)) QTest::qWarn("Wheel event not accepted by receiving window"); } +#endif }; bool QuickTestEvent::mousePress @@ -188,6 +190,7 @@ bool QuickTestEvent::mousePress return true; } +#ifndef QT_NO_WHEELEVENT bool QuickTestEvent::mouseWheel( QObject *item, qreal x, qreal y, int buttons, int modifiers, int xDelta, int yDelta, int delay) @@ -200,6 +203,7 @@ bool QuickTestEvent::mouseWheel( QPointF(x, y), xDelta, yDelta, delay); return true; } +#endif bool QuickTestEvent::mouseRelease (QObject *item, qreal x, qreal y, int button, diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h index 9dfa66a54d..f72d9265b5 100644 --- a/src/qmltest/quicktestevent_p.h +++ b/src/qmltest/quicktestevent_p.h @@ -69,8 +69,10 @@ public Q_SLOTS: int modifiers, int delay); bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons); +#ifndef QT_NO_WHEELEVENT bool mouseWheel(QObject *item, qreal x, qreal y, int buttons, int modifiers, int xDelta, int yDelta, int delay); +#endif private: QWindow *eventWindow(); diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 93aad5ddbf..f75ae06539 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -3,35 +3,37 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQuick description = Qt Quick Reference Documentation url = http://qt-project.org/doc/qt-5.0/qtquick-index.html -version = 5.0.0 +version = 5.0.1 qhp.projects = QtQuick qhp.QtQuick.file = qtquick.qhp qhp.QtQuick.namespace = org.qt-project.qtquick.500 -qhp.QtQuick.virtualFolder = qdoc -qhp.QtQuick.indexTitle = Qt Quick Reference Documentation +qhp.QtQuick.virtualFolder = qtquick +qhp.QtQuick.indexTitle = Qt Quick qhp.QtQuick.indexRoot = -qhp.QtQuick.filterAttributes = qtquick 5.0.0 qtrefdoc -qhp.QtQuick.customFilters.Qt.name = QtQuick 5.0.0 -qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.0 -qhp.QtQuick.subprojects = classes overviews examples +qhp.QtQuick.filterAttributes = qtquick 5.0.1 qtrefdoc +qhp.QtQuick.customFilters.Qt.name = QtQuick 5.0.1 +qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.1 +qhp.QtQuick.subprojects = qmltypes classes examples +qhp.QtQuick.subprojects.qmltypes.title = QML Types +qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types +qhp.QtQuick.subprojects.qmltypes.selectors = class fake:headerfile +qhp.QtQuick.subprojects.qmltypes.sortPages = true qhp.QtQuick.subprojects.classes.title = Classes -qhp.QtQuick.subprojects.classes.indexTitle = Qt Quick's Classes +qhp.QtQuick.subprojects.classes.title = C++ Classes +qhp.QtQuick.subprojects.classes.indexTitle = Qt Quick Module C++ Classes qhp.QtQuick.subprojects.classes.selectors = class fake:headerfile qhp.QtQuick.subprojects.classes.sortPages = true -qhp.QtQuick.subprojects.overviews.title = Overviews -qhp.QtQuick.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.QtQuick.subprojects.overviews.selectors = fake:page,group,module -qhp.QtQuick.subprojects.examples.title = Qt Quick Examples -qhp.QtQuick.subprojects.examples.indexTitle = Qt Quick Examples +qhp.QtQuick.subprojects.examples.title = Examples +qhp.QtQuick.subprojects.examples.indexTitle = Qt Quick Code Samples qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist headerdirs += .. @@ -43,10 +45,6 @@ exampledirs += ../../../examples/ \ imagedirs += images -#add qml sources because of dependencies -headerdirs += ../../qml -exampledirs += ../../qml -imagedirs += ../../qml #add particles sources headerdirs += ../../particles diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc index f5b3e8b7db..dbd13fff07 100644 --- a/src/quick/doc/src/advtutorial.qdoc +++ b/src/quick/doc/src/advtutorial.qdoc @@ -59,7 +59,7 @@ Tutorial chapters: \li \l {tutorials/samegame/samegame4}{Finishing Touches} \endlist -All the code in this tutorial can be found in Qt's \c examples/tutorials/samegame +All the code in this tutorial can be found in Qt's \c examples/quick/tutorials/samegame directory. */ @@ -364,12 +364,12 @@ To fade out, we set \c dying to true instead of setting opacity to 0 when a bloc \section3 Adding particle effects -Finally, we'll add a cool-looking particle effect to the blocks when they are destroyed. To do this, we first add a \l Particles element in +Finally, we'll add a cool-looking particle effect to the blocks when they are destroyed. To do this, we first add a \l ParticleSystem in \c BoomBlock.qml, like so: \snippet tutorials/samegame/samegame4/content/BoomBlock.qml 3 -To fully understand this you should read the \l Particles documentation, but it's important to note that \c emissionRate is set +To fully understand this you should read the \l Particles documentation, but it's important to note that \c emitRate is set to zero so that particles are not emitted normally. Also, we extend the \c dying State, which creates a burst of particles by calling the \c burst() method on the particles element. The code for the states now look like this: diff --git a/src/quick/doc/src/appdevguide/porting.qdoc b/src/quick/doc/src/appdevguide/porting.qdoc index 6bb2a75074..305524c9e6 100644 --- a/src/quick/doc/src/appdevguide/porting.qdoc +++ b/src/quick/doc/src/appdevguide/porting.qdoc @@ -27,7 +27,7 @@ /*! \page qtquick-porting-qt5.html -\title QML Applications in Qt 5 +\title Porting QML Applications to Qt 5 \brief Lists the Qt 5.0 changes that affect the existing QML applications When porting QML-related code from Qt 4.8 to Qt 5, application developers should be aware that @@ -38,6 +38,15 @@ This article describes the changes that affect your existing code. If you are interested in the summary of all new features in Qt 5 for QML application development, see \l{qtqml-releasenotes.html}{QtQml Release Notes} and \l{qtquick-releasenotes.html}{QtQuick Release Notes}. +\section1 QML Language changes + +There are very few changes in the QML language which affect the porting of existing Qt 4.8 QML code to Qt 5. These are: + +\list +\li Individual file imports no longer work (e.g. import "MyType.qml"). Import the containing directory instead. +\li Relative file paths in JavaScript files are now resolved relative to the location of the JavaScript file instead of the QML file that imported it. +\endlist + \section1 QtQuick Module The QtQuick module has been updated to version 2.0. All QML applications should update their import diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc index e9add7b221..d9bfee2638 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc @@ -121,7 +121,7 @@ QAbstractItemModel::setRoleNames(). The default role names set by Qt are: \endtable Here is an application with a QAbstractListModel subclass named \c AnimalModel -that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() to set the +that has \e type and \e size roles. It reimplements QAbstractItemModel::roleNames() to set the role names for accessing the properties via QML: \snippet examples/quick/modelviews/abstractitemmodel/model.h 0 diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc index ca8a045975..6e9d963d8d 100644 --- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc @@ -49,18 +49,18 @@ are drawn in one call, then all icons, then all the text, reducing the total amount of draw calls to only 3. Batching and state change reduction like this can greatly improve performance on some hardware. -The scene graph is closely tied to QML and can not be used as +The scene graph is closely tied to Qt Quick 2.0 and can not be used stand-alone. The scene graph is managed and rendered by the -QQuickWindow class and custom QML elements will add their graphical +QQuickWindow class and custom Item elements can add their graphical primitives into the scene graph through a call to QQuickItem::updatePaintNode(). -The QML scene graph is a graphical representation of the QML scene. It -can be thought of as a graphical deep copy, an independent structure that -contains enough information to render the QML Scene. Once it has been set -up, it can be manipulated and rendered independently of the state of -the QML scene. On some platforms, the scene graph will even be -rendered on a dedicated render thread. +The scene graph is a graphical representation of the Item scene, an +independent structure that contains enough information to render all +the items. Once it has been set up, it can be manipulated and rendered +independently of the state of the items. On many platforms, the scene +graph will even be rendered on a dedicated render thread while the GUI +thread is preparing the next frame's state. @@ -74,7 +74,7 @@ serving a dedicated purpose. \li QSGGeometryNode - for all rendered content in the scene graph. In most cases, it will be enough for a custom QQuickItem object to simply return a single QSGGeometryNode object from the -QQuickItem::updatePaintNode() call. +QQuickItem::updatePaintNode() call. \li QSGTransformNode - implements transformations in the scene graph. Nested transforms are multiplied together. @@ -91,6 +91,11 @@ the rendering, such as the shared root for a subtree of geometry nodes. \endlist +Ownership of the nodes is either done explicitly by the creator or by +the scene graph by setting the flag \l QSGNode::OwnedByParent on +it. Assigning ownership to the scene graph is often preferable as it +simplifies cleanup when the scene graph lives outside the GUI thread. + \section1 Rendering @@ -102,6 +107,40 @@ Rendering} section. How to integrate QPainter based graphics is explained in \l{Custom Items using QPainter}. +\section1 Mixing Scene Graph and OpenGL + +The scene graph offers two methods for integrating OpenGL +content. + +By connecting to the \l QQuickWindow::beforeRendering() and \l +QQuickWindow::afterRendering() signals, applications can make OpenGL +calls directly into the same context as the scene graph is rendering +to. As the signal names indicate, the user can then render OpenGL +content either under a Qt Quick scene or over it. The benefit of +integrating in this manner is that no extra framebuffer nor memory is +needed to perform the rendering. The downside is that Qt Quick decides +when to call the signals and this is the only time the OpenGL +application is allowed to draw. + +The other alternative is to create a FramebufferObject, render into it +and use the result as a textured node in the scene graph, for instance +using a QSGSimpleTextureNode. A simple way of doing the same is to use +a QQuickPaintedItem with QQuickPaintedItem::FramebufferObject as +render target and by calling QPainter::beginNativePainting() before +the OpenGL rendering and QPainter::endNativePainting() after. When +OpenGL content is integrated with a texture and FramebufferObject, the +application has more control over when the content is rendered. For +instance, the application can create a second QOpenGLContext on the +GUI thread which shares memory with the scene graph's OpenGL context and drive the rendering manually. + +\warning When mixing OpenGL content with scene graph rendering, it is +important the application does not leave the OpenGL context in a state +with buffers bound, attributes enabled, special values in the z-buffer +or stencil-buffer or similar. Doing so can result in unpredictable +behavior. + +\warning The OpenGL rendering code must be thread aware, as the +rendering might be happening outside the GUI thread. \section1 Scene Graph Backend diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc index 0b5f2b4f60..3edfdc65c0 100644 --- a/src/quick/doc/src/dynamicview-tutorial.qdoc +++ b/src/quick/doc/src/dynamicview-tutorial.qdoc @@ -45,7 +45,7 @@ Tutorial chapters: \li \l {tutorials/dynamicview/dynamicview4}{Sorting Items} \endlist -All the code in this tutorial can be found in Qt's \c examples/tutorials/dynamicview +All the code in this tutorial can be found in Qt's \c examples/quick/tutorials/dynamicview directory. */ @@ -139,7 +139,7 @@ so that is above other items in the stacking order and isn't obscured as it is d \previouspage QML Dynamic View Ordering Tutorial 2 - Dragging View Items \nextpage QML Dynamic View Ordering Tutorial 4 - Sorting Items -\example examples/tutorials/dynamicview/dynamicview3 +\example examples/quick/tutorials/dynamicview/dynamicview3 The next step in our application to move items within the list as they're dragged so that we can re-order the list. To achieve this we introduce three new elements to our application; diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index c0b4968ce3..e64ee25dbb 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -56,13 +56,13 @@ information about the concepts which are central to \c QtQuick. Qt Quick includes several submodules which contain additional types. \list - \li \l{QML Module QtQuick.XmlListModel 2.0}{XML List Model} - contains types + \li \l{QtQuick.XmlListModel 2}{XML List Model} - contains types for creating models from XML data - \li \l{QML Module QtQuick.LocalStorage 2.0}{Local Storage} - a submodule + \li \l{QtQuick.LocalStorage 2}{Local Storage} - a submodule containing a JavaScript interface for an SQLite database - \li \l{QML Module QtQuick.Particles 2.0}{Particles} - provides a particle + \li \l{QtQuick.Particles 2}{Particles} - provides a particle system for QML applications - \li \l{QML Module QtQuick.Window 2.0}{Window} - contains types for creating + \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information \endlist diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc index 67951b0abd..619f754696 100644 --- a/src/quick/doc/src/tutorial.qdoc +++ b/src/quick/doc/src/tutorial.qdoc @@ -41,7 +41,7 @@ with properties and signals, and we will create a simple animation with the help Chapter one starts with a minimal "Hello world" program and the following chapters introduce new concepts. -The tutorial's source code is located in the \c{examples/tutorials/helloworld} directory. +The tutorial's source code is located in the \c{examples/quick/tutorials/helloworld} directory. Tutorial chapters: diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index 74f486ae7d..a11f40c535 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -127,6 +127,18 @@ public: return obj->setProperty(propertyName, value); } + static QObject *findAccessible(QObject *object, QAccessible::Role role = QAccessible::NoRole) + { + while (object) { + QObject *att = QQuickAccessibleAttached::attachedProperties(object); + if (att && (role == QAccessible::NoRole || att->property("role").toInt() == role)) { + break; + } + object = object->parent(); + } + return object; + } + Q_SIGNALS: void roleChanged(); diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 0a3dcd8039..6e5e6b74a0 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1270,6 +1270,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event) } } +#ifndef QT_NO_WHEELEVENT void QQuickFlickable::wheelEvent(QWheelEvent *event) { Q_D(QQuickFlickable); @@ -1324,6 +1325,7 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event) if (!event->isAccepted()) QQuickItem::wheelEvent(event); } +#endif bool QQuickFlickablePrivate::isInnermostPressDelay(QQuickItem *i) const { diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index d5f97ad963..ed4b026be3 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -234,7 +234,9 @@ protected: virtual void mousePressEvent(QMouseEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT virtual void wheelEvent(QWheelEvent *event); +#endif virtual void timerEvent(QTimerEvent *event); QQuickFlickableVisibleArea *visibleArea(); diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 2340da9b9f..6668cb72c5 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3129,8 +3129,12 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event) void QQuickItem::focusInEvent(QFocusEvent * /*event*/) { #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent ev(this, QAccessible::Focus); - QAccessible::updateAccessibility(&ev); + if (QAccessible::isActive()) { + if (QObject *acc = QQuickAccessibleAttached::findAccessible(this)) { + QAccessibleEvent ev(acc, QAccessible::Focus); + QAccessible::updateAccessibility(&ev); + } + } #endif } @@ -3202,6 +3206,7 @@ void QQuickItem::touchUngrabEvent() // XXX todo } +#ifndef QT_NO_WHEELEVENT /*! This event handler can be reimplemented in a subclass to receive wheel events for an item. The event information is provided by the @@ -3211,6 +3216,7 @@ void QQuickItem::wheelEvent(QWheelEvent *event) { event->ignore(); } +#endif /*! This event handler can be reimplemented in a subclass to receive touch @@ -4100,11 +4106,13 @@ void QQuickItemPrivate::deliverMouseEvent(QMouseEvent *e) } } +#ifndef QT_NO_WHEELEVENT void QQuickItemPrivate::deliverWheelEvent(QWheelEvent *e) { Q_Q(QQuickItem); q->wheelEvent(e); } +#endif void QQuickItemPrivate::deliverTouchEvent(QTouchEvent *e) { @@ -5264,7 +5272,7 @@ void QQuickItem::setFlags(Flags flags) { Q_D(QQuickItem); - if ((flags & ItemIsFocusScope) != (d->flags & ItemIsFocusScope)) { + if (int(flags & ItemIsFocusScope) != int(d->flags & ItemIsFocusScope)) { if (flags & ItemIsFocusScope && !d->childItems.isEmpty() && d->window) { qWarning("QQuickItem: Cannot set FocusScope once item has children and is in a window."); flags &= ~ItemIsFocusScope; @@ -5274,7 +5282,7 @@ void QQuickItem::setFlags(Flags flags) } } - if ((flags & ItemClipsChildrenToShape ) != (d->flags & ItemClipsChildrenToShape)) + if (int(flags & ItemClipsChildrenToShape) != int(d->flags & ItemClipsChildrenToShape)) d->dirty(QQuickItemPrivate::Clip); d->flags = flags; diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index bba26be060..dc20310c48 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -398,7 +398,9 @@ protected: virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseUngrabEvent(); // XXX todo - params? virtual void touchUngrabEvent(); +#ifndef QT_NO_WHEELEVENT virtual void wheelEvent(QWheelEvent *event); +#endif virtual void touchEvent(QTouchEvent *event); virtual void hoverEnterEvent(QHoverEvent *event); virtual void hoverMoveEvent(QHoverEvent *event); diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 363cc93cc4..804b10deac 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -528,7 +528,9 @@ public: #endif void deliverFocusEvent(QFocusEvent *); void deliverMouseEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT void deliverWheelEvent(QWheelEvent *); +#endif void deliverTouchEvent(QTouchEvent *); void deliverHoverEvent(QHoverEvent *); #ifndef QT_NO_DRAGANDDROP diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index ad3f4fa215..0edbd1b9a9 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -64,7 +64,7 @@ static const int PressAndHoldDelay = 800; #ifndef QT_NO_DRAGANDDROP QQuickDrag::QQuickDrag(QObject *parent) -: QObject(parent), _target(0), _axis(XandYAxis), _xmin(-FLT_MAX), +: QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX), _xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false) { } @@ -938,6 +938,7 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event) setHovered(false); } +#ifndef QT_NO_WHEELEVENT void QQuickMouseArea::wheelEvent(QWheelEvent *event) { Q_D(QQuickMouseArea); @@ -953,6 +954,7 @@ void QQuickMouseArea::wheelEvent(QWheelEvent *event) if (!we.isAccepted()) QQuickItem::wheelEvent(event); } +#endif void QQuickMouseArea::ungrabMouse() { @@ -1331,7 +1333,7 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape) \list \li \c drag.target specifies the id of the item to drag. \li \c drag.active specifies if the target item is currently being dragged. - \li \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XandYAxis) + \li \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XAndYAxis) \li \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes. \endlist diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h index b095ba5e23..c2138792ae 100644 --- a/src/quick/items/qquickmousearea_p.h +++ b/src/quick/items/qquickmousearea_p.h @@ -78,7 +78,7 @@ public: void setTarget(QQuickItem *target); void resetTarget(); - enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; + enum Axis { XAxis=0x01, YAxis=0x02, XAndYAxis=0x03, XandYAxis=XAndYAxis }; Axis axis() const; void setAxis(Axis); @@ -222,7 +222,9 @@ protected: virtual void hoverEnterEvent(QHoverEvent *event); virtual void hoverMoveEvent(QHoverEvent *event); virtual void hoverLeaveEvent(QHoverEvent *event); +#ifndef QT_NO_WHEELEVENT virtual void wheelEvent(QWheelEvent *event); +#endif virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e); virtual void timerEvent(QTimerEvent *event); virtual void windowDeactivateEvent(); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 5dcea62281..a2f0376466 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -239,7 +239,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() \li \c pinch.active specifies if the target item is currently being dragged. \li \c pinch.minimumScale and \c pinch.maximumScale limit the range of the Item::scale property. \li \c pinch.minimumRotation and \c pinch.maximumRotation limit the range of the Item::rotation property. - \li \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XandYAxis) + \li \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XAndYAxis) \li \c pinch.minimum and \c pinch.maximum limit how far the target can be dragged along the corresponding axes. \endlist */ diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h index 435d3ec538..f3687e0c15 100644 --- a/src/quick/items/qquickpincharea_p.h +++ b/src/quick/items/qquickpincharea_p.h @@ -112,7 +112,7 @@ public: emit maximumRotationChanged(); } - enum Axis { NoDrag=0x00, XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; + enum Axis { NoDrag=0x00, XAxis=0x01, YAxis=0x02, XAndYAxis=0x03, XandYAxis=XAndYAxis }; Axis axis() const { return m_axis; } void setAxis(Axis a) { if (a == m_axis) diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index 622000e492..15989db57b 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -153,7 +153,7 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri if (state.isMatrixDirty()) program()->setUniformValue(loc, state.combinedMatrix()); } else if (d.specialType == UniformData::None) { - switch (d.value.type()) { + switch (int(d.value.type())) { case QMetaType::QColor: program()->setUniformValue(loc, qt_premultiply_color(qvariant_cast<QColor>(d.value))); break; diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index 2b613df0f2..0c4e263ac2 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -695,6 +695,7 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item) void QQuickShaderEffectSource::sourceItemDestroyed(QObject *item) { Q_ASSERT(item == m_sourceItem); + Q_UNUSED(item); m_sourceItem = 0; update(); emit sourceItemChanged(); diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index fee49593ee..6dd8fb157d 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -59,6 +59,7 @@ #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" +#include "qquickaccessibleattached_p.h" #endif QT_BEGIN_NAMESPACE @@ -3374,9 +3375,11 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e #ifdef QT_NO_ACCESSIBILITY Q_UNUSED(changed) #else - if (changed) { - QAccessibleTextUpdateEvent ev(q, 0, oldText, m_text); - QAccessible::updateAccessibility(&ev); + if (changed && QAccessible::isActive()) { + if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) { + QAccessibleTextUpdateEvent ev(acc, 0, oldText, m_text); + QAccessible::updateAccessibility(&ev); + } } #endif } @@ -4025,8 +4028,12 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged() } #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextCursorEvent ev(q, m_cursor); - QAccessible::updateAccessibility(&ev); + if (QAccessible::isActive()) { + if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) { + QAccessibleTextCursorEvent ev(acc, m_cursor); + QAccessible::updateAccessibility(&ev); + } + } #endif return true; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index a915430616..2cde3cc434 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1421,6 +1421,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce return false; } +#ifndef QT_NO_WHEELEVENT bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event) { Q_Q(QQuickWindow); @@ -1457,7 +1458,6 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event return false; } -#ifndef QT_NO_WHEELEVENT /*! \reimp */ void QQuickWindow::wheelEvent(QWheelEvent *event) { @@ -2058,9 +2058,11 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e) item->mouseUngrabEvent(); } break; +#ifndef QT_NO_WHEELEVENT case QEvent::Wheel: QQuickItemPrivate::get(item)->deliverWheelEvent(static_cast<QWheelEvent *>(e)); break; +#endif case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index fdf5fe2abb..c8ecd43238 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -131,7 +131,9 @@ public: bool deliverInitialMousePressEvent(QQuickItem *, QMouseEvent *); bool deliverMouseEvent(QMouseEvent *); bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *); +#ifndef QT_NO_WHEELEVENT bool deliverWheelEvent(QQuickItem *, QWheelEvent *); +#endif bool deliverTouchPoints(QQuickItem *, QTouchEvent *, const QList<QTouchEvent::TouchPoint> &, QSet<int> *, QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *); bool deliverTouchEvent(QTouchEvent *); diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 5da904ace2..1249468a4d 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -253,7 +253,7 @@ void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window) QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); cd->polishItems(); - int renderTime, syncTime; + int renderTime = 0, syncTime = 0; QTime renderTimer; if (qquick_render_timing()) renderTimer.start(); diff --git a/src/quick/quick.pro b/src/quick/quick.pro index 3eece29152..c4fceac33d 100644 --- a/src/quick/quick.pro +++ b/src/quick/quick.pro @@ -1,7 +1,5 @@ TARGET = QtQuick -CONFIG += dll warn_on - QT = core-private gui-private qml-private QT_PRIVATE = v8-private network diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp index 85564590df..86f43a5830 100644 --- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp @@ -69,7 +69,7 @@ static bool nodeLessThan(QSGNode *nodeA, QSGNode *nodeB) if (nodeA->type() != QSGNode::GeometryNodeType) return nodeA < nodeB; QSGGeometryNode *a = static_cast<QSGGeometryNode *>(nodeA); - QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeA); + QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeB); // Sort by clip... if (a->clipList() != b->clipList()) @@ -97,7 +97,7 @@ static bool nodeLessThanWithRenderOrder(QSGNode *nodeA, QSGNode *nodeB) if (nodeA->type() != QSGNode::GeometryNodeType) return nodeA < nodeB; QSGGeometryNode *a = static_cast<QSGGeometryNode *>(nodeA); - QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeA); + QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeB); // Sort by clip... if (a->clipList() != b->clipList()) diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index d9c04e1959..da2dfcda64 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -305,8 +305,8 @@ void QSGDefaultImageNode::setTexture(QSGTexture *texture) m_materialO.setTexture(texture); m_smoothMaterial.setTexture(texture); // Texture cleanup -// if (!texture.isNull()) -// m_material.setBlending(texture->hasAlphaChannel()); + if (texture) + m_material.setFlag(QSGMaterial::Blending, texture->hasAlphaChannel()); markDirty(DirtyMaterial); // Because the texture can be a different part of the atlas, we need to update it... @@ -355,12 +355,11 @@ void QSGDefaultImageNode::preprocess() doDirty = t->updateTexture(); updateGeometry(); } -// ### texture cleanup -// bool alpha = m_material.blending(); -// if (!m_material->texture().isNull() && alpha != m_material.texture()->hasAlphaChannel()) { -// m_material.setBlending(!alpha); -// doDirty = true; -// } + bool alpha = m_material.flags() & QSGMaterial::Blending; + if (m_material.texture() && alpha != m_material.texture()->hasAlphaChannel()) { + m_material.setFlag(QSGMaterial::Blending, !alpha); + doDirty = true; + } if (doDirty) markDirty(DirtyMaterial); diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp index e4a82ca091..71efda5846 100644 --- a/src/quick/util/qquickanimationcontroller.cpp +++ b/src/quick/util/qquickanimationcontroller.cpp @@ -67,6 +67,7 @@ void QQuickAnimationControllerPrivate::animationFinished(QAbstractAnimationJob * { Q_Q(QQuickAnimationController); Q_ASSERT(animationInstance && animationInstance == job); + Q_UNUSED(job); animationInstance->removeAnimationChangeListener(this, QAbstractAnimationJob::Completion | QAbstractAnimationJob::CurrentTime); @@ -84,6 +85,7 @@ void QQuickAnimationControllerPrivate::animationCurrentTimeChanged(QAbstractAnim { Q_Q(QQuickAnimationController); Q_ASSERT(animationInstance && animationInstance == job); + Q_UNUSED(job); const qreal newProgress = currentTime * 1.0 / animationInstance->duration(); if (progress != newProgress) { progress = newProgress; |