diff options
author | Liang Qi <liang.qi@qt.io> | 2019-11-21 11:34:57 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-22 09:50:11 +0100 |
commit | aa3813366a8e772cd58c9253461cf2dc50b97a9d (patch) | |
tree | e306a60fa9b2d1f7dd2e6b245fdf05214c7c55df /src/quick | |
parent | 4241bb4d26ef69eb212e0274bad0926ec71bead9 (diff) | |
parent | acb6ed0815f92588c3ff875a568e9561fe61218c (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/qml/qml/qqmlextensionplugin.cpp
tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
Change-Id: Ic58d36a8532015bae30f2690063db9829b3bf372
Diffstat (limited to 'src/quick')
24 files changed, 168 insertions, 50 deletions
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 91458527dd..0d46e3408d 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -38,7 +38,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtqml qtqmltest qtgui qtlinguist qtquickcontrols qtquickcontrols1 qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns +depends += qtcore qtqml qtqmlmodels qtqmltest qtgui qtlinguist qtquickcontrols qtquickcontrols1 qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns headerdirs += ..\ ../../quick \ @@ -70,6 +70,9 @@ sourcedirs += ../../plugins #exclude certain directories excludedirs += ../../imports/models \ + ../../imports/labsmodels \ + ../../imports/testlib \ + ../../imports/workerscript \ ../../imports/statemachine excludefiles += ../util/qquickpropertychanges_p.h diff --git a/src/quick/doc/snippets/cmake-macros/examples.cmake b/src/quick/doc/snippets/cmake-macros/examples.cmake index 8ca6180f9b..cecc59debc 100644 --- a/src/quick/doc/snippets/cmake-macros/examples.cmake +++ b/src/quick/doc/snippets/cmake-macros/examples.cmake @@ -3,4 +3,4 @@ find_package(Qt5 COMPONENTS Quick QmlImportScanner) add_executable(myapp main.cpp) target_link_libraries(myapp Qt5::Quick) qt5_import_qml_plugins(myapp) -#! [qt5_import_plugins] +#! [qt5_import_qml_plugins] diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc index e83aa39734..88003b68d3 100644 --- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc @@ -55,7 +55,7 @@ appropriate for the various graphics APIs. Unlike \c software or \c d3d12, the RHI-based renderer is not an additional adaptation, and is always built-in. As of Qt 5.14 it can be enabled by setting the environment variable \c{QSG_RHI} to a non-zero value before starting the -application, or via \l QQuickWindow::setScenegraphBackend() in combination with +application, or via \l QQuickWindow::setSceneGraphBackend() in combination with \l QSGRendererInterface::GraphicsApi. When none of this is done, OpenGL is used directly like in previous versions. diff --git a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc index f4a1616943..abfff7cc11 100644 --- a/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc +++ b/src/quick/doc/src/guidelines/qtquick-bestpractices.qdoc @@ -402,6 +402,43 @@ property MyMenu optionsMenu For information on performance in QML and Qt Quick, see \l {Performance Considerations And Suggestions}. +\section1 Prefer Declarative Bindings Over Imperative Assignments + +In QML, it's possible to use imperative JavaScript code to perform tasks +such as responding to input events, send data over a network, and so on. +Imperative code has an important place in QML, but it's also important +to be aware of when not to use it. + +For example, consider the following imperative assignment: + +\code +Rectangle { + Component.onCompleted: color = "red" +} +\endcode + +This has the following disadvantages: + +\list +\li It's slow. The color property will first be evaluated with a + default-constructed value, and then again with "red" later on. +\li It delays errors that could be found at build time to run time, slowing + down the development process. +\li It overwrites any declarative binding that was in place. In most cases this + is intended, but sometimes it can be unintentional. + See \l {Debugging overwriting of bindings} for more information. +\li It interferes with tooling; Qt Quick Designer, for example, doesn't support + JavaScript. +\endlist + +The code can be rewritten to be a declarative binding instead: + +\code +Rectangle { + color: "red" +} +\endcode + \section1 Tools and Utilities For information on useful tools and utilies that make working with QML and diff --git a/src/quick/handlers/qquickwheelhandler.cpp b/src/quick/handlers/qquickwheelhandler.cpp index 90e4fef97e..aef2e8ebfb 100644 --- a/src/quick/handlers/qquickwheelhandler.cpp +++ b/src/quick/handlers/qquickwheelhandler.cpp @@ -49,6 +49,7 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel") /*! \qmltype WheelHandler \instantiates QQuickWheelHandler + \inherits SinglePointHandler \inqmlmodule QtQuick \ingroup qtquick-input-handlers \brief Handler for the mouse wheel. @@ -71,7 +72,7 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel") \snippet pointerHandlers/handlerFlick.qml 0 - Alternatively if \l targetProperty is not set or \l target is null, + Alternatively, if \l property is not set or \l target is null, WheelHandler will not automatically manipulate anything; but the \l rotation property can be used in a binding to manipulate another property, or you can implement \c onWheel and handle the wheel event @@ -79,15 +80,16 @@ Q_LOGGING_CATEGORY(lcWheelHandler, "qt.quick.handler.wheel") WheelHandler handles only a rotating mouse wheel by default. Optionally it can handle smooth-scrolling events from touchpad gestures, - by setting \l acceptedDevices to \c{PointerDevice.Mouse | PointerDevice.TouchPad}. + by setting \l {QtQuick::PointerDeviceHandler::}{acceptedDevices} to + \c{PointerDevice.Mouse | PointerDevice.TouchPad}. \note Some non-mouse hardware (such as a touch-sensitive Wacom tablet, or a Linux laptop touchpad) generates real wheel events from gestures. WheelHandler will respond to those events as wheel events regardless of the - setting of the \l acceptedDevices property. + setting of the \l {QtQuick::PointerDeviceHandler::}{acceptedDevices} + property. - \sa MouseArea - \sa Flickable + \sa MouseArea, Flickable */ QQuickWheelHandler::QQuickWheelHandler(QQuickItem *parent) @@ -125,13 +127,13 @@ void QQuickWheelHandler::setOrientation(Qt::Orientation orientation) \qmlproperty bool QtQuick::WheelHandler::invertible Whether or not to reverse the direction of property change if - \l QQuickPointerScrollEvent::inverted is true. The default is \c true. + QQuickPointerScrollEvent::inverted is true. The default is \c true. If the operating system has a "natural scrolling" setting that causes scrolling to be in the same direction as the finger movement, then if this property is set to \c true, and WheelHandler is directly setting a property on \l target, the direction of movement will correspond to the system setting. - If this property is set to \l false, it will invert the \l rotation so that + If this property is set to \c false, it will invert the \l rotation so that the direction of motion is always the same as the direction of finger movement. */ bool QQuickWheelHandler::isInvertible() const diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index c150e4efa2..2da01e9151 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -433,6 +433,19 @@ void QQuickAccessibleAttached::setRole(QAccessible::Role role) } } +bool QQuickAccessibleAttached::wasNameExplicitlySet() const +{ + return m_nameExplicitlySet; +} + +// Allows types to attach an accessible name to an item as a convenience, +// so long as the user hasn't done so themselves. +void QQuickAccessibleAttached::setNameImplicitly(const QString &name) +{ + setName(name); + m_nameExplicitlySet = false; +} + QQuickAccessibleAttached *QQuickAccessibleAttached::qmlAttachedProperties(QObject *obj) { return new QQuickAccessibleAttached(obj); diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index 678c1361ba..b7254d6686 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -122,7 +122,10 @@ public: return QString(); return m_name; } + + bool wasNameExplicitlySet() const; void setName(const QString &name) { + m_nameExplicitlySet = true; if (name != m_name) { m_name = name; Q_EMIT nameChanged(); @@ -130,6 +133,7 @@ public: QAccessible::updateAccessibility(&ev); } } + void setNameImplicitly(const QString &name); QString description() const { return m_description; } void setDescription(const QString &description) @@ -220,6 +224,7 @@ private: QAccessible::State m_state; QAccessible::State m_stateExplicitlySet; QString m_name; + bool m_nameExplicitlySet = false; QString m_description; static QMetaMethod sigPress; diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4c20b7e2e1..3785abc450 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2074,10 +2074,10 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) in the GPU equal to \c {width x height x 4}. In memory constrained configurations, large layers should be used with care. - In the QPainter / QWidget world, it is some times favorable to + In the QPainter / QWidget world, it is sometimes favorable to cache complex content in a pixmap, image or texture. In Qt Quick, because of the techniques already applied by the \l {Qt Quick - Scene Graph OpenGL Renderer} {scene graph renderer}, this will in most + Scene Graph Default Renderer} {scene graph renderer}, this will in most cases not be the case. Excessive draw calls are already reduced because of batching and a cache will in most cases end up blending more pixels than the original content. The overhead of rendering diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 661f19509a..7c74eafd3a 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1790,6 +1790,7 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to) if (prevCount != itemCount) emit q->countChanged(); } while (currentChanges.hasPendingChanges() || bufferedChanges.hasPendingChanges()); + storeFirstVisibleItemPosition(); } void QQuickItemViewPrivate::regenerate(bool orientationChanged) @@ -1876,6 +1877,7 @@ void QQuickItemViewPrivate::layout() updateSections(); layoutVisibleItems(); + storeFirstVisibleItemPosition(); int lastIndexInView = findLastIndexInView(); refill(); @@ -1960,7 +1962,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult prevFirstItemInViewPos = prevFirstItemInView->position(); prevFirstItemInViewIndex = prevFirstItemInView->index; } - qreal prevVisibleItemsFirstPos = visibleItems.count() ? visibleItems.constFirst()->position() : 0.0; + qreal prevVisibleItemsFirstPos = visibleItems.count() ? firstVisibleItemPosition : 0.0; totalInsertionResult->visiblePos = prevFirstItemInViewPos; totalRemovalResult->visiblePos = prevFirstItemInViewPos; @@ -2006,6 +2008,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult if (!insertions.isEmpty()) { repositionFirstItem(prevVisibleItemsFirst, prevVisibleItemsFirstPos, prevFirstItemInView, &insertionResult, &removalResult); layoutVisibleItems(removals.first().index); + storeFirstVisibleItemPosition(); } } @@ -2026,6 +2029,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult if (i < insertions.count() - 1) { repositionFirstItem(prevVisibleItemsFirst, prevVisibleItemsFirstPos, prevFirstItemInView, &insertionResult, &removalResult); layoutVisibleItems(insertions[i].index); + storeFirstVisibleItemPosition(); } itemCount += insertions[i].count; } diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index 6442fee27d..b31f53b2c0 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -260,6 +260,12 @@ public: MovementReason moveReason; QList<FxViewItem *> visibleItems; + qreal firstVisibleItemPosition = 0; + void storeFirstVisibleItemPosition() { + if (!visibleItems.isEmpty()) { + firstVisibleItemPosition = visibleItems.constFirst()->position(); + } + } int visibleIndex; int currentIndex; FxViewItem *currentItem; diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 725d35f325..778f28bdd5 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -808,6 +808,7 @@ void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex) FxViewItem *firstItem = *visibleItems.constBegin(); bool fixedCurrent = currentItem && firstItem->item == currentItem->item; + firstVisibleItemPosition = firstItem->position(); qreal sum = firstItem->size(); qreal pos = firstItem->position() + firstItem->size() + spacing; firstItem->setVisible(firstItem->endPosition() >= from && firstItem->position() <= to); @@ -2095,7 +2096,7 @@ QQuickListView::~QQuickListView() highlight item is \c 0. \sa highlightItem, highlightFollowsCurrentItem, - {Qt Quick Examples - Views#Highlight}{ListView highlight example}, + {Qt Quick Examples - Views#Using Highlight}{ListView Highlight Example}, {Stacking Order in ListView} */ diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 295c6898bc..89839c8aab 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -871,17 +871,13 @@ void QQuickTableViewPrivate::syncLoadedTableRectFromLoadedTable() loadedTableInnerRect = QRectF(topLeftRect.bottomRight(), bottomRightRect.topLeft()); } -void QQuickTableViewPrivate::forceLayout() +QQuickTableViewPrivate::RebuildOptions QQuickTableViewPrivate::checkForVisibilityChanges() { - if (loadedItems.isEmpty()) - return; - - clearEdgeSizeCache(); - RebuildOptions rebuildOptions = RebuildOption::LayoutOnly; - // Go through all columns from first to last, find the columns that used // to be hidden and not loaded, and check if they should become visible // (and vice versa). If there is a change, we need to rebuild. + RebuildOptions rebuildOptions = RebuildOption::None; + for (int column = leftColumn(); column <= rightColumn(); ++column) { const bool wasVisibleFromBefore = loadedColumns.contains(column); const bool isVisibleNow = !qFuzzyIsNull(getColumnWidth(column)); @@ -916,6 +912,28 @@ void QQuickTableViewPrivate::forceLayout() break; } + return rebuildOptions; +} + +void QQuickTableViewPrivate::forceLayout() +{ + if (loadedItems.isEmpty()) + return; + + clearEdgeSizeCache(); + RebuildOptions rebuildOptions = RebuildOption::None; + + const QSize actualTableSize = calculateTableSize(); + if (tableSize != actualTableSize) { + // This can happen if the app is calling forceLayout while + // the model is updated, but before we're notified about it. + rebuildOptions = RebuildOption::All; + } else { + rebuildOptions = checkForVisibilityChanges(); + if (!rebuildOptions) + rebuildOptions = RebuildOption::LayoutOnly; + } + scheduleRebuildTable(rebuildOptions); auto rootView = rootSyncView(); @@ -1183,19 +1201,14 @@ qreal QQuickTableViewPrivate::sizeHintForRow(int row) return rowHeight; } -void QQuickTableViewPrivate::calculateTableSize() +void QQuickTableViewPrivate::updateTableSize() { // tableSize is the same as row and column count, and will always // be the same as the number of rows and columns in the model. Q_Q(QQuickTableView); - QSize prevTableSize = tableSize; - if (tableModel) - tableSize = QSize(tableModel->columns(), tableModel->rows()); - else if (model) - tableSize = QSize(1, model->count()); - else - tableSize = QSize(0, 0); + const QSize prevTableSize = tableSize; + tableSize = calculateTableSize(); if (prevTableSize.width() != tableSize.width()) emit q->columnsChanged(); @@ -1203,6 +1216,16 @@ void QQuickTableViewPrivate::calculateTableSize() emit q->rowsChanged(); } +QSize QQuickTableViewPrivate::calculateTableSize() +{ + if (tableModel) + return QSize(tableModel->columns(), tableModel->rows()); + else if (model) + return QSize(1, model->count()); + + return QSize(0, 0); +} + qreal QQuickTableViewPrivate::getColumnLayoutWidth(int column) { // Return the column width specified by the application, or go @@ -1755,7 +1778,7 @@ void QQuickTableViewPrivate::calculateTopLeft(QPoint &topLeftCell, QPointF &topL void QQuickTableViewPrivate::beginRebuildTable() { - calculateTableSize(); + updateTableSize(); QPoint topLeft; QPointF topLeftPos; @@ -2291,6 +2314,7 @@ void QQuickTableViewPrivate::syncSyncView() void QQuickTableViewPrivate::connectToModel() { + Q_Q(QQuickTableView); Q_TABLEVIEW_ASSERT(model, ""); QObjectPrivate::connect(model, &QQmlInstanceModel::createdItem, this, &QQuickTableViewPrivate::itemCreatedCallback); @@ -2300,6 +2324,8 @@ void QQuickTableViewPrivate::connectToModel() const auto tm = tableModel.data(); QObjectPrivate::connect(tm, &QQmlTableInstanceModel::itemPooled, this, &QQuickTableViewPrivate::itemPooledCallback); QObjectPrivate::connect(tm, &QQmlTableInstanceModel::itemReused, this, &QQuickTableViewPrivate::itemReusedCallback); + // Connect atYEndChanged to a function that fetches data if more is available + QObjectPrivate::connect(q, &QQuickTableView::atYEndChanged, this, &QQuickTableViewPrivate::fetchMoreData); } if (auto const aim = model->abstractItemModel()) { @@ -2323,6 +2349,7 @@ void QQuickTableViewPrivate::connectToModel() void QQuickTableViewPrivate::disconnectFromModel() { + Q_Q(QQuickTableView); Q_TABLEVIEW_ASSERT(model, ""); QObjectPrivate::disconnect(model, &QQmlInstanceModel::createdItem, this, &QQuickTableViewPrivate::itemCreatedCallback); @@ -2332,6 +2359,7 @@ void QQuickTableViewPrivate::disconnectFromModel() const auto tm = tableModel.data(); QObjectPrivate::disconnect(tm, &QQmlTableInstanceModel::itemPooled, this, &QQuickTableViewPrivate::itemPooledCallback); QObjectPrivate::disconnect(tm, &QQmlTableInstanceModel::itemReused, this, &QQuickTableViewPrivate::itemReusedCallback); + QObjectPrivate::disconnect(q, &QQuickTableView::atYEndChanged, this, &QQuickTableViewPrivate::fetchMoreData); } if (auto const aim = model->abstractItemModel()) { @@ -2413,6 +2441,14 @@ void QQuickTableViewPrivate::layoutChangedCallback(const QList<QPersistentModelI scheduleRebuildTable(RebuildOption::ViewportOnly); } +void QQuickTableViewPrivate::fetchMoreData() +{ + if (tableModel && tableModel->canFetchMore()) { + tableModel->fetchMore(); + scheduleRebuildTable(RebuildOption::ViewportOnly); + } +} + void QQuickTableViewPrivate::modelResetCallback() { scheduleRebuildTable(RebuildOption::All); diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index b66ac66dec..ec043f5e7e 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -322,7 +322,8 @@ public: qreal sizeHintForColumn(int column); qreal sizeHintForRow(int row); - void calculateTableSize(); + QSize calculateTableSize(); + void updateTableSize(); inline bool isColumnHidden(int column); inline bool isRowHidden(int row); @@ -351,6 +352,7 @@ public: void updateContentWidth(); void updateContentHeight(); void updateAverageEdgeSize(); + RebuildOptions checkForVisibilityChanges(); void forceLayout(); void updateExtents(); @@ -424,6 +426,8 @@ public: void setLocalViewportY(qreal contentY); void syncViewportPosRecursive(); + void fetchMoreData(); + void _q_componentFinalized(); void registerCallbackWhenBindingsAreEvaluated(); diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 17fc16d44b..2110d4caba 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -240,13 +240,12 @@ void QQuickView::setSource(const QUrl& url) } /*! - Sets the initial properties with which the QML component gets initialized after - calling \l QQuickView::setSource. + Sets the initial properties \a initialProperties with which the QML + component gets initialized after calling \l QQuickView::setSource(). + \note You can only use this function to initialize top-level properties. - Note that you can only use this function to initialize toplevel properties. - - \sa QQmlComponent::createWithInitialProperties + \sa QQmlComponent::createWithInitialProperties() \since 5.14 */ void QQuickView::setInitialProperties(const QVariantMap &initialProperties) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 905241989e..fec70191ca 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -4603,7 +4603,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create \a nativeLayout is only used for APIs like Vulkan. When applicable, it must specify the current image layout, such as, a VkImageLayout value. - \sa sceneGraphInitialized(), QSGTextures + \sa sceneGraphInitialized(), QSGTexture \since 5.14 */ diff --git a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp index 117d477f9a..77593591bd 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterialrhishader.cpp @@ -319,7 +319,7 @@ bool QSGMaterialRhiShader::updateUniformData(RenderState &state, each variable in the material's shaders' \l{QShaderDescription::combinedImageSamplers()}. - When \c{*texture} is null, it must be set to a QSGTexture pointer before + When *\a{texture} is null, it must be set to a QSGTexture pointer before returning. When non-null, it is up to the material to decide if a new \c{QSGTexture *} is stored to it, or if it updates some parameters on the already known QSGTexture. The ownership of the QSGTexture is not diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp index edcee96bdb..dfbe4d3ffd 100644 --- a/src/quick/scenegraph/coreapi/qsgtexture.cpp +++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp @@ -701,8 +701,8 @@ void QSGTexture::updateBindOptions(bool force) // legacy (GL-only) data (for example, because there was no setImage() since the last call to this function), the function does nothing. - Materials involving textures are expected to call this function from their - updateSampledImage() implementation, typically without any conditions. + Materials involving \a rhi textures are expected to call this function from + their updateSampledImage() implementation, typically without any conditions. \note This function is only used when running the graphics API independent rendering path of the scene graph. diff --git a/src/quick/scenegraph/shaders/outlinedtext.vert b/src/quick/scenegraph/shaders/outlinedtext.vert index ced8afd034..9df832de3c 100644 --- a/src/quick/scenegraph/shaders/outlinedtext.vert +++ b/src/quick/scenegraph/shaders/outlinedtext.vert @@ -1,6 +1,7 @@ uniform highp mat4 matrix; uniform highp vec2 textureScale; uniform highp vec2 shift; +uniform highp float dpr; attribute highp vec4 vCoord; attribute highp vec2 tCoord; @@ -18,5 +19,6 @@ void main() sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale; sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale; sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale; - gl_Position = matrix * vCoord; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); }
\ No newline at end of file diff --git a/src/quick/scenegraph/shaders/outlinedtext_core.vert b/src/quick/scenegraph/shaders/outlinedtext_core.vert index 4aa13101fd..ae945b013a 100644 --- a/src/quick/scenegraph/shaders/outlinedtext_core.vert +++ b/src/quick/scenegraph/shaders/outlinedtext_core.vert @@ -12,6 +12,7 @@ out vec2 sCoordRight; uniform mat4 matrix; uniform vec2 textureScale; uniform vec2 shift; +uniform float dpr; void main() { @@ -20,5 +21,6 @@ void main() sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale; sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale; sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale; - gl_Position = matrix * vCoord; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); }
\ No newline at end of file diff --git a/src/quick/scenegraph/shaders/styledtext.vert b/src/quick/scenegraph/shaders/styledtext.vert index 7001bbc262..29c9902609 100644 --- a/src/quick/scenegraph/shaders/styledtext.vert +++ b/src/quick/scenegraph/shaders/styledtext.vert @@ -13,5 +13,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert index c522877bb3..7e313eb797 100644 --- a/src/quick/scenegraph/shaders/styledtext_core.vert +++ b/src/quick/scenegraph/shaders/styledtext_core.vert @@ -15,5 +15,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * round(vCoord * dpr) / dpr; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/textmask.vert b/src/quick/scenegraph/shaders/textmask.vert index 4c678270d0..1692159d2c 100644 --- a/src/quick/scenegraph/shaders/textmask.vert +++ b/src/quick/scenegraph/shaders/textmask.vert @@ -10,5 +10,6 @@ varying highp vec2 sampleCoord; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert index f996040f70..5c510a2d23 100644 --- a/src/quick/scenegraph/shaders/textmask_core.vert +++ b/src/quick/scenegraph/shaders/textmask_core.vert @@ -12,5 +12,6 @@ uniform float dpr; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * round(vCoord * dpr) / dpr; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 61319c388c..24b22f00c1 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -918,7 +918,7 @@ QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &path When curves are present, the percentage argument is mapped to the \c t parameter of the Bezier equations. - \sa QPainterPath::pointAt + \sa QPainterPath::pointAtPercent() \since QtQuick 2.14 */ @@ -2370,8 +2370,8 @@ void QQuickPathPercent::setValue(qreal value) The example below creates a triangular path consisting of four vertices on the edge of the containing Shape's bounding box. - Through the containing shape's \l scale property, the path will be - rescaled together with its containing shape. + Through the containing shape's \l {QtQuick::Path::}{scale} property, + the path will be rescaled together with its containing shape. \qml PathPolyline { @@ -2488,7 +2488,7 @@ void QQuickPathPolyline::addToPath(QPainterPath &path, const QQuickPathData &/*d The example below creates a high voltage symbol by adding each path of the symbol to the list of paths. The coordinates of the vertices are normalized, and through the containing shape's - \l scale property, the path will be rescaled together with its containing shape. + \l {QtQuick::Path::}{scale} property, the path will be rescaled together with its containing shape. \qml PathMultiline { |