QQuickWindow¶
The
QQuickWindow
class provides the window for displaying a graphical QML scene. More…
Inherited by: QQuickView
Synopsis¶
Functions¶
def
activeFocusItem
()def
beginExternalCommands
()def
clearBeforeRendering
()def
color
()def
contentItem
()def
createTextureFromId
(id, size[, options=QQuickWindow.CreateTextureOption()])def
createTextureFromImage
(image)def
createTextureFromImage
(image, options)def
createTextureFromNativeObject
(type, nativeObjectPtr, nativeLayout, size[, options=QQuickWindow.CreateTextureOption()])def
effectiveDevicePixelRatio
()def
endExternalCommands
()def
grabWindow
()def
incubationController
()def
isPersistentOpenGLContext
()def
isPersistentSceneGraph
()def
isSceneGraphInitialized
()def
mouseGrabberItem
()def
openglContext
()def
renderTarget
()def
renderTargetId
()def
renderTargetSize
()def
rendererInterface
()def
resetOpenGLState
()def
scheduleRenderJob
(job, schedule)def
sendEvent
(arg__1, arg__2)def
setClearBeforeRendering
(enabled)def
setColor
(color)def
setPersistentOpenGLContext
(persistent)def
setPersistentSceneGraph
(persistent)def
setRenderTarget
(fbo)def
setRenderTarget
(fboId, size)
Slots¶
def
releaseResources
()def
update
()
Signals¶
def
activeFocusItemChanged
()def
afterAnimating
()def
afterRenderPassRecording
()def
afterRendering
()def
afterSynchronizing
()def
beforeRenderPassRecording
()def
beforeRendering
()def
beforeSynchronizing
()def
colorChanged
(arg__1)def
frameSwapped
()def
openglContextCreated
(context)def
sceneGraphAboutToStop
()def
sceneGraphError
(error, message)def
sceneGraphInitialized
()def
sceneGraphInvalidated
()
Static functions¶
def
hasDefaultAlphaBuffer
()def
sceneGraphBackend
()def
setDefaultAlphaBuffer
(useAlpha)def
setSceneGraphBackend
(api)def
setSceneGraphBackend
(backend)def
setTextRenderType
(renderType)def
textRenderType
()
Detailed Description¶
QQuickWindow
provides the graphical scene management needed to interact with and display a scene of QQuickItems.A
QQuickWindow
always has a single invisible root item. To add items to this window, reparent the items to the root item or to an existing item in the scene.For easily displaying a scene from a QML file, see
QQuickView
.
Rendering¶
QQuickWindow
uses a scene graph to represent what needs to be rendered. This scene graph is disconnected from the QML scene and potentially lives in another thread, depending on the platform implementation. Since the rendering scene graph lives independently from the QML scene, it can also be completely released without affecting the state of the QML scene.The
sceneGraphInitialized()
signal is emitted on the rendering thread before the QML scene is rendered to the screen for the first time. If the rendering scene graph has been released, the signal will be emitted again before the next frame is rendered.
Integration with OpenGL¶
When using the default OpenGL adaptation, it is possible to integrate OpenGL calls directly into the
QQuickWindow
using the same OpenGL context as the Qt Quick Scene Graph. This is done by connecting to thebeforeRendering()
orafterRendering()
signal.Note
When using
beforeRendering()
, make sure to disable clearing before rendering withsetClearBeforeRendering()
.
Exposure and Visibility¶
When a
QQuickWindow
instance is deliberately hidden withhide()
orsetVisible
(false), it will stop rendering and its scene graph and graphics context might be released. ThesceneGraphInvalidated()
signal will be emitted when this happens.Warning
It is crucial that graphics operations and interaction with the scene graph happens exclusively on the rendering thread, primarily during the updatePaintNode() phase.
Warning
As signals related to rendering might be emitted from the rendering thread, connections should be made using
DirectConnection
.
Resource Management¶
QML will try to cache images and scene graph nodes to improve performance, but in some low-memory scenarios it might be required to aggressively release these resources. The
releaseResources()
can be used to force the clean up of certain resources. CallingreleaseResources()
may result in the entire scene graph and in the case of the OpenGL adaptation the associated context will be deleted. ThesceneGraphInvalidated()
signal will be emitted when this happens.Note
All classes with QSG prefix should be used solely on the scene graph’s rendering thread. See Scene Graph and Rendering for more information.
Context and Surface Formats¶
While it is possible to specify a
QSurfaceFormat
for everyQQuickWindow
by calling the member functionsetFormat()
, windows may also be created from QML by using the Window and ApplicationWindow elements. In this case there is no C++ code involved in the creation of the window instance, yet applications may still wish to set certain surface format values, for example to request a given OpenGL version or profile. Such applications can call the static functionsetDefaultFormat()
at startup. The specified format will be used for all Quick windows created afterwards.See also
- class PySide2.QtQuick.QQuickWindow(renderControl)¶
PySide2.QtQuick.QQuickWindow([parent=None])
- param parent:
- param renderControl:
Constructs a window for displaying a QML scene with parent window
parent
.
- PySide2.QtQuick.QQuickWindow.CreateTextureOption¶
The enums are used to customize a texture is wrapped.
Constant
Description
QQuickWindow.TextureHasAlphaChannel
The texture has an alpha channel and should be drawn using blending.
QQuickWindow.TextureHasMipmaps
The texture has mipmaps and can be drawn with mipmapping enabled.
QQuickWindow.TextureOwnsGLTexture
The texture object owns the texture id and will delete the OpenGL texture when the texture object is deleted.
QQuickWindow.TextureCanUseAtlas
The image can be uploaded into a texture atlas.
QQuickWindow.TextureIsOpaque
The texture will return false for
hasAlphaChannel()
and will not be blended. This flag was added in Qt 5.6.
- PySide2.QtQuick.QQuickWindow.RenderStage¶
Constant
Description
QQuickWindow.BeforeSynchronizingStage
Before synchronization.
QQuickWindow.AfterSynchronizingStage
After synchronization.
QQuickWindow.BeforeRenderingStage
Before rendering.
QQuickWindow.AfterRenderingStage
After rendering.
QQuickWindow.AfterSwapStage
After the frame is swapped.
QQuickWindow.NoStage
As soon as possible. This value was added in Qt 5.6.
See also
- PySide2.QtQuick.QQuickWindow.SceneGraphError¶
This enum describes the error in a
sceneGraphError()
signal.Constant
Description
QQuickWindow.ContextNotAvailable
graphics context creation failed. This typically means that no suitable OpenGL implementation was found, for example because no graphics drivers are installed and so no OpenGL 2 support is present. On mobile and embedded boards that use OpenGL ES such an error is likely to indicate issues in the windowing system integration and possibly an incorrect configuration of Qt.
- PySide2.QtQuick.QQuickWindow.TextRenderType¶
This enum describes the default render type of text-like elements in Qt Quick ( Text , TextInput , etc.).
Select if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the render type will lend poor and sometimes pixelated results.
Constant
Description
QQuickWindow.QtTextRendering
Use Qt’s own rasterization algorithm.
QQuickWindow.NativeTextRendering
Use the operating system’s native rasterizer for text.
New in version 5.10.
- PySide2.QtQuick.QQuickWindow.NativeObjectType¶
Specifies the type of the native object passed to functions such as
createTextureFromNativeObject()
.Constant
Description
QQuickWindow.NativeObjectTexture
The native object is a 2D texture (OpenGL, Direct3D 11, Metal) or image (Vulkan).
New in version 5.14.
- PySide2.QtQuick.QQuickWindow.activeFocusItem()¶
- Return type:
This property holds The item which currently has active focus or
null
if there is no item with active focus..
- PySide2.QtQuick.QQuickWindow.activeFocusItemChanged()¶
- PySide2.QtQuick.QQuickWindow.afterAnimating()¶
- PySide2.QtQuick.QQuickWindow.afterRenderPassRecording()¶
- PySide2.QtQuick.QQuickWindow.afterRendering()¶
- PySide2.QtQuick.QQuickWindow.afterSynchronizing()¶
- PySide2.QtQuick.QQuickWindow.beforeRenderPassRecording()¶
- PySide2.QtQuick.QQuickWindow.beforeRendering()¶
- PySide2.QtQuick.QQuickWindow.beforeSynchronizing()¶
- PySide2.QtQuick.QQuickWindow.beginExternalCommands()¶
When mixing raw graphics (OpenGL, Vulkan, Metal, etc.) commands with scene graph rendering, it is necessary to call this function before recording commands to the command buffer used by the scene graph to render its main render pass. This is to avoid clobbering state.
In practice this function is often called from a slot connected to the
beforeRenderPassRecording()
orafterRenderPassRecording()
signals.The function does not need to be called when recording commands to the application’s own command buffer (such as, a VkCommandBuffer or MTLCommandBuffer + MTLRenderCommandEncoder created and managed by the application, not retrieved from the scene graph). With graphics APIs where no native command buffer concept is exposed (OpenGL, Direct 3D 11), and
endExternalCommands()
together provide a replacement forresetOpenGLState()
.Calling this function and
endExternalCommands()
is not necessary within therender()
implementation of aQSGRenderNode
because the scene graph performs the necessary steps implicitly for render nodes.Native graphics objects (such as, graphics device, command buffer or encoder) are accessible via
getResource()
.Warning
Watch out for the fact that
CommandListResource
may return a different object between -endExternalCommands()
. This can happen when the underlying implementation provides a dedicated secondary command buffer for recording external graphics commands within a render pass. Therefore, always query CommandListResource after calling this function. Do not attempt to reuse an object from an earlier query.Note
This function has no effect when the scene graph is using OpenGL directly and the RHI graphics abstraction layer is not in use. Refer to
resetOpenGLState()
in that case.Note
When the scenegraph is using the RHI graphics abstraction layer with the OpenGL backend underneath, pay attention to the fact that the OpenGL state in the context can have arbitrary settings, and this function does not perform any resetting of the state back to defaults. Call
resetOpenGLState()
if that is seen necessary.See also
- PySide2.QtQuick.QQuickWindow.clearBeforeRendering()¶
- Return type:
bool
Returns whether clearing of the color buffer is done before rendering or not.
See also
- PySide2.QtQuick.QQuickWindow.color()¶
- Return type:
This property holds The color used to clear the OpenGL context..
Setting the clear color has no effect when clearing is disabled. By default, the clear color is white.
- PySide2.QtQuick.QQuickWindow.colorChanged(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtGui.QColor
- PySide2.QtQuick.QQuickWindow.contentItem()¶
- Return type:
This property holds The invisible root item of the scene..
A
QQuickWindow
always has a single invisible root item containing all of its content. To add items to this window, reparent the items to the or to an existing item in the scene.
- PySide2.QtQuick.QQuickWindow.createTextureFromId(id, size[, options=QQuickWindow.CreateTextureOption()])¶
- Parameters:
id –
uint
size –
PySide2.QtCore.QSize
options –
CreateTextureOptions
- Return type:
Note
This function is deprecated.
Creates a new
QSGTexture
object from an existing OpenGL textureid
andsize
.The caller of the function is responsible for deleting the returned texture.
The returned texture will be using
GL_TEXTURE_2D
as texture target and assumes that internal format isGL_RGBA
. ReimplementQSGTexture
to create textures with different parameters.Use
options
to customize the texture attributes. The TextureUsesAtlas option is ignored.Warning
This function will return null if the scenegraph has not yet been initialized or OpenGL is not in use.
Note
This function only has an effect when using the default OpenGL scene graph adaptation.
Note
This function has no effect when running on the RHI graphics abstraction. Use
createTextureFromNativeObject()
instead.See also
- PySide2.QtQuick.QQuickWindow.createTextureFromImage(image)¶
- Parameters:
image –
PySide2.QtGui.QImage
- Return type:
This is an overloaded function.
- PySide2.QtQuick.QQuickWindow.createTextureFromImage(image, options)
- Parameters:
image –
PySide2.QtGui.QImage
options –
CreateTextureOptions
- Return type:
Creates a new
QSGTexture
from the suppliedimage
. If the image has an alpha channel, the corresponding texture will have an alpha channel.The caller of the function is responsible for deleting the returned texture. For example whe using the OpenGL adaptation the actual OpenGL texture will be deleted when the texture object is deleted.
When
options
containsTextureCanUseAtlas
, the engine may put the image into a texture atlas. Textures in an atlas need to rely onnormalizedTextureSubRect()
for their geometry and will not supportRepeat
. Other values fromCreateTextureOption
are ignored.When
options
containsTextureIsOpaque
, the engine will create an RGB texture which returns false forhasAlphaChannel()
. Opaque textures will in most cases be faster to render. When this flag is not set, the texture will have an alpha channel based on the image’s format.When
options
containsTextureHasMipmaps
, the engine will create a texture which can use mipmap filtering. Mipmapped textures can not be in an atlas.When using the OpenGL adaptation, the returned texture will be using
GL_TEXTURE_2D
as texture target andGL_RGBA
as internal format. ReimplementQSGTexture
to create textures with different parameters.Warning
This function will return 0 if the scene graph has not yet been initialized.
Warning
The returned texture is not memory managed by the scene graph and must be explicitly deleted by the caller on the rendering thread. This is achieved by deleting the texture from a
QSGNode
destructor or by usingdeleteLater()
in the case where the texture already has affinity to the rendering thread.This function can be called from any thread.
See also
- PySide2.QtQuick.QQuickWindow.createTextureFromNativeObject(type, nativeObjectPtr, nativeLayout, size[, options=QQuickWindow.CreateTextureOption()])¶
- Parameters:
type –
NativeObjectType
nativeObjectPtr –
void
nativeLayout – int
size –
PySide2.QtCore.QSize
options –
CreateTextureOptions
- Return type:
Creates a new
QSGTexture
object from an existing native object.The native object is wrapped, but not owned, by the resulting
QSGTexture
. The caller of the function is responsible for deleting the returnedQSGTexture
, but that will not destroy the underlying native object.type
specifies the type of the object. In practice the type isNativeObjectTexture
, indicating that the native object is a texture or image of the underlying graphics API. Other types may be introduced in the future.This function is currently suitable for 2D RGBA textures only.
Unlike
createTextureFromId()
, this function supports both direct OpenGL usage and the RHI abstracted rendering path.Warning
This function will return null if the scenegraph has not yet been initialized.
Use
options
to customize the texture attributes. Only theTextureHasAlphaChannel
andTextureHasMipmaps
are taken into account here.Warning
Unlike
createTextureFromId()
, this function never takes ownership of the native object, and theTextureOwnsGLTexture
flag is ignored.size
specifies the size in pixels.nativeObjectPtr
is a pointer to the native object handle. With OpenGL, the native handle is a GLuint value, sonativeObjectPtr
is then a pointer to a GLuint. With Vulkan, the native handle is a VkImage, sonativeObjectPtr
is a pointer to a VkImage. With Direct3D 11 and MetalnativeObjectPtr
is a pointer to a ID3D11Texture2D or MTLTexture pointer.Note
Pay attention to the fact that
nativeObjectPtr
is always a pointer to the native texture handle type, even if the native type itself is a pointer.nativeLayout
is only used for APIs like Vulkan. When applicable, it must specify the current image layout, such as, a VkImageLayout value.See also
sceneGraphInitialized()
QSGTexture
nativeTexture()
- PySide2.QtQuick.QQuickWindow.effectiveDevicePixelRatio()¶
- Return type:
float
Returns the device pixel ratio for this window.
This is different from
devicePixelRatio()
in that it supports redirected rendering viaQQuickRenderControl
. When using aQQuickRenderControl
, theQQuickWindow
is often not created, meaning it is never shown and there is no underlying native window created in the windowing system. As a result, querying properties like the device pixel ratio cannot give correct results. Use this function instead.See also
devicePixelRatio()
- PySide2.QtQuick.QQuickWindow.endExternalCommands()¶
When mixing raw graphics (OpenGL, Vulkan, Metal, etc.) commands with scene graph rendering, it is necessary to call this function after recording commands to the command buffer used by the scene graph to render its main render pass. This is to avoid clobbering state.
In practice this function is often called from a slot connected to the
beforeRenderPassRecording()
orafterRenderPassRecording()
signals.The function does not need to be called when recording commands to the application’s own command buffer (such as, a VkCommandBuffer or MTLCommandBuffer + MTLRenderCommandEncoder created and managed by the application, not retrieved from the scene graph). With graphics APIs where no native command buffer concept is exposed (OpenGL, Direct 3D 11),
beginExternalCommands()
and together provide a replacement forresetOpenGLState()
.Calling this function and
beginExternalCommands()
is not necessary within therender()
implementation of aQSGRenderNode
because the scene graph performs the necessary steps implicitly for render nodes.Note
This function has no effect when the scene graph is using OpenGL directly and the RHI graphics abstraction layer is not in use. Refer to
resetOpenGLState()
in that case.See also
- PySide2.QtQuick.QQuickWindow.frameSwapped()¶
- PySide2.QtQuick.QQuickWindow.grabWindow()¶
- Return type:
Grabs the contents of the window and returns it as an image.
It is possible to call the function when the window is not visible. This requires that the window is
created
and has a valid size and that no otherQQuickWindow
instances are rendering in the same process.Warning
Calling this function will cause performance problems.
Warning
This function can only be called from the GUI thread.
- static PySide2.QtQuick.QQuickWindow.hasDefaultAlphaBuffer()¶
- Return type:
bool
Returns whether to use alpha transparency on newly created windows.
See also
- PySide2.QtQuick.QQuickWindow.incubationController()¶
- Return type:
Returns an incubation controller that splices incubation between frames for this window.
QQuickView
automatically installs this controller for you, otherwise you will need to install it yourself usingsetIncubationController()
.The controller is owned by the window and will be destroyed when the window is deleted.
- PySide2.QtQuick.QQuickWindow.isPersistentOpenGLContext()¶
- Return type:
bool
Returns whether the OpenGL context can be released during the lifetime of the
QQuickWindow
.Note
This is a hint. When and how this happens is implementation specific. It also only has an effect when using the default OpenGL scene graph adaptation
- PySide2.QtQuick.QQuickWindow.isPersistentSceneGraph()¶
- Return type:
bool
Returns whether the scene graph nodes and resources can be released during the lifetime of this
QQuickWindow
.Note
This is a hint. When and how this happens is implementation specific.
- PySide2.QtQuick.QQuickWindow.isSceneGraphInitialized()¶
- Return type:
bool
Returns true if the scene graph has been initialized; otherwise returns false.
- PySide2.QtQuick.QQuickWindow.mouseGrabberItem()¶
- Return type:
Returns the item which currently has the mouse grab.
- PySide2.QtQuick.QQuickWindow.openglContext()¶
- Return type:
Returns the OpenGL context used for rendering.
Note
If the scene graph is not ready, or the scene graph is not using OpenGL (or RHI over OpenGL), this function will return null.
- PySide2.QtQuick.QQuickWindow.openglContextCreated(context)¶
- Parameters:
context –
PySide2.QtGui.QOpenGLContext
- PySide2.QtQuick.QQuickWindow.releaseResources()¶
This function tries to release redundant resources currently held by the QML scene.
Calling this function might result in the scene graph and the OpenGL context used for rendering being released to release graphics memory. If this happens, the
sceneGraphInvalidated()
signal will be called, allowing users to clean up their own graphics resources. ThesetPersistentOpenGLContext()
andsetPersistentSceneGraph()
functions can be used to prevent this from happening, if handling the cleanup is not feasible in the application, at the cost of higher memory usage.
- PySide2.QtQuick.QQuickWindow.renderTarget()¶
- Return type:
Returns the render target for this window.
The default is to render to the surface of the window, in which case the render target is 0.
Note
This function will return nullptr when not using the OpenGL scene graph adaptation.
Note
This function has no effect and returns nullptr when running on the RHI graphics abstraction.
See also
- PySide2.QtQuick.QQuickWindow.renderTargetId()¶
- Return type:
uint
Returns the FBO id of the render target when set; otherwise returns 0.
- PySide2.QtQuick.QQuickWindow.renderTargetSize()¶
- Return type:
Returns the size of the currently set render target; otherwise returns an empty size.
- PySide2.QtQuick.QQuickWindow.rendererInterface()¶
- Return type:
Returns the current renderer interface. The value is always valid and is never null.
Note
This function can be called at any time after constructing the
QQuickWindow
, even whileisSceneGraphInitialized()
is still false. However, some renderer interface functions, in particulargetResource()
will not be functional until the scenegraph is up and running. Backend queries, likegraphicsApi()
orshaderType()
, will always be functional on the other hand.Note
The ownership of the returned pointer stays with Qt. The returned instance may or may not be shared between different
QQuickWindow
instances, depending on the scenegraph backend in use. Therefore applications are expected to query the interface object for eachQQuickWindow
instead of reusing the already queried pointer.See also
QSGRenderNode
QSGRendererInterface
- PySide2.QtQuick.QQuickWindow.resetOpenGLState()¶
Call this function to reset the OpenGL context its default state.
The scene graph uses the OpenGL context and will both rely on and clobber its state. When mixing raw OpenGL commands with scene graph rendering, this function provides a convenient way of resetting the OpenGL context state back to its default values.
This function does not touch state in the fixed-function pipeline.
This function does not clear the color, depth and stencil buffers. Use
setClearBeforeRendering
to control clearing of the color buffer. The depth and stencil buffer might be clobbered by the scene graph renderer. Clear these manually on demand.Note
This function only has an effect when using the default OpenGL scene graph adaptation.
Note
This function will only reset the OpenGL context in relation to what has been changed internally as part of the OpenGL scene graph. It does not reset anything that has been changed externally such as direct OpenGL calls done inside the application code if those same calls are not used internally.
Note
This function has no effect when running on the RHI graphics abstraction and the underlying RHI backend is not OpenGL.
- PySide2.QtQuick.QQuickWindow.sceneGraphAboutToStop()¶
- static PySide2.QtQuick.QQuickWindow.sceneGraphBackend()¶
- Return type:
str
Returns the requested Qt Quick scenegraph backend.
Note
The return value of this function may still be outdated by subsequent calls to
setSceneGraphBackend()
until the firstQQuickWindow
in the application has been constructed.See also
- PySide2.QtQuick.QQuickWindow.sceneGraphError(error, message)¶
- Parameters:
error –
SceneGraphError
message – str
- PySide2.QtQuick.QQuickWindow.sceneGraphInitialized()¶
- PySide2.QtQuick.QQuickWindow.sceneGraphInvalidated()¶
- PySide2.QtQuick.QQuickWindow.scheduleRenderJob(job, schedule)¶
- Parameters:
job –
PySide2.QtCore.QRunnable
schedule –
RenderStage
Schedules
job
to run when the rendering of this window reaches the givenstage
.This is a convenience to the equivalent signals in
QQuickWindow
for “one shot” tasks.The window takes ownership over
job
and will delete it when the job is completed.If rendering is shut down before
job
has a chance to run, the job will be run and then deleted as part of the scene graph cleanup. If the window is never shown and no rendering happens before theQQuickWindow
is destroyed, all pending jobs will be destroyed without their run() method being called.If the rendering is happening on a different thread, then the job will happen on the rendering thread.
If
stage
isNoStage
,job
will be run at the earliest opportunity whenever the render thread is not busy rendering a frame. If there is no OpenGL context available or the window is not exposed at the time the job is either posted or handled, it is deleted without executing the run() method. If a non-threaded renderer is in use, the run() method of the job is executed synchronously. The OpenGL context is changed to the renderer context before executing aNoStage
job.Note
This function does not trigger rendering; the jobs targeting any other stage than
NoStage
will be stored run until rendering is triggered elsewhere. To force the job to run earlier, callupdate()
;
- PySide2.QtQuick.QQuickWindow.sendEvent(arg__1, arg__2)¶
- Parameters:
arg__1 –
PySide2.QtQuick.QQuickItem
arg__2 –
PySide2.QtCore.QEvent
- Return type:
bool
Note
This function is deprecated.
Propagates an event
e
to aQQuickItem
item
on the window.Use
sendEvent()
directly instead.The return value is currently not used.
- PySide2.QtQuick.QQuickWindow.setClearBeforeRendering(enabled)¶
- Parameters:
enabled – bool
Sets whether the scene graph rendering of QML should clear the color buffer before it starts rendering to
enabled
.By disabling clearing of the color buffer, it is possible to render OpengGL content under the scene graph.
The color buffer is cleared by default.
Warning
This flag is ignored completely when running with the RHI graphics abstraction instead of using OpenGL directly. As explicit clear commands simply do not exist in some modern APIs, the scene graph cannot offer this flexibility anymore. The images associated with a render target will always get cleared when a render pass starts. As a solution, an alternative to disabling scene graph issued clears is provided in form of the
beforeRenderPassRecording()
signal.
- PySide2.QtQuick.QQuickWindow.setColor(color)¶
- Parameters:
color –
PySide2.QtGui.QColor
This property holds The color used to clear the OpenGL context..
Setting the clear color has no effect when clearing is disabled. By default, the clear color is white.
- static PySide2.QtQuick.QQuickWindow.setDefaultAlphaBuffer(useAlpha)¶
- Parameters:
useAlpha – bool
useAlpha
specifies whether to use alpha transparency on newly created windows.In any application which expects to create translucent windows, it’s necessary to set this to true before creating the first
QQuickWindow
. The default value is false.See also
- PySide2.QtQuick.QQuickWindow.setPersistentOpenGLContext(persistent)¶
- Parameters:
persistent – bool
Sets whether the OpenGL context should be preserved, and cannot be released until the last window is deleted, to
persistent
. The default value is true.The OpenGL context can be released to free up graphics resources when the window is obscured, hidden or not rendering. When this happens is implementation specific.
The
aboutToBeDestroyed()
signal is emitted from theopenglContext()
when the OpenGL context is about to be released. ThesceneGraphInitialized()
signal is emitted when a new OpenGL context is created for this window. Make aDirectConnection
to these signals to be notified.The OpenGL context is still released when the last
QQuickWindow
is deleted.Note
This only has an effect when using the default OpenGL scene graph adaptation.
See also
isPersistentOpenGLContext()
setPersistentSceneGraph()
aboutToBeDestroyed()
sceneGraphInitialized()
- PySide2.QtQuick.QQuickWindow.setPersistentSceneGraph(persistent)¶
- Parameters:
persistent – bool
Sets whether the scene graph nodes and resources are
persistent
. Persistent means the nodes and resources cannot be released. The default value istrue
.The scene graph nodes and resources can be released to free up graphics resources when the window is obscured, hidden or not rendering. When this happens is implementation specific.
The
sceneGraphInvalidated()
signal is emitted when cleanup occurs. ThesceneGraphInitialized()
signal is emitted when a new scene graph is recreated for this window. Make aDirectConnection
to these signals to be notified.The scene graph nodes and resources are still released when the last
QQuickWindow
is deleted.
- PySide2.QtQuick.QQuickWindow.setRenderTarget(fboId, size)¶
- Parameters:
fboId –
uint
size –
PySide2.QtCore.QSize
This is an overloaded function.
Sets the render target for this window to be an FBO with
fboId
andsize
.The specified FBO must be created in the context of the window or one that shares with it.
Note
fboId
can also be set to 0. In this case rendering will target the default framebuffer of whichever surface is current when the scenegraph renders.size
must still be valid, specifying the dimensions of the surface.Note
This function only has an effect when using the default OpenGL scene graph adaptation.
Warning
This function can only be called from the thread doing the rendering.
- PySide2.QtQuick.QQuickWindow.setRenderTarget(fbo)
- Parameters:
Sets the render target for this window to be
fbo
.The specified fbo must be created in the context of the window or one that shares with it.
Note
This function only has an effect when using the default OpenGL scene graph adaptation.
Note
This function has no effect when running on the RHI graphics abstraction.
Warning
This function can only be called from the thread doing the rendering.
See also
- static PySide2.QtQuick.QQuickWindow.setSceneGraphBackend(api)¶
- Parameters:
api –
GraphicsApi
Requests a Qt Quick scenegraph backend for the specified graphics
api
. Backends can either be built-in or be installed in form of dynamically loaded plugins.Note
The call to the function must happen before constructing the first
QQuickWindow
in the application. It cannot be changed afterwards.If the selected backend is invalid or an error occurs, the default backend (OpenGL or software, depending on the Qt configuration) is used.
See also
- static PySide2.QtQuick.QQuickWindow.setSceneGraphBackend(backend)
- Parameters:
backend – str
- static PySide2.QtQuick.QQuickWindow.setTextRenderType(renderType)¶
- Parameters:
renderType –
TextRenderType
Sets the default render type of text-like elements in Qt Quick to
renderType
.Note
setting the render type will only affect elements created afterwards; the render type of existing elements will not be modified.
See also
- static PySide2.QtQuick.QQuickWindow.textRenderType()¶
- Return type:
Returns the render type of text-like elements in Qt Quick. The default is
QtTextRendering
.See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.