How does Dear ImGui compare to Qt?
How does Dear ImGui compare to Qt?
if (ImGui::Button("X")) { //pressed handler }
This renders the button and handles its state at the same time.
Qt is a more traditional callback based UI although with their own signal/slot system which has nice features like thread safety built in. I last used Qt a while ago though so maybe it works different nowadays.
Qt is essentially a full-blown operating system wrapper, Dear ImGui is much more focused on creating UIs quickly and has a different background (coming out of the gamedev world for creating inhouse-tools and debugging UIs integrated into games). It's just around 25kloc of code, has no external dependencies, compiles to a few dozen KBytes and is very easy to integrate into an existing code base.
Dear ImGui keeps (internal) state around between frames, maybe not as much as other UI frameworks, but it does. Especially the rendering isn't "immediate mode", the UI isn't rendered while running the code that's building the API. Instead Dear ImGui builds a "deferred mode" rendering command list which is actually very efficient in terms of required draw calls.
The main difference to traditional UI frameworks is that there are no different code paths for UI creation, UI updating, and handling input. Instead all those things are happening in the same sequential code flow.
That being said, real GUI frameworks like Qt are a much better choice for 97 % of "end-user tools", because they have all the bells and whistles you do, in fact, want to have in a desktop application (RAD tools, proper layout system, proper menu/action system, accessibility integration, state inspection etc.)
None of that is incompatible with the immediate-mode-UI philosophy though, it's just that this specific UI toolkit (Dear ImGui) is coming from a direction where those things haven't been that important.
The internal implementation may be much more complicated than what Dear ImGui does, maybe it's necessary to run multiple passes over the UI description to create the layout, etc... but that might be worth it if the programming model remains as simple as it is now.