- Qt 6.9
- Qt Location
- C++ Classes
- QPlaceAttribute
- Qt 6.9.2 Reference Documentation

# QPlaceAttribute Class

The QPlaceAttribute class represents generic attribute information about a place. More...

Header: | `#include <QPlaceAttribute>`
qmake: | `QT += location`

- List of all members, including inherited members

## Properties

- label : QString
- text : QString

## Public Functions

| QPlaceAttribute()
| QPlaceAttribute(const QPlaceAttribute &other)
| ~QPlaceAttribute()
bool | isEmpty() const
QString | label() const
void | setLabel(const QString &label)
void | setText(const QString &text)
QString | text() const
QPlaceAttribute & | operator=(const QPlaceAttribute &other)

## Static Public Members

const QString | OpeningHours
const QString | Payment
const QString | Provider

## Related Non-Members

bool | operator!=(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs)
bool | operator==(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs)

## Detailed Description

A QPlaceAttribute instance stores an additional piece of information about a place that is not otherwise exposed through the QPlace class. A QPlaceAttribute encapsulates a localized label which describes the attribute and rich text string representing the attribute's value. Generally, both are intended to be displayed to the end-user as is.

Some plugins may not support attributes at all, others may only support a certain set, others still may support a dynamically changing set of attributes over time or even allow attributes to be arbitrarily defined by the client application. The attributes could also vary on a place by place basis, for example one place may have opening hours while another does not. Consult the plugin references for details.

#### Attribute Types

The QPlaceAttribute class defines some constant strings which characterize standard attribute types.

- QPlaceAttribute::OpeningHours
- QPlaceAttribute::Payment
- QPlaceAttribute::Provider

There is a class of attribute types of the format x_id_<provider> for example x_id_here. This class of attributes is a set of alternative identifiers of the place, from the specified provider's perspective.

The above types are used to access and modify attributes in QPlace via:

- QPlace::extendedAttribute()
- QPlace::setExtendedAttribute()
- QPlace::removeExtendedAttribute()
- QPlace::removeExtendedAttribute()

The attribute type is a string type so that providers are able to introduce new attributes as necessary. Custom attribute types should always be prefixed by a qualifier in order to avoid conflicts.

##### User Readable and Non-User Readable Attributes

Some attributes may not be intended to be readable by end users, the label field of such attributes are empty to indicate this fact.

## Property Documentation

### label : QString

This property holds a localized label describing the attribute.

Access functions:

QString | label() const
void | setLabel(const QString &label)

### text : QString

This property holds a piece of rich text representing the attribute value.

Access functions:

QString | text() const
void | setText(const QString &text)

## Member Function Documentation

### QPlaceAttribute::QPlaceAttribute()

Constructs an attribute.

### `[noexcept]` QPlaceAttribute::QPlaceAttribute(const QPlaceAttribute &other)

Creates a copy of other.

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

Destroys the attribute.

### bool QPlaceAttribute::isEmpty() const

Returns a boolean indicating whether the all the fields of the place attribute are empty or not.

### `[noexcept]` QPlaceAttribute &QPlaceAttribute::operator=(const QPlaceAttribute &other)

Assigns other to this attribute and returns a reference to this attribute.

## Member Variable Documentation

### const QString QPlaceAttribute::OpeningHours

Specifies the opening hours.

### const QString QPlaceAttribute::Payment

The constant to specify an attribute that defines the methods of payment.

### const QString QPlaceAttribute::Provider

The constant to specify an attribute that defines which provider the place came from.

## Related Non-Members

### `[noexcept]` bool operator!=(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs)

Returns true if lhs is not equal to rhs, otherwise returns false.

### `[noexcept]` bool operator==(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs)

Returns true if lhs is equal to rhs, otherwise returns false.