Qt (QOpenGLWidget / QOpenGLWindow) backend for ImGui
It enables ImGui to run in QOpenGLWidget / QOpenGLWindow.
- Add QtImGui sources and headers to your project
- If you are using git submodule, run
git submodule update --init --recursive
to ensure that the inner submodule is initialized as well.
- If you are using git submodule, run
- Add
include(path/to/qtimgui.pri)
to your.pro
file - Subclass
QOpenGLWindow
orQOpenGLWidget
and:
class DemoWindow : public QOpenGLWindow
{
protected:
void initializeGL() override
{
QtImGui::initialize(this);
}
void paintGL() override
{
// you can do custom GL rendering as well in paintGL
QtImGui::newFrame();
ImGui::Text("Hello");
// more widgets...
ImGui::Render();
}
};
See QOpenGLWidget example and QOpenGLWindow example for details.
Two projects are provided: qtimgui.pro
and CMakaLists.txt
.
When using cmake under Android, this project will uses qt-android-cmake, which is a CMake utility for building and deploying Qt based applications on Android without QtCreator.
In order to successfuly deploy the app to a device, the cmake variable ANDROID_NATIVE_API_LEVEL should elevated to 21 or 26 (depending on the native levels installed in your android sdk) You will need to set it via the cmake command line, or inside Qt Creator (in the project view).