QPlaceRatings Class

The QPlaceRatings class holds rating information about a place. More...

Header: #include <QPlaceRatings>
qmake: QT += location
Since: Qt 5.6

This class was introduced in Qt 5.6.

Public Functions

QPlaceRatings(const QPlaceRatings &other)
QPlaceRatings()
QPlaceRatings & operator=(const QPlaceRatings &other)
~QPlaceRatings()
qreal average() const
int count() const
bool isEmpty() const
qreal maximum() const
void setAverage(qreal average)
void setCount(int count)
void setMaximum(qreal max)
bool operator!=(const QPlaceRatings &other) const
bool operator==(const QPlaceRatings &other) const

Detailed Description

Rating information is used to describe how good a place is conceived to be. Typically this information is visualized as a number of stars. The average() function returns an aggregated ratings value out of a possible maximum as given by the maximum() function.

qDebug() << QString("This place rated ") + place.ratings().average()
            + "out of " + place.ratings().maximum() + "stars";

Member Function Documentation

QPlaceRatings::QPlaceRatings(const QPlaceRatings &other)

Constructs a copy of other.

QPlaceRatings::QPlaceRatings()

Constructs a new ratings object.

QPlaceRatings &QPlaceRatings::operator=(const QPlaceRatings &other)

Assigns other to this ratings object and returns a reference to this ratings object.

QPlaceRatings::~QPlaceRatings()

Destroys the ratings object.

qreal QPlaceRatings::average() const

Returns the average value of individual ratings.

See also setAverage().

int QPlaceRatings::count() const

Returns the total number of individual ratings.

See also setCount().

bool QPlaceRatings::isEmpty() const

Returns true if all fields of the place ratings are 0; otherwise returns false.

qreal QPlaceRatings::maximum() const

Returns the maximum possible rating value.

See also setMaximum().

void QPlaceRatings::setAverage(qreal average)

Sets the average value of the ratings.

See also average().

void QPlaceRatings::setCount(int count)

Sets the total number of individual ratings to count.

See also count().

void QPlaceRatings::setMaximum(qreal max)

Sets the maximum possible rating value to max.

See also maximum().

bool QPlaceRatings::operator!=(const QPlaceRatings &other) const

Returns true if other is not equal to this ratings object, otherwise returns false.

bool QPlaceRatings::operator==(const QPlaceRatings &other) const

Returns true if other is equal to this ratings object, otherwise returns false.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.14/qplaceratings.html