r/cpp • • Oct 25 '26

Pain of making a native GUI in cpp

So I just wanted to vent about the absolute pain of making a working gui in cpp, I am working on a scientific project to make an openFOAM gui and browse openFOAM code to add TENO schemes to it from scientific papers such as Fu et al and working through the binaries.

I have not used AI in this project because CFD is very delicate and quite frankly, AI is not ready for such complexity - especially numerical schemes such as TENO, I ended up writing the meshing, topological code and mathematics myself and by far, the hardest part was the gui coordinates and memory management. I wanted to PULL MY HAIR OUT because of managing segfaults, crashes because of a random pointer hidden inside a 2000 line function, I had to also manage internal functions of openfoam(and you know how that goes), boundary conditions, and mesh topology, it was driving me nuts. I generally regard myself as fluent in programming languages such as cpp, python, rust etc, but this is a whole nother of level data management.

in the end it turned out to be a pretty good contribution to the openFOAM community, hopefully the project will mature further and I will be able to write a paper on it.

0 Upvotes

50 comments sorted by

View all comments

Show parent comment

3

u/eyes-are-fading-blue Oct 25 '26

Which framework would you suggest? I am also looking a GUI framework for a personal project.

6

u/Big_Target_1405 Oct 25 '26

Qt is basically the only thing worth using imho

The other alternative is to go to another language (likely JavaScript) with a C++ backend

12

u/johannes1971 Oct 26 '26

PLEASE don't inflict a 300MB application on people, just to show a few buttons. Electron and the like are such a complete waste of resources.

1

u/bananamantheif 17d ago

how much ram does a QT app use compared to that?

-5

u/Big_Target_1405 Oct 26 '26

300MB is really zero these days

3

u/AvidCoco Oct 25 '26

That’s not good advice. There are plenty of C++ frameworks besides Qt.

0

u/Big_Target_1405 Oct 25 '26 edited Oct 25 '26

Name them?

wxWidgets uses Qt, GTK+ and Windows as a backend so can't offer anything Qt can't

GtkMM would be horrendous to build and distribute cross platform and the website doesn't even exist right now

What else?

5

u/draeand Oct 25 '26

Uh... WX does not use QT as a backend. If it does I'd appreciate a source.

-2

u/AvidCoco Oct 25 '26

7

u/Big_Target_1405 Oct 25 '26

Yeah, nobody is writing anything important in such an obscure framework.

For anything serious you might want to actually pass to customers, and support well, while being cross platform, it's basically Qt

5

u/AvidCoco Oct 25 '26

Lmao do you get paid by Qt or something?

Every GUI framework exists for a reason. Just because you wouldn’t use it doesn’t mean it’s “obscure”. Qt is massively overkill for most projects.

4

u/Big_Target_1405 Oct 25 '26

I wrote a commercial cross platform GUI application professionally for several years, across Linux, Windows and macOS

Nothing except Qt was actually worth our time as a small shop with just a few developers

As soon as you need to go cross platform the maintenance cost increases dramatically

2

u/AvidCoco Oct 25 '26

Yes and I also did that and we specifically avoided Qt.

1

u/Chaosvex Oct 27 '26

So, what did you use?

1

u/eyes-are-fading-blue Oct 25 '26

Well, that’s one thing I want to avoid :). Would it make sense to provide C++ end points and use javascript/html for UI rendering? I was also thinking maybe a WASM compilation for the entire project and tie that to HTML somehow.

What I plan to build is an editor for a game but frankly, I don’t want to write C++ code for GUI. Never done something like this, so looking for ideas from experienced people on this department.

1

u/AvidCoco Oct 25 '26

I’d avoid Qt unless you happen to be particularly wealthy.

ImGUI is great for personal projects.

7

u/mpyne Oct 25 '26

I’d avoid Qt unless you happen to be particularly wealthy.

You don't need to pay for a license for a personal project.

8

u/Prestigious-Bet8097 Oct 25 '26

Or a commercial project, if you use it under its LGPL licence.

6

u/draeand Oct 25 '26

Please don't do this unless you have a plan for accessibility support (what if I want to use your product, for instance?). Also isn't ImGUI meant for like game debugging and stuff and not for actual apps?

0

u/AvidCoco Oct 25 '26

Don’t do what? Any UI framework that properly integrates the native accessibility APIs will have accessibility support.

6

u/draeand Oct 25 '26

Use ImGui I mean. ImGui does not integrate with native accessibility frameworks.

0

u/RiceBroad4552 27d ago

In case you didn't know: ImGui is an immediate-mode GUI toolkit that provides its own widget and rendering abstractions rather than relying on native OS widgets. It does not maintain a conventional retained-mode UI tree or expose an OS accessibility tree by default. Consequently, screen-reader accessibility requires an additional accessibility layer that maps ImGui's widgets and interaction state to the relevant OS accessibility APIs. This is clearly stated in the docs.

3

u/Prestigious-Bet8097 Oct 25 '26

Barring a couple of modules, QT is free if you want it to be free.

It's available under the LGPL licence; free for personal and commercial use.

0

u/RiceBroad4552 27d ago

Qt is is as free as software can possibly get! It's GPL code.

Monetary cost is exactly zero.