Skip to content

Render QWidget to texture #1504

Closed Answered by AnyOldName3
avilkinnick asked this question in Q&A
Discussion options

You must be logged in to vote

If you can get a texture containing the QWidget's pixels, it should be fairly straightforward to use a visitor to replace the mesh's existing texture with the new one, and things like mismatched size won't matter.

However, getting an arbitrary QWidget into a texture could be difficult. From the cursory investigation I've just done, it doesn't look like Qt provides a cross-platform way to do this, so you'll need to come up with a platform-specific system to do this. E.g. on Windows, every QWidget has a native window, and you could get that window's device context and blit its pixels into another one which you control and have mapped to a texture, and on a modern Wayland-based Linux distro,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by avilkinnick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants