diff options
Diffstat (limited to 'src/quick')
28 files changed, 132 insertions, 76 deletions
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc index 099c7eb443..40d77c3d9b 100644 --- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc @@ -106,7 +106,7 @@ during the updatePaintNode() call. The rule of thumb is to only use classes with the "QSG" prefix inside the QQuickItem::updatePaintNode() function. -For more details, see the \l {Custom Geometry Example}. +For more details, see the \l {Scene Graph - Custom Geometry}. \section3 Preprocessing @@ -140,7 +140,7 @@ type. Below is a complete list of material classes: \annotatedlist{qtquick-scenegraph-materials} -For more details, see the \l {Simple Material Example} +For more details, see the \l {Scene Graph - Simple Material} \section2 Convenience Nodes @@ -280,21 +280,19 @@ needed to perform the rendering. The downside is that Qt Quick decides when to call the signals and this is the only time the OpenGL application is allowed to draw. -The \l {OpenGL Under QML} example gives an example on how to use use -these signals. - +The \l {Scene Graph - OpenGL Under QML} example gives an example on +how to use use these signals. The other alternative is to create a FramebufferObject, render into it and use the result as a textured node in the scene graph, for instance -using a QSGSimpleTextureNode. A simple way of doing the same is to use -a QQuickPaintedItem with QQuickPaintedItem::FramebufferObject as -render target and by calling QPainter::beginNativePainting() before -the OpenGL rendering and QPainter::endNativePainting() after. When -OpenGL content is integrated with a texture and FramebufferObject, the -application has more control over when the content is rendered. For -instance, the application can create a second QOpenGLContext on the -GUI thread which shares memory with the scene graph's OpenGL context -and drive the rendering manually. +using a QSGSimpleTextureNode. The \l {Scene Graph - Rendering FBOs} +and \l {Scene Graph - Rendering FBOs in a thread} examples show how +this can be done in an optimal manner. + +A simple way of doing the same is to use a QQuickPaintedItem with +QQuickPaintedItem::FramebufferObject as render target and by calling +QPainter::beginNativePainting() before the OpenGL rendering and +QPainter::endNativePainting() after. \warning When mixing OpenGL content with scene graph rendering, it is important the application does not leave the OpenGL context in a state diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 7c91193623..9d9ddd6ef0 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -190,9 +190,10 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate() , hasCanvasWindow(false) , available(false) , contextInitialized(false) - , renderTarget(QQuickCanvasItem::FramebufferObject) + , renderTarget(QQuickCanvasItem::Image) , renderStrategy(QQuickCanvasItem::Cooperative) { + antialiasing = true; } QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate() @@ -245,7 +246,7 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate() results in faster rendering. The default render target is Canvas.Image and the default renderStrategy is - Canvas.Threaded. + Canvas.Cooperative. \section1 Tiled Canvas The Canvas item supports tiled rendering by setting \l canvasSize, \l tileSize diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 3ab93e6d0f..33a831acad 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -54,20 +54,29 @@ QT_BEGIN_NAMESPACE \instantiates QQuickScreenAttached \inqmlmodule QtQuick.Window 2 \ingroup qtquick-visual-utility - \brief The Screen attached object provides information about the Screen an Item is displayed on. + \brief The Screen attached object provides information about the Screen an Item or Window is displayed on. - The Screen attached object is only valid inside Item or Item derived types, after component completion. - Inside these items it refers to the screen that the item is currently being displayed on. + The Screen attached object is valid inside Item or Item derived types, + after component completion. Inside these items it refers to the screen that + the item is currently being displayed on. + + The attached object is also valid inside Window or Window derived types, + after component completion. In that case it refers to the screen where the + Window was created. It is generally better to access the Screen from the + relevant Item instead, because on a multi-screen desktop computer, the user + can drag a Window into a position where it spans across multiple screens. + In that case some Items will be on one screen, and others on a different + screen. To use this type, you will need to import the module with the following line: \code import QtQuick.Window 2.0 \endcode + It is a separate import in order to allow you to have a QML environment + without access to window system features. - Note that the Screen type is not valid at Component.onCompleted, because the Item has not been displayed on - a screen by this time. - - Restricting this import will allow you to have a QML environment without access to window system features. + Note that the Screen type is not valid at Component.onCompleted, because + the Item or Window has not been displayed on a screen by this time. */ /*! @@ -86,13 +95,32 @@ QT_BEGIN_NAMESPACE \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::primaryOrientation \readonly - This contains the primary orientation of the screen. + This contains the primary orientation of the screen. If the + screen's height is greater than its width, then the orientation is + Qt.PortraitOrientation; otherwise it is Qt.LandscapeOrientation. + + If you are designing an application which changes its layout depending on + device orientation, you probably want to use primaryOrientation to + determine the layout. That is because on a desktop computer, you can expect + primaryOrientation to change when the user rotates the screen via the + operating system's control panel, even if the computer does not contain an + accelerometer. Likewise on most handheld computers which do have + accelerometers, the operating system will rotate the whole screen + automatically, so again you will see the primaryOrientation change. */ /*! \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::orientation \readonly - This contains the current orientation of the screen. + This contains the current orientation of the screen, from the accelerometer + (if any). On a desktop computer, this value typically does not change. + + If primaryOrientation == orientation, it means that the screen + automatically rotates all content which is displayed, depending on how you + hold it. But if orientation changes while primaryOrientation does NOT + change, then probably you are using a device which does not rotate its own + display. In that case you may need to use \l Item.rotation or + \l Item.transform to rotate your content. */ /*! \qmlattachedmethod int QtQuick.Window2::Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index e051b5202c..015f52cc46 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -635,6 +635,13 @@ void QQuickTextEditPrivate::mirrorChange() } } +#ifndef QT_NO_IM +Qt::InputMethodHints QQuickTextEditPrivate::effectiveInputMethodHints() const +{ + return inputMethodHints | Qt::ImhMultiLine; +} +#endif + QQuickTextEdit::VAlignment QQuickTextEdit::vAlign() const { Q_D(const QQuickTextEdit); @@ -1632,7 +1639,7 @@ QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const v = (bool)(flags() & ItemAcceptsInputMethod); break; case Qt::ImHints: - v = (int)inputMethodHints(); + v = (int)d->effectiveInputMethodHints(); break; default: v = d->control->inputMethodQuery(property); diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index e4819e4d2d..5306c979cf 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -106,6 +106,10 @@ public: void setNativeCursorEnabled(bool enabled) { control->setCursorWidth(enabled ? 1 : 0); } +#ifndef QT_NO_IM + Qt::InputMethodHints effectiveInputMethodHints() const; +#endif + QColor color; QColor selectionColor; QColor selectedTextColor; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index f9de3d25e7..1c65c37516 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1910,7 +1910,7 @@ QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property) const else return QVariant(d->selectionStart()); default: - return QVariant(); + return QQuickItem::inputMethodQuery(property); } } #endif // QT_NO_IM diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 9acd24cae3..2e8f58b849 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -77,8 +77,11 @@ void QQuickWindowPrivate::updateFocusItemTransform() Q_Q(QQuickWindow); #ifndef QT_NO_IM QQuickItem *focus = q->activeFocusItem(); - if (focus && qApp->focusObject() == focus) - qApp->inputMethod()->setInputItemTransform(QQuickItemPrivate::get(focus)->itemToWindowTransform()); + if (focus && qApp->focusObject() == focus) { + QQuickItemPrivate *focusPrivate = QQuickItemPrivate::get(focus); + qApp->inputMethod()->setInputItemTransform(focusPrivate->itemToWindowTransform()); + qApp->inputMethod()->setInputItemRectangle(QRectF(0, 0, focusPrivate->width, focusPrivate->height)); + } #endif } @@ -690,6 +693,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F } afi = afi->parentItem(); } + updateFocusItemTransform(); QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason); q->sendEvent(newActiveFocusItem, &event); @@ -771,6 +775,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, if (newActiveFocusItem) { Q_ASSERT(newActiveFocusItem == scope); activeFocusItem = scope; + updateFocusItemTransform(); QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason); q->sendEvent(newActiveFocusItem, &event); @@ -909,7 +914,7 @@ void QQuickWindowPrivate::cleanup(QSGNode *n) scene graph and its OpenGL context being deleted. The sceneGraphInvalidated() signal will be emitted when this happens. - \sa {OpenGL Under QML} + \sa {Scene Graph - OpenGL Under QML} */ @@ -1189,7 +1194,7 @@ void QQuickWindow::keyPressEvent(QKeyEvent *e) #ifndef QT_NO_SHORTCUT // Try looking for a Shortcut before sending key events - if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(this, e)) + if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(this->activeFocusItem(), e)) return; #endif diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h b/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h index ae759c0b24..6fba0d18bc 100644 --- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLRENDERER_H -#define QMLRENDERER_H +#ifndef QSGDEFAULTRENDERER_P_H +#define QSGDEFAULTRENDERER_P_H #include "qsgrenderer_p.h" diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 27d4ed413a..818b9b26aa 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -284,7 +284,7 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() setIndexDataPattern() functions. Whether this hint is respected or not is implementation specific. - \sa QSGGeometryNode, {Custom Geometry Example} + \sa QSGGeometryNode, {Scene Graph - Custom Geometry} */ diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h index 5effdbfda6..50e9c77d4e 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.h +++ b/src/quick/scenegraph/coreapi/qsgmaterial.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef MATERIAL_H -#define MATERIAL_H +#ifndef QSGMATERIAL_H +#define QSGMATERIAL_H #include <QtQuick/qtquickglobal.h> #include <qopenglshaderprogram.h> diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h index 522546d8e8..3fa2f7fc04 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.h +++ b/src/quick/scenegraph/coreapi/qsgnode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef NODE_H -#define NODE_H +#ifndef QSGNODE_H +#define QSGNODE_H #include <QtQuick/qsggeometry.h> #include <QtGui/QMatrix4x4> @@ -333,4 +333,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSGNode::Flags) QT_END_NAMESPACE -#endif // NODE_H +#endif // QSGNODE_H diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h index 7e57bf5bbf..eb612ff877 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef NODEUPDATER_P_H -#define NODEUPDATER_P_H +#ifndef QSGNODEUPDATER_P_H +#define QSGNODEUPDATER_P_H #include <private/qtquickglobal_p.h> #include <QtGui/private/qdatabuffer_p.h> @@ -94,4 +94,4 @@ protected: QT_END_NAMESPACE -#endif // NODEUPDATER_P_H +#endif diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index 5dd53547d1..844e8b1d8c 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef RENDERER_H -#define RENDERER_H +#ifndef QSGRENDERER_P_H +#define QSGRENDERER_P_H #include <qset.h> #include <qhash.h> @@ -239,4 +239,4 @@ private: QT_END_NAMESPACE -#endif // RENDERER_H +#endif diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index 85c1d2e6ff..cc22bfa61f 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef ADAPTATIONINTERFACES_H -#define ADAPTATIONINTERFACES_H +#ifndef QSGADAPTATIONLAYER_P_H +#define QSGADAPTATIONLAYER_P_H #include <QtQuick/qsgnode.h> #include <QtQuick/qsgtexture.h> diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p.h index a1cd381968..a3d5d7c3ae 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef DEFAULT_GLYPHNODE_H -#define DEFAULT_GLYPHNODE_H +#ifndef QSGDEFAULTGLYPHNODE_P_H +#define QSGDEFAULTGLYPHNODE_P_H #include <private/qsgadaptationlayer_p.h> #include <QtQuick/qsgnode.h> @@ -78,4 +78,4 @@ private: QT_END_NAMESPACE -#endif // DEFAULT_GLYPHNODE_H +#endif diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h index efa96a1805..263523221e 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef TEXTMASKMATERIAL_H -#define TEXTMASKMATERIAL_H +#ifndef QSGDEFAULTGLYPHNODE_P_P_H +#define QSGDEFAULTGLYPHNODE_P_P_H #include <qcolor.h> #include <QtQuick/qsgmaterial.h> @@ -93,4 +93,4 @@ private: QT_END_NAMESPACE -#endif // TEXTMASKMATERIAL_H +#endif diff --git a/src/quick/scenegraph/qsgdefaultimagenode_p.h b/src/quick/scenegraph/qsgdefaultimagenode_p.h index d2b3baae79..7d299faee3 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode_p.h +++ b/src/quick/scenegraph/qsgdefaultimagenode_p.h @@ -40,8 +40,8 @@ ****************************************************************************/ -#ifndef DEFAULT_PIXMAPNODE_H -#define DEFAULT_PIXMAPNODE_H +#ifndef QSGDEFAULTIMAGENODE_P_H +#define QSGDEFAULTIMAGENODE_P_H #include <private/qsgadaptationlayer_p.h> #include <QtQuick/qsgtexturematerial.h> diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h index e4560784fd..24bdbb3d34 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h +++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h @@ -40,8 +40,8 @@ ****************************************************************************/ -#ifndef DEFAULT_RECTANGLENODE_H -#define DEFAULT_RECTANGLENODE_H +#ifndef QSGDEFAULTRECTANGLENODE_P_H +#define QSGDEFAULTRECTANGLENODE_P_H #include <private/qsgadaptationlayer_p.h> diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h index b75a123d34..4f03ab52e2 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef DISTANCEFIELD_GLYPHNODE_H -#define DISTANCEFIELD_GLYPHNODE_H +#ifndef QSGDISTANCEFIELDGLYPHNODE_P_H +#define QSGDISTANCEFIELDGLYPHNODE_P_H #include <private/qsgadaptationlayer_p.h> #include <QtQuick/qsgtexture.h> @@ -112,4 +112,4 @@ private: QT_END_NAMESPACE -#endif // DISTANCEFIELD_GLYPHNODE_H +#endif diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h index fe66776896..d6aa38affa 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef DISTANCEFIELDTEXTMATERIAL_H -#define DISTANCEFIELDTEXTMATERIAL_H +#ifndef QSGDISTANCEFIELDGLYPHNODE_P_P_H +#define QSGDISTANCEFIELDGLYPHNODE_P_P_H #include <QtQuick/qsgmaterial.h> #include "qsgdistancefieldglyphnode_p.h" @@ -141,4 +141,4 @@ public: QT_END_NAMESPACE -#endif // DISTANCEFIELDTEXTMATERIAL_H +#endif diff --git a/src/quick/scenegraph/util/qsgareaallocator_p.h b/src/quick/scenegraph/util/qsgareaallocator_p.h index 4ec628288b..1255001d0c 100644 --- a/src/quick/scenegraph/util/qsgareaallocator_p.h +++ b/src/quick/scenegraph/util/qsgareaallocator_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef AREAALLOCATOR_H -#define AREAALLOCATOR_H +#ifndef QSGAREAALLOCATOR_P_H +#define QSGAREAALLOCATOR_P_H #include <private/qtquickglobal_p.h> #include <QtCore/qsize.h> diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.h b/src/quick/scenegraph/util/qsgflatcolormaterial.h index 27cf256603..f0a3a3741d 100644 --- a/src/quick/scenegraph/util/qsgflatcolormaterial.h +++ b/src/quick/scenegraph/util/qsgflatcolormaterial.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef FLATCOLORMATERIAL_H -#define FLATCOLORMATERIAL_H +#ifndef QSGFLATCOLORMATERIAL_H +#define QSGFLATCOLORMATERIAL_H #include <QtQuick/qsgmaterial.h> #include <qcolor.h> diff --git a/src/quick/scenegraph/util/qsgsimplematerial.cpp b/src/quick/scenegraph/util/qsgsimplematerial.cpp index bed1b710ca..ee7a272fbe 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.cpp +++ b/src/quick/scenegraph/util/qsgsimplematerial.cpp @@ -142,7 +142,7 @@ the unique QSGSimpleMaterialShader implementation must be instantiated with a unique C++ type. - \sa {Simple Material Example} + \sa {Scene Graph - Simple Material} */ /*! diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.h b/src/quick/scenegraph/util/qsgsimplerectnode.h index 856e6793bc..bed2d98078 100644 --- a/src/quick/scenegraph/util/qsgsimplerectnode.h +++ b/src/quick/scenegraph/util/qsgsimplerectnode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef SOLIDRECTNODE_H -#define SOLIDRECTNODE_H +#ifndef QSGSIMPLERECTNODE_H +#define QSGSIMPLERECTNODE_H #include <QtQuick/qsgnode.h> #include <QtQuick/qsgflatcolormaterial.h> diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 48927ce5e1..1a8c69a474 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -232,6 +232,8 @@ static void qt_debug_remove_texture(QSGTexture* texture) If the texture is used in such a way that atlas is not preferable, the function removedFromAtlas() can be used to extract a non-atlassed copy. + + \sa {Scene Graph - Rendering FBOs}, {Scene Graph - Rendering FBOs in a thread} */ /*! diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h index 83d941b084..b842779716 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.h +++ b/src/quick/scenegraph/util/qsgtexturematerial.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef TEXTUREMATERIAL_H -#define TEXTUREMATERIAL_H +#ifndef QSGTEXTUREMATERIAL_H +#define QSGTEXTUREMATERIAL_H #include <QtQuick/qsgmaterial.h> #include <QtQuick/qsgtexture.h> @@ -92,4 +92,4 @@ public: QT_END_NAMESPACE -#endif // TEXTUREMATERIAL_H +#endif diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.h b/src/quick/scenegraph/util/qsgvertexcolormaterial.h index a3ffa48c31..81da0650f1 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.h +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef VERTEXCOLORMATERIAL_H -#define VERTEXCOLORMATERIAL_H +#ifndef QSGVERTEXCOLORMATERIAL_H +#define QSGVERTEXCOLORMATERIAL_H #include <QtQuick/qsgmaterial.h> diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 7a9bea3aa0..0033be82be 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -78,6 +78,11 @@ QT_BEGIN_NAMESPACE + +#ifndef QT_NO_DEBUG +static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); +#endif + // The cache limit describes the maximum "junk" in the cache. static int cache_limit = 2048 * 1024; // 2048 KB cache limit for embedded in qpixmapcache.cpp @@ -741,7 +746,9 @@ QQuickPixmapStore::~QQuickPixmapStore() { m_destroying = true; +#ifndef QT_NO_DEBUG int leakedPixmaps = 0; +#endif QList<QQuickPixmapData*> cachedData = m_cache.values(); // Prevent unreferencePixmap() from assuming it needs to kick @@ -753,7 +760,9 @@ QQuickPixmapStore::~QQuickPixmapStore() foreach (QQuickPixmapData* pixmap, cachedData) { int currRefCount = pixmap->refCount; if (currRefCount) { +#ifndef QT_NO_DEBUG leakedPixmaps++; +#endif while (currRefCount > 0) { pixmap->release(); currRefCount--; @@ -766,8 +775,10 @@ QQuickPixmapStore::~QQuickPixmapStore() shrinkCache(20); } - if (leakedPixmaps) +#ifndef QT_NO_DEBUG + if (leakedPixmaps && qsg_leak_check) qDebug("Number of leaked pixmaps: %i", leakedPixmaps); +#endif } void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data) |