aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp78
1 files changed, 47 insertions, 31 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 4606c1231e..9de90f8d82 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -42,6 +42,7 @@
#include <private/qqmldebugserviceinterfaces_p.h>
#include <private/qqmldebugconnector_p.h>
#include <private/qsgdefaultrendercontext_p.h>
+#include <private/qsgsoftwarerenderer_p.h>
#if QT_CONFIG(opengl)
#include <private/qopengl_p.h>
#include <QOpenGLContext>
@@ -286,37 +287,31 @@ struct PolishLoopDetector
if (itemsToPolish.size() > itemsRemainingBeforeUpdatePolish) {
// Detected potential polish loop.
++numPolishLoopsInSequence;
- if (numPolishLoopsInSequence >= 1000) {
+ if (numPolishLoopsInSequence == 10000) {
+ // We have looped 10,000 times without actually reducing the list of items to
+ // polish, give up for now.
+ // This is not a fix, just a remedy so that the application can be somewhat
+ // responsive.
+ numPolishLoopsInSequence = 0;
+ return true;
+ }
+ if (numPolishLoopsInSequence >= 1000 && numPolishLoopsInSequence < 1005) {
// Start to warn about polish loop after 1000 consecutive polish loops
- if (numPolishLoopsInSequence == 100000) {
- // We have looped 100,000 times without actually reducing the list of items to
- // polish, give up for now.
- // This is not a fix, just a remedy so that the application can be somewhat
- // responsive.
- numPolishLoopsInSequence = 0;
- return true;
- } else if (numPolishLoopsInSequence < 1005) {
- // Show the 5 next items involved in the polish loop.
- // (most likely they will be the same 5 items...)
- QQuickItem *guiltyItem = itemsToPolish.last();
- qmlWarning(item) << "possible QQuickItem::polish() loop";
-
- auto typeAndObjectName = [](QQuickItem *item) {
- QString typeName = QQmlMetaType::prettyTypeName(item);
- QString objName = item->objectName();
- if (!objName.isNull())
- return QLatin1String("%1(%2)").arg(typeName, objName);
- return typeName;
- };
-
- qmlWarning(guiltyItem) << typeAndObjectName(guiltyItem)
- << " called polish() inside updatePolish() of " << typeAndObjectName(item);
-
- if (numPolishLoopsInSequence == 1004)
- // Enough warnings. Reset counter in order to speed things up and re-detect
- // more loops
- numPolishLoopsInSequence = 0;
- }
+ // Show the 5 next items involved in the polish loop.
+ // (most likely they will be the same 5 items...)
+ QQuickItem *guiltyItem = itemsToPolish.last();
+ qmlWarning(item) << "possible QQuickItem::polish() loop";
+
+ auto typeAndObjectName = [](QQuickItem *item) {
+ QString typeName = QQmlMetaType::prettyTypeName(item);
+ QString objName = item->objectName();
+ if (!objName.isNull())
+ return QLatin1String("%1(%2)").arg(typeName, objName);
+ return typeName;
+ };
+
+ qmlWarning(guiltyItem) << typeAndObjectName(guiltyItem)
+ << " called polish() inside updatePolish() of " << typeAndObjectName(item);
}
} else {
numPolishLoopsInSequence = 0;
@@ -519,6 +514,7 @@ void QQuickWindowPrivate::syncSceneGraph()
{
Q_Q(QQuickWindow);
+ const bool wasRtDirty = redirect.renderTargetDirty;
ensureCustomRenderTarget();
QRhiCommandBuffer *cb = nullptr;
@@ -540,7 +536,7 @@ void QQuickWindowPrivate::syncSceneGraph()
invalidateFontData(contentItem);
}
- if (!renderer) {
+ if (Q_UNLIKELY(!renderer)) {
forceUpdate(contentItem);
QSGRootNode *rootNode = new QSGRootNode;
@@ -550,6 +546,10 @@ void QQuickWindowPrivate::syncSceneGraph()
: QSGRendererInterface::RenderMode2DNoDepthBuffer;
renderer = context->createRenderer(renderMode);
renderer->setRootNode(rootNode);
+ } else if (Q_UNLIKELY(wasRtDirty)
+ && q->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) {
+ auto softwareRenderer = static_cast<QSGSoftwareRenderer *>(renderer);
+ softwareRenderer->markDirty();
}
updateDirtyNodes();
@@ -914,6 +914,22 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
// The confirmExitPopup allows user to save or discard the document,
// or to cancel the closing.
\endcode
+
+ \section1 Styling
+
+ As with all visual types in Qt Quick, Window supports
+ \l {palette}{palettes}. However, as with types like \l Text, Window does
+ not use palettes by default. For example, to change the background color
+ of the window when the operating system's theme changes, the \l color must
+ be set:
+
+ \snippet qml/windowPalette.qml declaration-and-color
+ \codeline
+ \snippet qml/windowPalette.qml text-item
+ \snippet qml/windowPalette.qml closing-brace
+
+ Use \l {ApplicationWindow} (and \l {Label}) from \l {Qt Quick Controls}
+ instead of Window to get automatic styling.
*/
/*!