Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using Qt widgets in OpenGL application
kagami_kuro last edited by
Is there a way to use QTextEdit, QPushButton and other widgets and layouts in OpenGL application? For example, if I want styled text field with editable text, selection, copy&paste and a button to process this text in my game. Or should I use low-level features? If so, then from which features should I start? I can render text using QOpenGLTexture, QFontMetrics and QPainter, but instead I'd like to use QLabel.
A Former User last edited by
Hi! If all you need is an overlay with controls over the scene, then you can simply place widgets on top of a QOpenGLWidget. If you somehow want to embed widgets in a 3D scene: no, that's not supported. In this case better use a game engine.
kagami_kuro last edited by kagami_kuro
@Wieland My hobby for this month is own game engine :) And I think I've found a solution: rich text related classes QTextDocument, QTextLayout, QTextCursor etc. Rich text can be edited programmatically and rendered into texture using QPainter. I can create own text widgets.
Jagh last edited by Jagh
There are also libraries that you can use in your OpenGL side to implement various UI features,
CeGUI comes to my mind, but there are others.