IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QProtobufMessage Class

Base class for all protobuf messages.

This class was introduced in Qt 6.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QProtobufMessage Class

  • Header: QProtobufMessage

  • Since: Qt 6.5

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Protobuf)

    target_link_libraries(mytarget PRIVATE Qt6::Protobuf)

Detailed Description

Provides access to the properties of a message, using setProperty() and property(), without depending on what the message is.

Member Function Documentation

 

[static] QProtobufMessagePointer QProtobufMessage::constructByName(const QString &messageType)

Constructs QProtobufMessage using messageType. Returns a pointer to the constructed QProtobufMessage.

This function attempts to create a message whose type matches messageType. If messageType is unknown, the function returns nullptr. If the message is not found in the registry, the function returns nullptr. Ownership of the constructed message is given to the function caller.

QVariant QProtobufMessage::property(QAnyStringView propertyName) const

Get the value of the property propertyName.

If the propertyName isn't known then the returned QVariant is invalid.

See Also

See also setProperty()

bool QProtobufMessage::setProperty(QAnyStringView propertyName, const QVariant &value)

Set the property propertyName to the value stored in value.

If the propertyName isn't a part of the known fields then the value will not be written and the function returns false.

Returns false if it failed to store the value on the property. Otherwise true.

See Also

See also property()

Related Non-Members

 

[alias] QProtobufMessagePointer

Synonym for std::unique_ptr<QProtobufMessage, QProtobufMessageDeleter>. Use this to manage the lifetime of dynamically allocated QProtobufMessages, such as those created by calling QProtobufMessage::constructByName.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+