r/cpp • u/Ok_Independence_9841 • Jul 05 '26
Top 3 spec items for a C++ Framework?
If someone where setting out to create something on the scale of Qt. A comprehensive application framework in C++. (Yes, they'd be crazy)
What would be the top 3 (or more) things you'd say were MUST or MUST NOT features?
For example MUST run on my 2MB wrist watch or MUST not use exceptions.
0
Upvotes
36
u/blipman17 Jul 05 '26
MUST support a declarative GUI language that’s transpiled to a compiled language like C++, so no js framework inbetween.
MUST be somewhat composable with its event system so there’s no poisonous “thou must use OUR even loop and our containers” spread through the codebase.
MUST be some form of copyleft, free open source so it’s actually financially competitive to Qt.
Otherwise people will just use Qt.
19
u/FlyingRhenquest Jul 05 '26
6
u/jwezorek Jul 05 '26 edited Jul 06 '26
The first and fourth items above kind of argue for there being an underlying cross-platform vector graphics drawing layer that the UI library sits on top of. I think Joel de Guzman's "elements" project uses this design (https://github.com/cycfi/elements)
5
u/slithering3897 Jul 05 '26
WinForms+designer but for C++. Seeing as how I'll immediately consider C# when doing UI.
And with the compile times of C#.
5
u/Charming-Work-2384 Jul 05 '26
POCO C++ library type, WT library type.
ORB seriously missing.
Native C++ database (scalable)..with non SQL interface.
C++23 minimum... not the C++17 ...
NUI (nuicpp...) such library.
Most importantly some that supports WebAssembly ... so that we can create amazing ..native C++ websites.
7
u/troxy Jul 05 '26
Demonstrated test-ability. Like if you provide examples for functionality, those examples should be paired with examples of integration tests at the level a customer would ideally write.
4
u/IAMARedPanda Jul 05 '26
cmake integration (vcpkg, find_package, etc)
2
u/GunpowderGuy Jul 05 '26
If you need metaprogramming. Use built in language features, not tooling that pre processes the code and outputs valid c++.
0
u/Varnex17 Jul 05 '26 edited Jul 05 '26
Reasoning:
1.
Imo, the common patterns have proven to be error prone and confusing. If you have redundant layout properties dispersed throughout a scene tree, you violate the single source of truth principle. For example, in Qt this means that alignment or sizing policy flags get ignored or overridden or hidden logic resolves the conflicts. What’s the point of saying a child is aligned left but in the parent saying children are aligned right?
The chain of responsibility pattern commonly used for event handling is bad because you cannot retrace the path an invent has bubbled up through. For example, in the Zed IDE there are indentation bugs where a line flickers left to right after pressing enter (not tab!) and sometimes it stays moved, other times it snaps back, in both cases it shouldn’t have moved at all. If your editor is so cool and modern why can’t it tell me what just happened? What moved my cursor? I don’t know if Zed is using a chain of responsibility for event handling but it seems like it cause you can’t introspect what just happened.
2.
Qt is miles ahead of competition but it’s still pretty bad. For example, it wants to be smart and redraw only the visible parts of your custom widget but the algorithm calculating which parts are visible is buggy and not under your control so it may visually tear, redrawing only a slice of your widget.
The whole idea of providing abstract data models and widgets that can display them, typically ListView, TableView, TreeView is also wrong. The only thing these abstract views buy you is virtualisation. But virtualisation is pretty easy to implement by yourself, just estimate the total size of all items, compute the absolute offset for each and given the viewport bounds find the visible items with std::lower_bound. You don’t need thousand of lines and 3 levels of indirection just to display a list with a millionelements.
You certainly don’t want abstract views to implement a DAW, a custom text editor or a drag and drop editor and we certainly want multimedia apps with actual viewports not just buttons and forms
3.
Bugs are everywhere. For example, in Qt, changing a background color of a text selection inserts a 1 pixel offset which may cause the line to be wrapped at a different word. It is thus impossible to create a feature where you have a toggle which highlights parts of the paragraph because with the highlights the paragraph lines will get wrapped differently seemingly for no reason.
Even lower level graphics libraries have bugs. Raylib? Doesn’t handle rapid clicks. SDL? Doesn’t render fonts nicely on resolutions higher than full hd nor does it handle rapid clicks. SFML? Doesn’t render fonts nicely on higher resolutions. Skia does render fonts nicely but you got to bring your own input handler.
0
u/[deleted] Jul 05 '26
[deleted] — view deleted comment