Base class for all protobuf messages. 更多...
头: | #include <QProtobufMessage> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf) |
Since: | Qt 6.5 |
继承者: | |
状态: | 技术预览 |
QVariant | property (QAnyStringView propertyName ) const |
bool | setProperty (QAnyStringView propertyName , const QVariant & value ) |
(从 6.6 起)
bool
|
setProperty (QAnyStringView propertyName , QVariant && value ) |
(从 6.7 起)
QList<QByteArray>
|
unknownFieldData (qint32 field ) const |
(从 6.7 起)
QList<qint32>
|
unknownFieldNumbers () const |
QProtobufMessagePointer | constructByName (const QString & messageType ) |
QProtobufMessagePointer |
Provides access to the properties of a message, using setProperty () 和 property (), without depending on what the message is.
[static]
QProtobufMessagePointer
QProtobufMessage::
constructByName
(const
QString
&
messageType
)
Constructs QProtobufMessage 使用 messageType . Returns a pointer to the constructed QProtobufMessage .
This function attempts to create a message whose type matches
messageType
。若
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.
Get the value of the property propertyName .
若 propertyName isn't known then the returned QVariant 无效。
另请参阅 setProperty ().
Set the property propertyName to the value stored in value .
若
propertyName
isn't a part of the known fields then the value will not be written and the function returns
false
.
返回
false
if it failed to store the
value
on the property. Otherwise
true
.
另请参阅 property ().
[since 6.6]
bool
QProtobufMessage::
setProperty
(
QAnyStringView
propertyName
,
QVariant
&&
value
)
这是重载函数。
该函数在 Qt 6.6 引入。
[since 6.7]
QList
<
QByteArray
> QProtobufMessage::
unknownFieldData
(
qint32
field
) const
Returns the unknown field values sorted as they were received from the wire.
该函数在 Qt 6.7 引入。
[since 6.7]
QList
<
qint32
> QProtobufMessage::
unknownFieldNumbers
() const
Returns the field numbers that were not known to QtProtobuf during deserialization.
该函数在 Qt 6.7 引入。
[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 .