Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPlaceAttribute Class Reference

\inmodule QtLocation More...

#include <qplaceattribute.h>

+ Collaboration diagram for QPlaceAttribute:

Public Member Functions

 QPlaceAttribute ()
 Constructs an attribute.
 
 QPlaceAttribute (const QPlaceAttribute &other) noexcept
 Creates a copy of other.
 
 QPlaceAttribute (QPlaceAttribute &&other) noexcept=default
 
 ~QPlaceAttribute ()
 Destroys the attribute.
 
QPlaceAttributeoperator= (const QPlaceAttribute &other) noexcept
 Assigns other to this attribute and returns a reference to this attribute.
 
void swap (QPlaceAttribute &other) noexcept
 
QString label () const
 
void setLabel (const QString &label)
 
QString text () const
 
void setText (const QString &text)
 
bool isEmpty () const
 Returns a boolean indicating whether the all the fields of the place attribute are empty or not.
 

Static Public Attributes

static const QString OpeningHours
 \qmltype ExtendedAttributes \instantiates QQmlPropertyMap \inqmlmodule QtLocation
 
static const QString Payment
 \variable QPlaceAttribute::Payment The constant to specify an attribute that defines the methods of payment.
 
static const QString Provider
 \variable QPlaceAttribute::Provider The constant to specify an attribute that defines which provider the place came from.
 

Properties

QML_STRUCTURED_VALUEQString label
 \qmlproperty string placeAttribute::label
 
QString text
 \qmlproperty string placeAttribute::text
 

Friends

