diff options
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 36 | ||||
-rw-r--r-- | src/quick/items/qquickitemanimation.cpp | 11 | ||||
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 102 | ||||
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 38 | ||||
-rw-r--r-- | src/quick/items/qquicktableview_p_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquicktextcontrol.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 35 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput_p_p.h | 10 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 7 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 13 |
11 files changed, 215 insertions, 49 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 31cd317dc9..497672b497 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3071,8 +3071,9 @@ Returns a transform that maps points from item space into window space. */ QTransform QQuickItemPrivate::itemToWindowTransform() const { - // XXX todo - QTransform rv = parentItem?QQuickItemPrivate::get(parentItem)->itemToWindowTransform():QTransform(); + // item's parent must not be itself, otherwise calling itemToWindowTransform() on it is infinite recursion + Q_ASSERT(!parentItem || QQuickItemPrivate::get(parentItem) != this); + QTransform rv = parentItem ? QQuickItemPrivate::get(parentItem)->itemToWindowTransform() : QTransform(); itemToParentTransform(rv); return rv; } @@ -7392,6 +7393,12 @@ bool QQuickItem::isUnderMouse() const if (!d->window) return false; + // QQuickWindow handles QEvent::Leave to reset the lastMousePosition + // FIXME: Using QPointF() as the reset value means an item will not be + // under the mouse if the mouse is at 0,0 of the window. + if (QQuickWindowPrivate::get(d->window)->lastMousePosition == QPointF()) + return false; + QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition; return contains(mapFromScene(d->window->mapFromGlobal(cursorPos.toPoint()))); } @@ -7806,22 +7813,23 @@ void QQuickItem::setKeepTouchGrab(bool keep) } /*! - \qmlmethod bool QtQuick::Item::contains(point point) + \qmlmethod bool QtQuick::Item::contains(point point) - Returns true if this item contains \a point, which is in local coordinates; - returns false otherwise. - */ + Returns \c true if this item contains \a point, which is in local coordinates; + returns \c false otherwise. This is the same check that is used for + hit-testing a QEventPoint during event delivery, and is affected by + containmentMask() if it is set. +*/ /*! - Returns true if this item contains \a point, which is in local coordinates; - returns false otherwise. + Returns \c true if this item contains \a point, which is in local coordinates; + returns \c false otherwise. - This function can be overwritten in order to handle point collisions in items - with custom shapes. The default implementation checks if the point is inside - the item's bounding rect. + This function can be overridden in order to handle point collisions in items + with custom shapes. The default implementation checks whether the point is inside + containmentMask() if it is set, or inside the bounding box otherwise. - Note that this method is generally used to check whether the item is under the mouse cursor, - and for that reason, the implementation of this function should be as light-weight - as possible. + \note This method is used for hit-testing each QEventPoint during event + delivery, so the implementation should be kept as lightweight as possible. */ bool QQuickItem::contains(const QPointF &point) const { diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 23694e2de3..dfb56ccc00 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -230,8 +230,8 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act { Q_D(QQuickParentAnimation); - QQuickParentAnimationData *data = new QQuickParentAnimationData; - QQuickParentAnimationData *viaData = new QQuickParentAnimationData; + std::unique_ptr<QQuickParentAnimationData> data(new QQuickParentAnimationData); + std::unique_ptr<QQuickParentAnimationData> viaData(new QQuickParentAnimationData); bool hasExplicit = false; if (d->target && d->newParent) { @@ -377,8 +377,8 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob; if (d->via) - viaAction->setAnimAction(viaData); - targetAction->setAnimAction(data); + viaAction->setAnimAction(viaData.release()); + targetAction->setAnimAction(data.release()); //take care of any child animations bool valid = d->defaultProperty.isValid(); @@ -405,9 +405,6 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act topLevelGroup->appendAnimation(d->via ? viaAction : targetAction); } return initInstance(topLevelGroup); - } else { - delete data; - delete viaData; } return nullptr; } diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 0f9394f695..1001b34c3c 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -382,6 +382,83 @@ private: } }; +/*! \internal + \brief A helper class for iterating over a model that might change + + When populating the ListView from a model under normal + circumstances, we would iterate over the range of model indices + correspondning to the visual range, and basically call + createItem(index++) in order to create each item. + + This will also emit Component.onCompleted() for each item, which + might do some weird things... For instance, it might remove itself + from the model, and this might change model count and the indices + of the other subsequent entries in the model. + + This class takes such changes to the model into consideration while + iterating, and will adjust the iterator index and keep track of + whether the iterator has reached the end of the range. + + It keeps track of changes to the model by connecting to + QQmlInstanceModel::modelUpdated() from its constructor. + When destroyed, it will automatically disconnect. You can + explicitly disconnect earlier by calling \fn disconnect(). +*/ +class MutableModelIterator { +public: + MutableModelIterator(QQmlInstanceModel *model, int iBegin, int iEnd) + : removedAtIndex(false) + , backwards(iEnd < iBegin) + { + conn = QObject::connect(model, &QQmlInstanceModel::modelUpdated, + [&] (const QQmlChangeSet &changeSet, bool /*reset*/) + { + for (const QQmlChangeSet::Change &rem : changeSet.removes()) { + idxEnd -= rem.count; + if (rem.start() <= index) { + index -= rem.count; + if (index < rem.start() + rem.count) + removedAtIndex = true; // model index was removed + } + } + for (const QQmlChangeSet::Change &ins : changeSet.inserts()) { + idxEnd += ins.count; + if (ins.start() <= index) + index += ins.count; + } + } + ); + index = iBegin; + idxEnd = iEnd; + } + + bool hasNext() const { + return backwards ? index > idxEnd : index < idxEnd; + } + + void next() { index += (backwards ? -1 : +1); } + + ~MutableModelIterator() + { + disconnect(); + } + + void disconnect() + { + if (conn) { + QObject::disconnect(conn); + conn = QMetaObject::Connection(); // set to nullptr + } + } + int index = 0; + int idxEnd; + unsigned removedAtIndex : 1; + unsigned backwards : 1; +private: + QMetaObject::Connection conn; +}; + + //---------------------------------------------------------------------------- bool QQuickListViewPrivate::isContentFlowReversed() const @@ -3570,7 +3647,6 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch if (insertResult->visiblePos.isValid() && pos < insertResult->visiblePos) { // Insert items before the visible item. int insertionIdx = index; - int i = 0; qreal from = tempPos - displayMarginBeginning - buffer; if (insertionIdx < visibleIndex) { @@ -3579,15 +3655,18 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch insertResult->sizeChangesBeforeVisiblePos += count * (averageSize + spacing); } } else { - for (i = count-1; i >= 0 && pos >= from; --i) { + MutableModelIterator it(model, modelIndex + count - 1, modelIndex -1); + for (; it.hasNext() && pos >= from; it.next()) { // item is before first visible e.g. in cache buffer FxViewItem *item = nullptr; - if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) - item->index = modelIndex + i; + if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(it.index)))) + item->index = it.index; if (!item) - item = createItem(modelIndex + i, QQmlIncubator::Synchronous); + item = createItem(it.index, QQmlIncubator::Synchronous); if (!item) return false; + if (it.removedAtIndex) + continue; visibleAffected = true; visibleItems.insert(insertionIdx, item); @@ -3620,16 +3699,20 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } } else { - for (int i = 0; i < count && pos <= lastVisiblePos; ++i) { + MutableModelIterator it(model, modelIndex, modelIndex + count); + for (; it.hasNext() && pos <= lastVisiblePos; it.next()) { visibleAffected = true; FxViewItem *item = nullptr; - if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) - item->index = modelIndex + i; + if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(it.index)))) + item->index = it.index; bool newItem = !item; + it.removedAtIndex = false; if (!item) - item = createItem(modelIndex + i, QQmlIncubator::Synchronous); + item = createItem(it.index, QQmlIncubator::Synchronous); if (!item) return false; + if (it.removedAtIndex) + continue; visibleItems.insert(index, item); if (index == 0) @@ -3650,6 +3733,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch pos += item->size() + spacing; ++index; } + it.disconnect(); if (0 < index && index < visibleItems.count()) { FxViewItem *prevItem = visibleItems.at(index - 1); diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 1349d308d7..f9454fc5cb 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -642,6 +642,28 @@ int QQuickTableViewPrivate::nextVisibleEdgeIndex(Qt::Edge edge, int startIndex) return foundIndex; } +bool QQuickTableViewPrivate::allColumnsLoaded() +{ + // Returns true if all the columns in the model (that are not + // hidden by the columnWidthProvider) are currently loaded and visible. + const bool firstColumnLoaded = nextVisibleEdgeIndexAroundLoadedTable(Qt::LeftEdge) == kEdgeIndexAtEnd; + if (!firstColumnLoaded) + return false; + bool lastColumnLoaded = nextVisibleEdgeIndexAroundLoadedTable(Qt::RightEdge) == kEdgeIndexAtEnd; + return lastColumnLoaded; +} + +bool QQuickTableViewPrivate::allRowsLoaded() +{ + // Returns true if all the rows in the model (that are not hidden + // by the columnWidthProvider) are currently loaded and visible. + const bool firstColumnLoaded = nextVisibleEdgeIndexAroundLoadedTable(Qt::TopEdge) == kEdgeIndexAtEnd; + if (!firstColumnLoaded) + return false; + bool lastColumnLoaded = nextVisibleEdgeIndexAroundLoadedTable(Qt::BottomEdge) == kEdgeIndexAtEnd; + return lastColumnLoaded; +} + void QQuickTableViewPrivate::updateContentWidth() { // Note that we actually never really know what the content size / size of the full table will @@ -927,6 +949,15 @@ void QQuickTableViewPrivate::syncLoadedTableRectFromLoadedTable() QQuickTableViewPrivate::RebuildOptions QQuickTableViewPrivate::checkForVisibilityChanges() { + // This function will check if there are any visibility changes among + // the _already loaded_ rows and columns. Note that there can be rows + // and columns to the bottom or right that was not loaded, but should + // now become visible (in case there is free space around the table). + if (loadedItems.isEmpty()) { + // Report no changes + return RebuildOption::None; + } + // 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. @@ -971,9 +1002,6 @@ QQuickTableViewPrivate::RebuildOptions QQuickTableViewPrivate::checkForVisibilit void QQuickTableViewPrivate::forceLayout() { - if (loadedItems.isEmpty()) - return; - clearEdgeSizeCache(); RebuildOptions rebuildOptions = RebuildOption::None; @@ -1923,12 +1951,12 @@ void QQuickTableViewPrivate::layoutAfterLoadingInitialTable() relayoutTableItems(); syncLoadedTableRectFromLoadedTable(); - if (rebuildOptions.testFlag(RebuildOption::CalculateNewContentWidth)) { + if (rebuildOptions.testFlag(RebuildOption::CalculateNewContentWidth) || allColumnsLoaded()) { updateAverageColumnWidth(); updateContentWidth(); } - if (rebuildOptions.testFlag(RebuildOption::CalculateNewContentHeight)) { + if (rebuildOptions.testFlag(RebuildOption::CalculateNewContentHeight) || allRowsLoaded()) { updateAverageRowHeight(); updateContentHeight(); } diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index 403a77c3ea..df52672424 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -368,6 +368,8 @@ public: int nextVisibleEdgeIndex(Qt::Edge edge, int startIndex); int nextVisibleEdgeIndexAroundLoadedTable(Qt::Edge edge); + bool allColumnsLoaded(); + bool allRowsLoaded(); inline int edgeToArrayIndex(Qt::Edge edge); void clearEdgeSizeCache(); diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index b18d03a20a..6230186933 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1179,8 +1179,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) QTextLine firstLine = visibleCount == 1 && elideLayout ? elideLayout->lineAt(0) : layout.lineAt(0); - Q_ASSERT(firstLine.isValid()); - *baseline = firstLine.y() + firstLine.ascent(); + if (firstLine.isValid()) + *baseline = firstLine.y() + firstLine.ascent(); if (!customLayout) br.setHeight(height); diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 8db2a38b11..742d36a789 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -949,6 +949,12 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) process: { if (q->isAcceptableInput(e)) { +#if QT_CONFIG(im) + // QTBUG-90362 + // Before key press event will be handled, pre-editing part should be finished + if (isPreediting()) + commitPreedit(); +#endif if (overwriteMode // no need to call deleteChar() if we have a selection, insertText // does it already diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 079bf58abe..0e7f52e816 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2952,6 +2952,7 @@ void QQuickTextInputPrivate::setTopPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->topPaddingChanged(); } } @@ -2966,6 +2967,7 @@ void QQuickTextInputPrivate::setLeftPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->leftPaddingChanged(); } } @@ -2980,6 +2982,7 @@ void QQuickTextInputPrivate::setRightPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->rightPaddingChanged(); } } @@ -2994,6 +2997,7 @@ void QQuickTextInputPrivate::setBottomPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->bottomPaddingChanged(); } } @@ -3429,17 +3433,19 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) if (event->replacementStart() <= 0) c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); - m_cursor += event->replacementStart(); - if (m_cursor < 0) - m_cursor = 0; + int cursorInsertPos = m_cursor + event->replacementStart(); + if (cursorInsertPos < 0) + cursorInsertPos = 0; // insert commit string if (event->replacementLength()) { - m_selstart = m_cursor; + m_selstart = cursorInsertPos; m_selend = m_selstart + event->replacementLength(); m_selend = qMin(m_selend, m_text.length()); removeSelectedText(); } + m_cursor = cursorInsertPos; + if (!event->commitString().isEmpty()) { internalInsert(event->commitString()); cursorPositionChanged = true; @@ -3466,8 +3472,12 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) } QString oldPreeditString = m_textLayout.preeditAreaText(); m_textLayout.setPreeditArea(m_cursor, event->preeditString()); - if (oldPreeditString != m_textLayout.preeditAreaText()) + if (oldPreeditString != m_textLayout.preeditAreaText()) { emit q->preeditTextChanged(); + if (!event->preeditString().isEmpty() && m_undoPreeditState == -1) + // Pre-edit text started. Remember state for undo purpose. + m_undoPreeditState = priorState; + } const int oldPreeditCursor = m_preeditCursor; m_preeditCursor = event->preeditString().length(); hasImState = !event->preeditString().isEmpty(); @@ -3509,6 +3519,11 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) q->updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImCurrentSelection); } + + // Empty pre-edit text handled. Clean m_undoPreeditState + if (event->preeditString().isEmpty()) + m_undoPreeditState = -1; + } #endif // im @@ -3585,6 +3600,12 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo if (m_maskData) checkIsValid(); +#if QT_CONFIG(im) + // If we were during pre-edit, validateFromState should point to the state before pre-edit + // has been started. Choose the correct oldest remembered state + if (m_undoPreeditState >= 0 && (m_undoPreeditState < validateFromState || validateFromState < 0)) + validateFromState = m_undoPreeditState; +#endif if (validateFromState >= 0 && wasValidInput && !m_validInput) { if (m_transactions.count()) return false; @@ -3657,6 +3678,9 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e } m_history.clear(); m_undoState = 0; +#if QT_CONFIG(im) + m_undoPreeditState = -1; +#endif m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; m_textDirty = (oldText != m_text); @@ -4712,6 +4736,7 @@ void QQuickTextInput::setPadding(qreal padding) d->extra.value().padding = padding; d->updateLayout(); + updateCursorRectangle(); emit paddingChanged(); if (!d->extra.isAllocated() || !d->extra->explicitTopPadding) emit topPaddingChanged(); diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 7fbba49405..fa92e608b7 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -110,6 +110,7 @@ public: , m_cursor(0) #if QT_CONFIG(im) , m_preeditCursor(0) + , m_undoPreeditState(-1) #endif , m_blinkEnabled(false) , m_blinkTimer(0) @@ -248,6 +249,7 @@ public: int m_cursor; #if QT_CONFIG(im) int m_preeditCursor; + int m_undoPreeditState; #endif bool m_blinkEnabled; int m_blinkTimer; @@ -335,7 +337,13 @@ public: bool isUndoAvailable() const { return !m_readOnly && m_undoState; } bool isRedoAvailable() const { return !m_readOnly && m_undoState < (int)m_history.size(); } - void clearUndo() { m_history.clear(); m_undoState = 0; } + void clearUndo() { + m_history.clear(); + m_undoState = 0; +#if QT_CONFIG(im) + m_undoPreeditState = -1; +#endif + } bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length(); } bool hasSelectedText() const { return !m_text.isEmpty() && m_selend > m_selstart; } diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index eea1e93f32..c956c85091 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -450,15 +450,14 @@ void QQuickWindow::physicalDpiChanged() void QQuickWindow::handleScreenChanged(QScreen *screen) { Q_D(QQuickWindow); + disconnect(d->physicalDpiChangedConnection); if (screen) { physicalDpiChanged(); // When physical DPI changes on the same screen, either the resolution or the device pixel // ratio changed. We must check what it is. Device pixel ratio does not have its own // ...Changed() signal. - d->physicalDpiChangedConnection = connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)), - this, SLOT(physicalDpiChanged())); - } else { - disconnect(d->physicalDpiChangedConnection); + d->physicalDpiChangedConnection = connect(screen, &QScreen::physicalDotsPerInchChanged, + this, &QQuickWindow::physicalDpiChanged); } d->forcePolish(); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 73c02d793b..31671c8639 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1958,7 +1958,11 @@ void Renderer::prepareAlphaBatches() if (gni->clipList() == gnj->clipList() && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode() - && (gni->geometry()->drawingMode() != QSGGeometry::DrawLines || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth()) + && (gni->geometry()->drawingMode() != QSGGeometry::DrawLines + || (gni->geometry()->lineWidth() == gnj->geometry()->lineWidth() + // Must not do overlap checks when the line width is not 1, + // we have no knowledge how such lines are rasterized. + && gni->geometry()->lineWidth() == 1.0f)) && gni->geometry()->attributes() == gnj->geometry()->attributes() && gni->inheritedOpacity() == gnj->inheritedOpacity() && gni->activeMaterial()->type() == gnj->activeMaterial()->type() @@ -4444,6 +4448,9 @@ void Renderer::renderRenderNode(Batch *batch) // legacy (GL-only) opacity = opacity->parent(); } + // having DepthAwareRendering leaves depth test on in the alpha pass + const bool depthTestWasEnabled = m_useDepthBuffer; + glDisable(GL_STENCIL_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_DEPTH_TEST); @@ -4478,7 +4485,9 @@ void Renderer::renderRenderNode(Batch *batch) // legacy (GL-only) m_currentClipType = ClipState::NoClip; } - if (changes & QSGRenderNode::DepthState) + if (depthTestWasEnabled) + glEnable(GL_DEPTH_TEST); + else if (changes & QSGRenderNode::DepthState) glDisable(GL_DEPTH_TEST); if (changes & QSGRenderNode::ColorState) |