QGrpcChannelOptions Class | Qt GRPC | Qt 6.10.2
Description: The QGrpcChannelOptions class offers various options for fine-tuning a gRPC channel.

- Qt 6.10
- Qt GRPC
- C++ Classes
- QGrpcChannelOptions
- Qt 6.10.2 Reference Documentation

# QGrpcChannelOptions Class

The QGrpcChannelOptions class offers various options for fine-tuning a gRPC channel. More...

Header: | `#include <QGrpcChannelOptions>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Grpc)` `target_link_libraries(mytarget PRIVATE Qt6::Grpc)`
Since: | Qt 6.6
In QML: | GrpcChannelOptions

- List of all members, including inherited members

## Public Functions

| QGrpcChannelOptions(QGrpcChannelOptions &&other)
| ~QGrpcChannelOptions()
`(since 6.8)` void | swap(QGrpcChannelOptions &other)
QGrpcChannelOptions & | operator=(QGrpcChannelOptions &&other)

## Detailed Description

QGrpcChannelOptions lets you customize a gRPC™ channel. Some options apply to all remote procedure calls (RPCs) that operate on the associated channel, which is used to communicate with services.

Override options for specific RPCs with QGrpcCallOptions.

     QGrpcChannelOptions channelOpts;
     // Apply common metadata to every RPC
     channelOpts.setMetadata({
         { "header" , "value1" },
         { "header" , "value2" },
     });
     const auto &md = channelOpts.metadata(QtGrpc::MultiValue);
     qDebug() << "Channel Metadata: " << md;

     // Apply a 2-second deadline to every RPC
     channelOpts.setDeadlineTimeout(2s);
     qDebug() << "Channel timeout: " << channelOpts.deadlineTimeout();

     // Configure SSL/TLS configuration
     channelOpts.setSslConfiguration(QSslConfiguration());

Note: It is up to the channel's implementation to determine the specifics of these options.

## Member Function Documentation

### `[constexpr noexcept]` QGrpcChannelOptions::QGrpcChannelOptions(QGrpcChannelOptions &&other)

Move-constructs a new QGrpcChannelOptions from other.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

### `[noexcept]` QGrpcChannelOptions::~QGrpcChannelOptions()

Destroys the QGrpcChannelOptions.

### `[noexcept, since 6.8]` void QGrpcChannelOptions::swap(QGrpcChannelOptions &other)

Swaps other with this object. This operation is very fast and never fails.

This function was introduced in Qt 6.8.

### `[default]` QGrpcChannelOptions &QGrpcChannelOptions::operator=(QGrpcChannelOptions &&other)

Move-assigns other to this QGrpcChannelOptions and returns a reference to the updated object.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.