diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-11-03 11:01:45 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-11-03 11:01:45 +0100 |
commit | da5083c11df4d9a6decd8d724098b6f108c4ab35 (patch) | |
tree | ee331004123ef2795025637c2905d9719f95f317 /src/quick | |
parent | 462904396454ed0ee931c2a8f2b02c8a6508965a (diff) | |
parent | ef502bd71a0d81f1428263a11c38cd7c893ac515 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
tools/qmljs/qmljs.cpp
Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/accessible/qaccessiblequickitem.cpp | 4 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/localstorage/dbtransaction.js | 31 | ||||
-rw-r--r-- | src/quick/items/qquickdrag.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontextplugin.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickshortcut.cpp | 55 |
9 files changed, 68 insertions, 38 deletions
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index 58eab508ad..03236ce2f7 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -67,10 +67,6 @@ int QAccessibleQuickItem::childCount() const QRect QAccessibleQuickItem::rect() const { const QRect r = itemScreenRect(item()); - - if (!r.isValid()) { - qWarning() << item()->metaObject()->className() << item()->property("accessibleText") << r; - } return r; } diff --git a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js index 07d8a5618b..40eb6d2804 100644 --- a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js +++ b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js @@ -39,30 +39,47 @@ ****************************************************************************/ //![0] +var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000); db.transaction( try { function(tx) { - tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)', + [ '01/10/2016','Sylling - Vikersund', '53' ]); } } catch (err) { - console.log("Error inserting into table Greeting"); + console.log("Error inserting into table Greeting: " + err); } ) //![0] //![1] +// Retrieve activity date, description and distance based on minimum +// distance parameter Pdistance +function db_distance_select(Pdistance) +{ +var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000); db.transaction( function(tx) { - var results = tx.executeSql('SELECT salutation FROM Greeting WHERE salutee=?;', 'world'); + var results = tx.executeSql('SELECT rowid, + date, + trip_desc, + distance FROM trip_log + 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, + "trip_desc": results.rows.item(i).trip_desc, + "distance": results.rows.item(i).distance}); + } } - console.log("We greeted in this most respectful way: " + results.rows.item(0).value); -) +} //![1] //![2] -var db = LocalStorage.openDatabaseSync("QQmlExampleDB", "", "The Example QML SQL!", 1000000); +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 Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)', + [ '01/10/2016','Sylling - Vikersund', '53' ]); } }); //![2] diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index b943c28661..cbb052856e 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -749,7 +749,7 @@ void QQuickDragAttached::cancel() */ /*! - \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction action) + \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction dropAction) This signal is emitted when a drag finishes and the drag was started with the \l startDrag() method or started automatically using the \l dragType property. diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index fd872a5912..a05bb1617e 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -6303,7 +6303,7 @@ QPointF QQuickItem::position() const void QQuickItem::setX(qreal v) { Q_D(QQuickItem); - if (qIsNaN(v)) + if (qt_is_nan(v)) return; if (d->x == v) return; @@ -6320,7 +6320,7 @@ void QQuickItem::setX(qreal v) void QQuickItem::setY(qreal v) { Q_D(QQuickItem); - if (qIsNaN(v)) + if (qt_is_nan(v)) return; if (d->y == v) return; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 9a43ee8bdf..16278ad744 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2340,8 +2340,8 @@ QString QQuickTextInput::preeditText() const If true, the user can use the mouse to select text in some platform-specific way. Note that for some platforms this may - not be an appropriate interaction (eg. may conflict with how - the text needs to behave inside a Flickable. + not be an appropriate interaction (it may conflict with how + the text needs to behave inside a \l Flickable, for example). */ bool QQuickTextInput::selectByMouse() const { diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f81c939ec6..dec5b44e2a 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1799,6 +1799,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event if (item->contains(p)) { QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted()); + wheel.setTimestamp(event->timestamp()); wheel.accept(); QCoreApplication::sendEvent(item, &wheel); if (wheel.isAccepted()) { diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 3751891455..7fab9aeae8 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -148,9 +148,9 @@ QSGAdaptationBackendData *contextFactory() } } +#ifndef QT_NO_LIBRARY // Then try the plugins. if (!backendData->factory) { -#ifndef QT_NO_LIBRARY const int index = loader()->indexOf(requestedBackend); if (index != -1) backendData->factory = qobject_cast<QSGContextFactoryInterface*>(loader()->instance(index)); diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 3501f30487..b001899915 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -240,7 +240,8 @@ bool QSG24BitTextMaskShader::useSRGB() const // m_useSRGB is true, but if some QOGLFBO was bound check it's texture format: QOpenGLContext *ctx = QOpenGLContext::currentContext(); QOpenGLFramebufferObject *qfbo = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo; - return !qfbo || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; + bool fboInvalid = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid; + return !qfbo || fboInvalid || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; #else return m_useSRGB; #endif diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 9725ddd671..3e04161639 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -41,10 +41,9 @@ #include <QtQuick/qquickitem.h> #include <QtQuick/qquickwindow.h> +#include <QtQuick/private/qtquickglobal_p.h> #include <QtGui/private/qguiapplication_p.h> -QT_BEGIN_NAMESPACE - /*! \qmltype Shortcut \instantiates QQuickShortcut @@ -89,6 +88,39 @@ QT_BEGIN_NAMESPACE The corresponding handler is \c onActivatedAmbiguously. */ +static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context) +{ + switch (context) { + case Qt::ApplicationShortcut: + return true; + case Qt::WindowShortcut: + while (obj && !obj->isWindowType()) { + obj = obj->parent(); + if (QQuickItem *item = qobject_cast<QQuickItem *>(obj)) + obj = item->window(); + } + return obj && obj == QGuiApplication::focusWindow(); + default: + return false; + } +} + +typedef bool (*ContextMatcher)(QObject *, Qt::ShortcutContext); + +Q_GLOBAL_STATIC_WITH_ARGS(ContextMatcher, ctxMatcher, (qQuickShortcutContextMatcher)) + +Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher() +{ + return *ctxMatcher(); +} + +Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher) +{ + *ctxMatcher() = matcher; +} + +QT_BEGIN_NAMESPACE + QQuickShortcut::QQuickShortcut(QObject *parent) : QObject(parent), m_id(0), m_enabled(true), m_completed(false), m_autorepeat(true), m_context(Qt::WindowShortcut) { @@ -278,30 +310,13 @@ bool QQuickShortcut::event(QEvent *event) return false; } -static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context) -{ - switch (context) { - case Qt::ApplicationShortcut: - return true; - case Qt::WindowShortcut: - while (obj && !obj->isWindowType()) { - obj = obj->parent(); - if (QQuickItem *item = qobject_cast<QQuickItem *>(obj)) - obj = item->window(); - } - return obj && obj == QGuiApplication::focusWindow(); - default: - return false; - } -} - void QQuickShortcut::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context) { ungrabShortcut(); if (m_completed && !sequence.isEmpty()) { QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance(); - m_id = pApp->shortcutMap.addShortcut(this, sequence, context, qQuickShortcutContextMatcher); + m_id = pApp->shortcutMap.addShortcut(this, sequence, context, *ctxMatcher()); if (!m_enabled) pApp->shortcutMap.setShortcutEnabled(false, m_id, this); if (!m_autorepeat) |