bool operator== (const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
 Returns true if lhs is equal to rhs, otherwise returns false.
 
bool operator!= (const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
 Returns true if lhs is not equal to rhs, otherwise returns false.
 

Detailed Description

\inmodule QtLocation

Since
5.6

The QPlaceAttribute class represents generic attribute information about a place.

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 \l {Plugin References and Parameters}{plugin references} for details.

Definition at line 19 of file qplaceattribute.h.

Constructor & Destructor Documentation

◆ QPlaceAttribute() [1/3]

QPlaceAttribute::QPlaceAttribute ( )

Constructs an attribute.

Definition at line 204 of file qplaceattribute.cpp.

◆ QPlaceAttribute() [2/3]

QPlaceAttribute::QPlaceAttribute ( const QPlaceAttribute & other)
defaultnoexcept

Creates a copy of other.

◆ QPlaceAttribute() [3/3]

QPlaceAttribute::QPlaceAttribute ( QPlaceAttribute && other)
defaultnoexcept

◆ ~QPlaceAttribute()

QPlaceAttribute::~QPlaceAttribute ( )
default

Destroys the attribute.

Member Function Documentation

◆ isEmpty()

bool QPlaceAttribute::isEmpty ( ) const

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

Definition at line 298 of file qplaceattribute.cpp.

References QPlaceAttributePrivate::isEmpty().

+ Here is the call graph for this function:

◆ label()

QString QPlaceAttribute::label ( ) const

Definition at line 264 of file qplaceattribute.cpp.

References QPlaceAttributePrivate::label.

◆ operator=()

QPlaceAttribute & QPlaceAttribute::operator= ( const QPlaceAttribute & other)
noexcept

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

Definition at line 223 of file qplaceattribute.cpp.

References other().

+ Here is the call graph for this function:

◆ setLabel()

void QPlaceAttribute::setLabel ( const QString & label)

Definition at line 269 of file qplaceattribute.cpp.

References label, and QPlaceAttributePrivate::label.

◆ setText()

void QPlaceAttribute::setText ( const QString & text)

Definition at line 289 of file qplaceattribute.cpp.

References text, and QPlaceAttributePrivate::text.

◆ swap()

void QPlaceAttribute::swap ( QPlaceAttribute & other)
inlinenoexcept

Definition at line 40 of file qplaceattribute.h.

References other(), and swap().

Referenced by swap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ text()

QString QPlaceAttribute::text ( ) const

Definition at line 284 of file qplaceattribute.cpp.

References QPlaceAttributePrivate::text.

Friends And Related Symbol Documentation

◆ operator!=

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

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

Definition at line 44 of file qplaceattribute.h.

◆ operator==

bool QPlaceAttribute::operator== ( const QPlaceAttribute & lhs,
const QPlaceAttribute & rhs )
friend

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

Definition at line 42 of file qplaceattribute.h.

Member Data Documentation

◆ OpeningHours

const QString QPlaceAttribute::OpeningHours
static

\qmltype ExtendedAttributes \instantiates QQmlPropertyMap \inqmlmodule QtLocation

Since
QtLocation 5.5

The ExtendedAttributes type holds additional data about a \l Place.

The ExtendedAttributes type is a map of \l {placeAttribute}{placeAttributes}. To access attributes in the map use the \l keys() method to get the list of keys stored in the map and use the {[]} operator to access the \l placeAttribute items.

The following are standard keys that are defined by the API. \l Plugin implementations are free to define additional keys. Custom keys should be qualified by a unique prefix to avoid clashes. \table \header

  • key
  • description \row
  • openingHours
  • The trading hours of the place \row
  • payment
  • The types of payment the place accepts, for example visa, mastercard. \row
  • x_provider
  • The name of the provider that a place is sourced from \row
  • x_id_<provider> (for example x_id_here)
  • An alternative identifier which identifies the place from the perspective of the specified provider. \endtable

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 \l {Plugin References and Parameters}{plugin references} for details.

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

Note
ExtendedAttributes instances are only ever used in the context of \l {Place}s. It is not possible to create an ExtendedAttributes instance directly or re-assign a \l {Place}'s ExtendedAttributes property. Modification of ExtendedAttributes can only be accomplished via Javascript.

The following example shows how to access all \l {placeAttribute}{placeAttributes} and print them to the console:

\codeline

The following example shows how to assign and modify an attribute:

See also
placeAttribute, QQmlPropertyMap

\qmlmethod variant ExtendedAttributes::keys()

Returns an array of place attribute keys currently stored in the map.

\qmlsignal void ExtendedAttributes::valueChanged(string key, variant value)

This signal is emitted when the set of attributes changes. key is the key corresponding to the value that was changed.

The corresponding handler is onValueChanged.

\qmlvaluetype placeAttribute \inqmlmodule QtLocation

Since
QtLocation 5.5

The placeAttribute type holds generic place attribute information.

A place attribute stores an additional piece of information about a \l Place that is not otherwise exposed through the \l Place type. A placeAttribute is a textual piece of data, accessible through the \l {placeAttribute::}{text} property, and a \l {placeAttribute::}{label}. Both the l {placeAttribute::}{text} and \l {placeAttribute::}{label} properties are intended to be displayed to the user. placeAttributes are stored in an \l ExtendedAttributes map with a unique key.

The following example shows how to display all attributes in a list:

\codeline

The following example shows how to assign and modify an attribute:

\variable QPlaceAttribute::OpeningHours Specifies the opening hours.

Definition at line 28 of file qplaceattribute.h.

Referenced by RequestHandler::openingHours().

◆ Payment

const QString QPlaceAttribute::Payment
static

\variable QPlaceAttribute::Payment The constant to specify an attribute that defines the methods of payment.

Definition at line 29 of file qplaceattribute.h.

◆ Provider

const QString QPlaceAttribute::Provider
static

\variable QPlaceAttribute::Provider The constant to specify an attribute that defines which provider the place came from.

Definition at line 30 of file qplaceattribute.h.

Property Documentation

◆ label

QPlaceAttribute::label
readwrite

\qmlproperty string placeAttribute::label

This property holds the attribute label which is a user visible string describing the attribute.

a localized label describing the attribute.

Definition at line 24 of file qplaceattribute.h.

Referenced by setLabel().

◆ text

QPlaceAttribute::text
readwrite

\qmlproperty string placeAttribute::text

This property holds the attribute text which can be used to show additional information about the place.

a piece of rich text representing the attribute value.

Definition at line 25 of file qplaceattribute.h.

Referenced by RequestHandler::openingHours(), and setText().


The documentation for this class was generated from the following files: