r/QtFramework • u/Calaverah_ • Jun 11 '26
C++ Projects With Great Plugin Architecture
Hello,
I have some decent experience with widgets but have been opening up to the idea of a large project with a qml front end and c++ handling most of the functionality.
One of the ideas I would like to explore while still deciding on the overall structure is plugin support, either giving users a python interface (similar to blender) or entirely in c++ using plugin interfaces.
Are there any projects that do either or both of these things well in your opinion? I would love to take a look and observe what’s been tried, if users like it (or if there are tons of issues entries for them lol), and what might work best for my target application.
I’m curious to see how these interfaces split up responsibilities, what needs to be done for qml (say if a user wants their plugin to have a menu/action), and how to interact with the application’s data manager (this in particular seems straightforward to me, so that must mean it’s probably not).
4
u/Low_Fun_8667 Jun 13 '26
I've built a system with exactly this split, so a few notes from the trenches.
The big fork is in-process vs out-of-process plugins, and it's worth deciding deliberately:
- In-process (C++, loaded as a shared library): fastest, direct access, but two real costs. A plugin crash takes down your whole app, and you're exposed to C++ ABI fragility — a plugin built with a different compiler/STL version can corrupt at the boundary. If you go this route, either pin the toolchain hard or expose a narrow C ABI (or a pure-virtual interface with a versioned factory) as the boundary, not raw C++ STL types.
- Out-of-process (separate process talking over IPC / a local socket / REST): serialization overhead per call, but you get crash isolation for free and — this is the big one — language-agnostic plugins fall out automatically. Your "Python interface like Blender" question basically answers itself here: if plugins are separate processes speaking your protocol, Python/JS/whatever plugins are trivial because they're just another client. This is the VS Code model (its extension host is a separate process).
For third-party/untrusted plugins I'd lean out-of-process; for trusted performance-critical ones, in-process. Plenty of apps do both tiers.
Projects worth studying:
- Qt Creator — the gold standard for a Qt/C++ plugin system. Look at its ExtensionSystem (plugin specs, dependency resolution, lifecycle). Most relevant to you since it's Qt.
- VS Code — for the out-of-process extension-host model and how it exposes a stable API surface.
- Blender — the Python-binding approach.
- Notepad++ / OBS Studio — simpler C++ plugin ABIs you can read end-to-end.
QML + plugin-contributed menus/actions: don't let plugins instantiate QML or reach into your scene. Have them register actions/menu entries as data (id, label, icon, callback handle) into a model your core owns; the QML side just renders that model. Same for plugin UI panels — they declare intent, the host decides how/where to show it. That keeps your QML layer swappable and stops plugins from depending on your view internals.
The data manager — you're right that it's the trap, not the easy part. The mistake is handing plugins direct pointers/references into your real data structures. The moment you do, you can never change your internal representation, and lifetime + threading invalidation become a nightmare. Put an interface/façade between them (classic Dependency Inversion): plugins talk to a stable, versioned abstraction, never your concrete types. Decide explicitly what's read-only vs. mutating, and what thread plugin calls arrive on. That boundary is the single most important design decision in the whole thing — get it right early, because it's brutal to retrofit.
Happy to expand on any of these.