QInferenceBackendFactory Class
The QInferenceBackendFactory class creates QInferenceBackendStep and QInferenceBackendFlow instances from loaded plugins. More...
| Header: | #include <QInferenceBackendFactory> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS EdgeAi)target_link_libraries(mytarget PRIVATE Qt6::EdgeAi) |
| qmake: | QT += edgeai |
| Inherits: | QObject |
| Status: | Technical Preview |
Public Functions
| QInferenceBackendStep * | createBackendStep(QInferenceStep *step, const QString &backend) |
| QInferenceBackendFlow * | createInferenceFlowBackend(QInferenceFlow *parent) |
| void | registerFlowProvider(const QString &backend, QInferenceFlowBackendProvider *provider) |
| void | registerStepProvider(const QString &backend, const QString &category, QInferenceBackendStepProvider *provider) |
| bool | unregisterFlowProvider(const QString &backend) |
| bool | unregisterStepProvider(const QString &backend, const QString &category) |
Static Public Members
| QString | defaultBackend() |
| QInferenceBackendFactory * | instance() |
Detailed Description
The factory is a singleton. It loads plugins implementing QInferenceFlowBackendProvider or QInferenceBackendStepProvider from the edgeai subdirectory of the application's library paths, and uses them to create the backend implementations behind QInferenceFlow and the QInferenceStep subclasses.
See also createBackendStep(), createInferenceFlowBackend(), and instance().
Member Function Documentation
QInferenceBackendStep *QInferenceBackendFactory::createBackendStep(QInferenceStep *step, const QString &backend)
Creates a QInferenceBackendStep for step, which is the QInferenceStep that owns the new implementation. The provider is selected within backend, the backend name such as "gstreamer", by the step's "name" option if a provider is registered under that name, and by the step's category() otherwise. Returns the new implementation, or nullptr if no matching provider is available. <<<<<<< HEAD step The QInferenceStep that owns this implementation. Its QInferenceStep::category() selects the step provider within backend. backend The backend name (e.g. "gstreamer") whose plugin should provide the step.
=======
>>>>>>> 34467a9 (Doc: Add C++ API documentation for QtEdgeAI module)
See also createInferenceFlowBackend(), registerStepProvider(), QInferenceBackendStepProvider::createBackendStep(), and defaultBackend().
QInferenceBackendFlow *QInferenceBackendFactory::createInferenceFlowBackend(QInferenceFlow *parent)
Creates and returns a new QInferenceBackendFlow from the QInferenceFlowBackendProvider registered for defaultBackend(), or nullptr if no matching provider is available. parent is the QInferenceFlow that will own the backend flow.
======= Creates and returns a new QInferenceBackendFlow from the QInferenceFlowBackendProvider registered for defaultBackend(), or nullptr if no matching provider is available. parent is the QInferenceFlow that will own the backend flow.
>>>>>>> 34467a9 (Doc: Add C++ API documentation for QtEdgeAI module)
See also defaultBackend(), createBackendStep(), and QInferenceFlowBackendProvider::createFlow().
[static] QString QInferenceBackendFactory::defaultBackend()
Returns the backend name used to create flows and their steps. The value of the QT_INFERENCE_FLOW_BACKEND environment variable takes precedence; if it is unset or empty, the default backend ("gstreamer") is used.
See also createInferenceFlowBackend() and createBackendStep().
[static] QInferenceBackendFactory *QInferenceBackendFactory::instance()
Returns the singleton instance of the factory.
See also createBackendStep() and createInferenceFlowBackend().
void QInferenceBackendFactory::registerFlowProvider(const QString &backend, QInferenceFlowBackendProvider *provider)
Registers provider as the flow backend for backend, replacing any earlier registration under the same name. The factory does not take ownership; provider must outlive the factory's use of it. This complements plugin-based discovery and is primarily useful for supplying a mock backend in tests without loading a plugin.
See also unregisterFlowProvider(), createInferenceFlowBackend(), and defaultBackend().
void QInferenceBackendFactory::registerStepProvider(const QString &backend, const QString &category, QInferenceBackendStepProvider *provider)
Registers provider as the step provider for category within backend, replacing any earlier registration under the same pair. The factory does not take ownership; provider must outlive the factory's use of it. This complements plugin-based discovery and is primarily useful for supplying a mock backend in tests without loading a plugin.
See also unregisterStepProvider(), registerFlowProvider(), and createBackendStep().
bool QInferenceBackendFactory::unregisterFlowProvider(const QString &backend)
<<<<<<< HEAD Removes the flow provider registered for backend, so that the factory no longer refers to it. Returns true if a provider was registered for backend, or false if there was nothing to remove.
Because the factory does not own registered providers, a caller that destroys a provider must unregister it first; otherwise the factory is left holding a dangling pointer.
See also registerFlowProvider() and createInferenceFlowBackend().
bool QInferenceBackendFactory::unregisterStepProvider(const QString &backend, const QString &category)
Removes the step provider registered for category within backend, so that the factory no longer refers to it. Returns true if a provider was registered for that pair, or false if there was nothing to remove. When the last category of backend is removed, the backend itself is dropped as well.
Because the factory does not own registered providers, a caller that destroys a provider must unregister it first; otherwise the factory is left holding a dangling pointer.
See also registerStepProvider() and createBackendStep().
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.