On this page

QInferenceDataPort Class

The QInferenceDataPort class represents an input or output of a QInferenceStep through which data flows. More...

Header: #include <QInferenceDataPort>
CMake: find_package(Qt6 REQUIRED COMPONENTS EdgeAi)
target_link_libraries(mytarget PRIVATE Qt6::EdgeAi)
qmake: QT += edgeai
Inherits: QObject
Status: Technical Preview

Public Types

enum class Direction { In, Out }
enum class Type { Text, Audio, Video, Image, Json }
flags Types

Properties

Public Functions

QInferenceDataPort(std::unique_ptr<QInferenceBackendDataPort> implementation, QObject *parent = nullptr)
bool connectTo(QInferenceDataPort *other)
QInferenceDataPort::Direction direction() const
bool isConnected() const
QString name() const
QInferenceDataPort::Type type() const

Signals

void connectedChanged()
void dataAvailable(const QVariant &data)

Detailed Description

Ports have a name(), a type() such as Video or Json, and a direction() of In or Out. Use connectTo() to connect an output port to an input port of another step.

See also QInferenceStep, QInferenceDataPort::Type, QInferenceDataPort::Direction, and connected.

Member Type Documentation

enum class QInferenceDataPort::Direction

This enum describes the direction in which data flows through a port.

ConstantValueDescription
QInferenceDataPort::Direction::In0Input port.
QInferenceDataPort::Direction::Out1Output port.

enum class QInferenceDataPort::Type
flags QInferenceDataPort::Types

This enum describes the type of data carried by a port, and how dataAvailable() packs it into a QVariant.

ConstantValueDescription
QInferenceDataPort::Type::Text0x00001Text data. In the shipped GStreamer backend, this carries JSON text to parse, as a QByteArray or QString, not arbitrary text.
QInferenceDataPort::Type::Audio0x00002Audio data. Not yet produced or consumed by any built-in step.
QInferenceDataPort::Type::Video0x00004Video data. Not delivered through dataAvailable(): backends hand frames off directly inside the pipeline graph instead.
QInferenceDataPort::Type::Image0x00008Image data. Not yet produced or consumed by any built-in step.
QInferenceDataPort::Type::Json0x0010JSON data, delivered as the QByteArray returned by QJsonDocument::toJson().

The Types type is a typedef for QFlags<Type>. It stores an OR combination of Type values.

Property Documentation

[read-only] connected : bool

This property holds whether this port is connected to another port.

The property turns true once connectTo() links this port to another one, on both the source and the target port.

Access functions:

bool isConnected() const

Notifier signal:

void connectedChanged()

See also connectTo().

Member Function Documentation

[explicit] QInferenceDataPort::QInferenceDataPort(std::unique_ptr<QInferenceBackendDataPort> implementation, QObject *parent = nullptr)

Creates a QInferenceDataPort that takes over implementation, with the given parent. The implementation must have its direction set (via setDirection()) before construction. QInferenceBackendStep uses this constructor when it creates ports; applications typically access ports via QInferenceStep::inputPorts(), outputPorts(), or port().

bool QInferenceDataPort::connectTo(QInferenceDataPort *other)

Connects this output port to other, which must be an input port carrying the same Type. Returns true if the connection succeeds; otherwise returns false, after warning, when the directions or the types do not match. On success, the connected property turns true on both ports.

See also connected.

[signal] void QInferenceDataPort::dataAvailable(const QVariant &data)

This signal is emitted when data reaches this port. The concrete type held by data depends on type() (see Type) and, for Audio, Text, and Json ports, on the specific model, plugin, or backend element that produced it; it cannot be interpreted without knowing those.

Video ports do not emit this signal. Video data is handed off directly inside the backend's pipeline graph (for example, linked GStreamer pads) rather than delivered through data.

QInferenceDataPort::Direction QInferenceDataPort::direction() const

Returns the direction of this port, either In or Out.

See also name() and type().

QString QInferenceDataPort::name() const

Returns the name of this port.

QInferenceDataPort::Type QInferenceDataPort::type() const

Returns the data type of this port, such as Video or Json.

See also Type.

© 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.