QPlaceRatings Class

The QPlaceRatings class holds rating information about a place. 更多...

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

公共函数

QPlaceRatings ()
QPlaceRatings (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
QPlaceRatings & operator= (const QPlaceRatings & other )
bool operator== (const QPlaceRatings & other ) const

详细描述

The QPlaceRatings class holds rating information about a place.

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 () 函数。

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

成员函数文档编制

QPlaceRatings:: QPlaceRatings ()

Constructs a new ratings object.

QPlaceRatings:: QPlaceRatings (const QPlaceRatings & other )

构造副本为 other .

QPlaceRatings:: ~QPlaceRatings ()

Destroys the ratings object.

qreal QPlaceRatings:: average () const

Returns the average value of individual ratings.

另请参阅 setAverage ().

int QPlaceRatings:: count () const

Returns the total number of individual ratings.

另请参阅 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.

另请参阅 setMaximum ().

void QPlaceRatings:: setAverage ( qreal average )

设置 average value of the ratings.

另请参阅 average ().

void QPlaceRatings:: setCount ( int count )

Sets the total number of individual ratings to count .

另请参阅 count ().

void QPlaceRatings:: setMaximum ( qreal max )

Sets the maximum possible rating value to max .

另请参阅 maximum ().

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

返回 true 若 other is not equal to this ratings object, otherwise returns false.

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

赋值 other to this ratings object and returns a reference to this ratings object.

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

返回 true 若 other is equal to this ratings object, otherwise returns false.