diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-22 21:21:39 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-22 21:21:39 +0200 |
commit | 2ff13bdf697adff8574c5cea716627c78fb6b5b3 (patch) | |
tree | f4eac21b3b54f62d9f79714f40d5c9f4804dfc0c /src/quick | |
parent | 9d487cd6bf8ad75de19a4c05eb3d2641ce4a5289 (diff) | |
parent | e13eece273195a9f39d29712a233a8dd00ddf71b (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I171c7dbb6a74fe743c2eec63e86e9c0bef7c7dfd
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/designer/qquickdesignercustomparserobject_p.h | 11 | ||||
-rw-r--r-- | src/quick/doc/src/includes/layout.qdocinc | 18 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 90 | ||||
-rw-r--r-- | src/quick/items/qquickitem.h | 6 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.h | 10 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgadaptationlayer.cpp | 2 |
8 files changed, 117 insertions, 23 deletions
diff --git a/src/quick/designer/qquickdesignercustomparserobject_p.h b/src/quick/designer/qquickdesignercustomparserobject_p.h index 06206443b2..e4d0765277 100644 --- a/src/quick/designer/qquickdesignercustomparserobject_p.h +++ b/src/quick/designer/qquickdesignercustomparserobject_p.h @@ -40,6 +40,17 @@ #ifndef QUICKDESIGNERCUSTOMPARSEROBJECT_H #define QUICKDESIGNERCUSTOMPARSEROBJECT_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 <QObject> #include <private/qqmlcustomparser_p.h> diff --git a/src/quick/doc/src/includes/layout.qdocinc b/src/quick/doc/src/includes/layout.qdocinc new file mode 100644 index 0000000000..723fbc515a --- /dev/null +++ b/src/quick/doc/src/includes/layout.qdocinc @@ -0,0 +1,18 @@ +//! [attached-properties] + +\li \l{Layout::minimumWidth}{Layout.minimumWidth} +\li \l{Layout::minimumHeight}{Layout.minimumHeight} +\li \l{Layout::preferredWidth}{Layout.preferredWidth} +\li \l{Layout::preferredHeight}{Layout.preferredHeight} +\li \l{Layout::maximumWidth}{Layout.maximumWidth} +\li \l{Layout::maximumHeight}{Layout.maximumHeight} +\li \l{Layout::fillWidth}{Layout.fillWidth} +\li \l{Layout::fillHeight}{Layout.fillHeight} +\li \l{Layout::alignment}{Layout.alignment} +\li \l{Layout::margins}{Layout.margins} +\li \l{Layout::topMargin}{Layout.leftMargin} +\li \l{Layout::rightMargin}{Layout.rightMargin} +\li \l{Layout::topMargin}{Layout.topMargin} +\li \l{Layout::bottomMargin}{Layout.bottomMargin} + +//! [attached-properties] diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index cbe1bac5c9..fd872a5912 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4297,12 +4297,12 @@ void QQuickItem::polish() */ void QQuickItem::mapFromItem(QQmlV4Function *args) const { + QV4::ExecutionEngine *v4 = args->v4engine(); if (args->length() != 3 && args->length() != 5) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } - QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); QV4::ScopedValue item(scope, (*args)[0]); @@ -4316,7 +4316,7 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const if (!itemObj && !item->isNull()) { qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow() << "\" which is neither null nor an Item"; - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } @@ -4324,7 +4324,7 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const QV4::ScopedValue vy(scope, (*args)[2]); if (!vx->isNumber() || !vy->isNumber()) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } @@ -4337,7 +4337,7 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const QV4::ScopedValue vw(scope, (*args)[3]); QV4::ScopedValue vh(scope, (*args)[4]); if (!vw->isNumber() || !vh->isNumber()) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } qreal w = vw->asDouble(); @@ -4385,12 +4385,12 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const */ void QQuickItem::mapToItem(QQmlV4Function *args) const { + QV4::ExecutionEngine *v4 = args->v4engine(); if (args->length() != 3 && args->length() != 5) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } - QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); QV4::ScopedValue item(scope, (*args)[0]); @@ -4404,7 +4404,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const if (!itemObj && !item->isNull()) { qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow() << "\" which is neither null nor an Item"; - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } @@ -4412,7 +4412,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const QV4::ScopedValue vy(scope, (*args)[2]); if (!vx->isNumber() || !vy->isNumber()) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } @@ -4425,7 +4425,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const QV4::ScopedValue vw(scope, (*args)[3]); QV4::ScopedValue vh(scope, (*args)[4]); if (!vw->isNumber() || !vh->isNumber()) { - args->v4engine()->throwTypeError(); + v4->throwTypeError(); return; } qreal w = vw->asDouble(); @@ -4441,6 +4441,76 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const } /*! + \since 5.7 + \qmlmethod object QtQuick::Item::mapFromGlobal(real x, real y) + + Maps the point (\a x, \a y), which is in the global coordinate system, to the + item's coordinate system, and returns a \l point matching the mapped coordinate. +*/ +/*! + \internal + */ +void QQuickItem::mapFromGlobal(QQmlV4Function *args) const +{ + QV4::ExecutionEngine *v4 = args->v4engine(); + if (args->length() != 2) { + v4->throwTypeError(); + return; + } + + QV4::Scope scope(v4); + QV4::ScopedValue vx(scope, (*args)[0]); + QV4::ScopedValue vy(scope, (*args)[1]); + + if (!vx->isNumber() || !vy->isNumber()) { + v4->throwTypeError(); + return; + } + + qreal x = vx->asDouble(); + qreal y = vy->asDouble(); + QVariant result = mapFromGlobal(QPointF(x, y)); + + QV4::ScopedObject rv(scope, v4->fromVariant(result)); + args->setReturnValue(rv.asReturnedValue()); +} + +/*! + \since 5.7 + \qmlmethod object QtQuick::Item::mapToGlobal(real x, real y) + + Maps the point (\a x, \a y), which is in this item's coordinate system, to the + global coordinate system, and returns a \l point matching the mapped coordinate. +*/ +/*! + \internal + */ +void QQuickItem::mapToGlobal(QQmlV4Function *args) const +{ + QV4::ExecutionEngine *v4 = args->v4engine(); + if (args->length() != 2) { + v4->throwTypeError(); + return; + } + + QV4::Scope scope(v4); + QV4::ScopedValue vx(scope, (*args)[0]); + QV4::ScopedValue vy(scope, (*args)[1]); + + if (!vx->isNumber() || !vy->isNumber()) { + v4->throwTypeError(); + return; + } + + qreal x = vx->asDouble(); + qreal y = vy->asDouble(); + QVariant result = mapToGlobal(QPointF(x, y)); + + QV4::ScopedObject rv(scope, v4->fromVariant(result)); + args->setReturnValue(rv.asReturnedValue()); +} + +/*! \qmlmethod QtQuick::Item::forceActiveFocus() Forces active focus on the item. diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 510d46739a..b1b1d627b1 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -320,12 +320,12 @@ public: QTransform itemTransform(QQuickItem *, bool *) const; QPointF mapToItem(const QQuickItem *item, const QPointF &point) const; QPointF mapToScene(const QPointF &point) const; - Q_REVISION(7) Q_INVOKABLE QPointF mapToGlobal(const QPointF &point) const; + QPointF mapToGlobal(const QPointF &point) const; QRectF mapRectToItem(const QQuickItem *item, const QRectF &rect) const; QRectF mapRectToScene(const QRectF &rect) const; QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const; QPointF mapFromScene(const QPointF &point) const; - Q_REVISION(7) Q_INVOKABLE QPointF mapFromGlobal(const QPointF &point) const; + QPointF mapFromGlobal(const QPointF &point) const; QRectF mapRectFromItem(const QQuickItem *item, const QRectF &rect) const; QRectF mapRectFromScene(const QRectF &rect) const; @@ -333,6 +333,8 @@ public: Q_INVOKABLE void mapFromItem(QQmlV4Function*) const; Q_INVOKABLE void mapToItem(QQmlV4Function*) const; + Q_REVISION(7) Q_INVOKABLE void mapFromGlobal(QQmlV4Function*) const; + Q_REVISION(7) Q_INVOKABLE void mapToGlobal(QQmlV4Function*) const; Q_INVOKABLE void forceActiveFocus(); Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason); Q_REVISION(1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 944f24c4ad..0705d9b504 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -349,6 +349,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickShaderEffectSource, 1>(uri, 2, 6, "ShaderEffectSource"); #endif + qmlRegisterType<QQuickItem, 7>(uri, 2, 7, "Item"); #if QT_CONFIG(quick_listview) qmlRegisterType<QQuickListView, 7>(uri, 2, 7, "ListView"); #endif diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 4c9a1f8dfc..9a43ee8bdf 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -766,7 +766,7 @@ void QQuickTextInput::setMaxLength(int ml) (but without actually giving it active focus). It should not be set directly on the item, like in the below QML, - as the specified value will be overridden an lost on focus changes. + as the specified value will be overridden and lost on focus changes. \code TextInput { diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 00acb51c8a..7a916610e3 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -88,15 +88,7 @@ public: UnsignedShortType = 0x1403, IntType = 0x1404, UnsignedIntType = 0x1405, - FloatType = 0x1406, - - TypeByte = ByteType, - TypeUnsignedByte = UnsignedByteType, - TypeShort = ShortType, - TypeUnsignedShort = UnsignedShortType, - TypeInt = IntType, - TypeUnsignedInt = UnsignedIntType, - TypeFloat = FloatType + FloatType = 0x1406 }; struct Q_QUICK_EXPORT Attribute diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index e219ddd82e..9923fa6e24 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -122,7 +122,7 @@ void QSGDistanceFieldGlyphCache::populate(const QVector<glyph_t> &glyphs) int count = glyphs.count(); for (int i = 0; i < count; ++i) { glyph_t glyphIndex = glyphs.at(i); - if ((int) glyphIndex >= glyphCount()) { + if ((int) glyphIndex >= glyphCount() && glyphCount() > 0) { qWarning("Warning: distance-field glyph is not available with index %d", glyphIndex); continue; } |