diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-12-28 12:51:36 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-12-28 12:58:48 +0100 |
commit | ae9e6d4ad7b7a67e90a16af432b55de5b3d7dbb5 (patch) | |
tree | f37c6631d4b9854d1f3667622c132893a66e56f0 /src/quick | |
parent | 3eeffae835b3474c8a3ca62125cb8ec24acdaa84 (diff) | |
parent | 9a272ad1854d744ea57296ba633b9d0dc19d1625 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Change-Id: Ib0be3797bfd07589ae177495173dc43c0133ca90
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/doc/images/qml-localstorage-example.png | bin | 14409 -> 13957 bytes | |||
-rw-r--r-- | src/quick/doc/snippets/qml/localstorage/dbtransaction.js | 30 | ||||
-rwxr-xr-x | src/quick/items/checksync.pl | 106 | ||||
-rw-r--r-- | src/quick/items/qquickevents.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 19 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 1 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 3 |
10 files changed, 46 insertions, 130 deletions
diff --git a/src/quick/doc/images/qml-localstorage-example.png b/src/quick/doc/images/qml-localstorage-example.png Binary files differindex e128574683..64e1cb0315 100644 --- a/src/quick/doc/images/qml-localstorage-example.png +++ b/src/quick/doc/images/qml-localstorage-example.png diff --git a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js index 40eb6d2804..38733a8e2c 100644 --- a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js +++ b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js @@ -43,11 +43,11 @@ var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking db.transaction( try { function(tx) { - tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)', - [ '01/10/2016','Sylling - Vikersund', '53' ]); + tx.executeSql("INSERT INTO trip_log VALUES(?, ?, ?)", + [ "01/10/2016","Sylling - Vikersund", "53" ]); } } catch (err) { - console.log("Error inserting into table Greeting: " + err); + console.log("Error inserting into table trip_log: " + err); } ) //![0] @@ -60,11 +60,11 @@ function db_distance_select(Pdistance) var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000); db.transaction( function(tx) { - var results = tx.executeSql('SELECT rowid, + var results = tx.executeSql("SELECT rowid, date, trip_desc, distance FROM trip_log - where distance >= ?',[Pdistance]'); + where distance >= ?",[Pdistance]); for (var i = 0; i < results.rows.length; i++) { listModel.append({"id": results.rows.item(i).rowid, "date": results.rows.item(i).date, @@ -76,10 +76,22 @@ db.transaction( //![1] //![2] var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000); -if (db.version == '0.1') { - db.changeVersion('0.1', '0.2', function(tx) { - tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)', - [ '01/10/2016','Sylling - Vikersund', '53' ]); +if (db.version == "0.1") { + db.changeVersion("0.1", "0.2", function(tx) { + tx.executeSql("INSERT INTO trip_log VALUES(?, ?, ?)", + [ "01/10/2016","Sylling - Vikersund", "53" ]); } }); //![2] +//![3] +create table trip_log(date text, data text) +//![3] +//![4] +var obj = {description = "Vikersund - Noresund", distance = "60"} +//![4] +//![5] +db.transaction(function(tx) { + result = tx.executeSQL("insert into trip_log values (?,?)", + ["01/11/2016", JSON.stringify(obj)]) +} +//![5] diff --git a/src/quick/items/checksync.pl b/src/quick/items/checksync.pl deleted file mode 100755 index c9771bb10c..0000000000 --- a/src/quick/items/checksync.pl +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/perl -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the Declarative module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 3 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL3 included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 3 requirements -## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 2.0 or (at your option) the GNU General -## Public license version 3 or any later version approved by the KDE Free -## Qt Foundation. The licenses are as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-2.0.html and -## https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -use strict; -use warnings; - -die "Usage: $0 <QML directory>" if (@ARGV != 1); - -my @excludes; -open (SYNCEXCLUDES, "<", "syncexcludes"); -while (<SYNCEXCLUDES>) { - if (/^([a-zA-Z0-9\._]+)/) { - my $exclude = $1; - push (@excludes, $exclude); - } -} - -my $portdir = "."; -my $qmldir = $ARGV[0]; - -opendir (PORTDIR, $portdir) or die "Cannot open port directory"; -opendir (QMLDIR, $qmldir) or die "Cannot open QML directory"; - -my @portfiles = readdir(PORTDIR); -my @qmlfiles = readdir(QMLDIR); - -closedir(PORTDIR); -closedir(QMLDIR); - -foreach my $qmlfile (@qmlfiles) { - if ($qmlfile =~ /^qdeclarative.*\.cpp$/ or $qmlfile =~ /qdeclarative.*\.h$/) { - - if (grep { $_ eq $qmlfile} @excludes) { - next; - } - - my $portfile = $qmlfile; - $portfile =~ s/^qdeclarative/qsg/; - - if (grep { $_ eq $portfile} @portfiles) { - - open (PORTFILE, "<", "$portdir/$portfile") or die("Cannot open $portdir/$portfile for reading"); - - my $firstline = <PORTFILE>; - - close (PORTFILE); - - if ($firstline and $firstline =~ /^\/\/ Commit: ([a-z0-9]+)/) { - my $sha1 = $1; - my $commitSha1 = ""; - - my $output = `cd $qmldir; git log $qmlfile | head -n 1`; - if ($output =~ /commit ([a-z0-9]+)/) { - $commitSha1 = $1; - } - - if ($commitSha1 eq $sha1) { - print ("$portfile: OK\n"); - } else { - print ("$portfile: OUT OF DATE\n"); - } - } else { - print ("$portfile: OUT OF DATE\n"); - } - } else { - print ("$portfile: MISSING\n"); - } - } -} diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index f8038ed11f..1fd9014408 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -634,7 +634,7 @@ void QQuickEventTouchPoint::reset(const QTouchEvent::TouchPoint &tp, ulong times QQuickEventPoint::reset(tp.state(), tp.scenePos(), tp.id(), timestamp, tp.velocity()); m_rotation = tp.rotation(); m_pressure = tp.pressure(); -// m_uniqueId = tp.uniqueId(); + m_uniqueId = tp.uniqueId(); } /*! diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index e8bc307b1a..33574deb9d 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -326,8 +326,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint Q_OBJECT Q_PROPERTY(qreal rotation READ rotation) Q_PROPERTY(qreal pressure READ pressure) -// TODO rename to QPointingDeviceUniqueId -// Q_PROPERTY(QPointerUniqueId uniqueId READ uniqueId) + Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) public: QQuickEventTouchPoint(QQuickPointerTouchEvent *parent); @@ -336,12 +335,12 @@ public: qreal rotation() const { return m_rotation; } qreal pressure() const { return m_pressure; } -// QPointerUniqueId uniqueId() const { return m_uniqueId; } + QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } private: qreal m_rotation; qreal m_pressure; -// QPointerUniqueId m_uniqueId; + QPointingDeviceUniqueId m_uniqueId; Q_DISABLE_COPY(QQuickEventTouchPoint) }; @@ -478,7 +477,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerDevice : public QObject Q_PROPERTY(int maximumTouchPoints READ maximumTouchPoints CONSTANT) Q_PROPERTY(int buttonCount READ buttonCount CONSTANT) Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(qint64 uniqueId READ uniqueId CONSTANT) + Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT) public: enum DeviceType { @@ -523,7 +522,6 @@ public: Q_ENUM(CapabilityFlag) Q_FLAG(Capabilities) - DeviceType type() const { return m_deviceType; } PointerType pointerType() const { return m_pointerType; } Capabilities capabilities() const { return m_capabilities; } @@ -531,7 +529,7 @@ public: int maximumTouchPoints() const { return m_maximumTouchPoints; } int buttonCount() const { return m_buttonCount; } QString name() const { return m_name; } - qint64 uniqueId() const { return m_uniqueId; } + QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } QQuickPointerEvent *pointerEvent() const { return m_event; } static QQuickPointerDevice *touchDevice(QTouchDevice *d); @@ -542,7 +540,8 @@ public: private: QQuickPointerDevice(DeviceType devType, PointerType pType, Capabilities caps, int maxPoints, int buttonCount, const QString &name, qint64 uniqueId = 0) : m_deviceType(devType), m_pointerType(pType), m_capabilities(caps) - , m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name), m_uniqueId(uniqueId), m_event(nullptr) + , m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name) + , m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId)), m_event(nullptr) { if (m_deviceType == Mouse) { m_event = new QQuickPointerMouseEvent; @@ -561,7 +560,7 @@ private: int m_maximumTouchPoints; int m_buttonCount; QString m_name; - qint64 m_uniqueId; + QPointingDeviceUniqueId m_uniqueId; // the device-specific event instance which is reused during event delivery QQuickPointerEvent *m_event; @@ -585,7 +584,7 @@ QML_DECLARE_TYPE(QQuickMouseEvent) QML_DECLARE_TYPE(QQuickWheelEvent) QML_DECLARE_TYPE(QQuickCloseEvent) QML_DECLARE_TYPE(QQuickPointerDevice) -//QML_DECLARE_TYPE(QPointerUniqueId) +QML_DECLARE_TYPE(QPointingDeviceUniqueId) QML_DECLARE_TYPE(QQuickPointerEvent) #endif // QQUICKEVENTS_P_P_H diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index dbe30fbc83..b0ddbb0034 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -298,8 +298,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid"); #endif #if QT_CONFIG(quick_itemview) - qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); - qmlRegisterUncreatableType<QQuickItemView, 2>(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); + const char *itemViewName = "ItemView"; + const QString itemViewMessage = QQuickItemView::tr("ItemView is an abstract base class"); + qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, itemViewName, itemViewMessage); + qmlRegisterUncreatableType<QQuickItemView, 2>(uri, 2, 3, itemViewName, itemViewMessage); #endif #if QT_CONFIG(quick_listview) qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView"); @@ -361,6 +363,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) #if QT_CONFIG(quick_pathview) qmlRegisterType<QQuickPathView, 7>(uri, 2, 7, "PathView"); #endif +#if QT_CONFIG(quick_itemview) + qmlRegisterUncreatableType<QQuickItemView, 7>(uri, 2, 7, itemViewName, itemViewMessage); +#endif qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 13e13890b7..03d96aea1f 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -380,6 +380,9 @@ QImage QQuickRenderControl::grab() if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) { #if QT_CONFIG(opengl) + QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); + cd->polishItems(); + cd->syncSceneGraph(); render(); grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false); #endif @@ -394,6 +397,8 @@ QImage QQuickRenderControl::grab() QPaintDevice *prevDev = softwareRenderer->currentPaintDevice(); softwareRenderer->setCurrentPaintDevice(&grabContent); softwareRenderer->markDirty(); + cd->polishItems(); + cd->syncSceneGraph(); render(); softwareRenderer->setCurrentPaintDevice(prevDev); } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 6771c0e940..6db96f369c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -898,6 +898,7 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf) } else if (buffer->size != byteSize) { free(buffer->data); buffer->data = (char *) malloc(byteSize); + Q_CHECK_PTR(buffer->data); } buffer->size = byteSize; } diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index a278c6079b..69a8c21ed2 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -675,6 +675,7 @@ void QSGGeometry::allocate(int vertexCount, int indexCount) Q_ASSERT(m_index_type == UnsignedIntType || m_index_type == UnsignedShortType); int indexByteSize = indexCount * (m_index_type == UnsignedShortType ? sizeof(quint16) : sizeof(quint32)); m_data = (void *) malloc(vertexByteSize + indexByteSize); + Q_CHECK_PTR(m_data); m_index_data_offset = vertexByteSize; m_owns_data = true; } diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index e673df0451..4afcb07a5c 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -56,8 +56,7 @@ namespace QQuickValueTypes { QString QQuickColorValueType::toString() const { - // to maintain behaviour with QtQuick 1.0, we just output normal toString() value. - return QVariant(v).toString(); + return v.name(v.alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); } qreal QQuickColorValueType::r() const |