QPlaceIcon Class

The QPlaceIcon class represents an icon. 更多...

头: #include <QPlaceIcon>
qmake: QT += location

公共函数

QPlaceIcon ()
QPlaceIcon (const QPlaceIcon & other )
~QPlaceIcon ()
bool isEmpty () const
QPlaceManager * manager () const
QVariantMap 参数 () const
void setManager (QPlaceManager * manager )
void setParameters (const QVariantMap & 参数 )
QUrl url (const QSize & size = QSize()) const
QPlaceIcon & operator= (const QPlaceIcon & other )

静态公共成员

const QString SingleUrl
bool operator!= (const QPlaceIcon & lhs , const QPlaceIcon & rhs )
bool operator== (const QPlaceIcon & lhs , const QPlaceIcon & rhs )

详细描述

The typical usage of an icon is to use the url () function to specify a preferred icon size.

QUrl iconSourceUrl = place.icon().url(QSize(32,32));
//A default icon may also be requested like so
iconSourceUrl = place.icon().url();
					

The icons are typically backend dependent, if a manager backend does not support a given size, the URL of the icon that most closely matches those parameters is returned.

The icon class also has a key-value set of parameters. The precise key one needs to use depends on the plugin being used. These parameters influence which icon URL is returned by the manager and may also be used to specify icon URL locations when saving icons.

If there is only ever one image for an icon, then QPlaceIcon::SingleUrl can be used as a parameter key with a QUrl as the associated value. If this key is set, then the url () function will always return the specified URL and not defer to any manager.

成员函数文档编制

QPlaceIcon:: QPlaceIcon ()

Constructs an icon.

[noexcept] QPlaceIcon:: QPlaceIcon (const QPlaceIcon & other )

构造副本为 other .

[noexcept] QPlaceIcon:: ~QPlaceIcon ()

销毁图标。

bool QPlaceIcon:: isEmpty () const

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

QPlaceManager *QPlaceIcon:: manager () const

Returns the manager that this icon is associated with.

注意: Getter function for property manager.

另请参阅 setManager ().

QVariantMap QPlaceIcon:: 参数 () const

Returns a set of parameters for the icon that are manager/plugin specific. These parameters are used by the manager to return the appropriate URL when url () is called and to specify locations to save to when saving icons.

Consult the plugin documentation for what parameters are supported and how they should be used.

注意: Getter function for property parameters.

另请参阅 setParameters ().

void QPlaceIcon:: setManager ( QPlaceManager * manager )

设置 manager that this icon is associated with. The icon does not take ownership of the pointer.

注意: setter 函数对于特性 manager .

另请参阅 manager ().

void QPlaceIcon:: setParameters (const QVariantMap & 参数 )

Sets the parameters of the icon to 参数 .

注意: setter 函数对于特性 参数 .

另请参阅 参数 ().

[invokable] QUrl QPlaceIcon:: url (const QSize & size = QSize()) const

Returns an icon URL according to the given size .

If no manager has been assigned to the icon, and the parameters do not contain the QPlaceIcon::SingleUrl key, a default constructed QUrl 被返回。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[noexcept] QPlaceIcon &QPlaceIcon:: operator= (const QPlaceIcon & other )

赋值 other to this icon and returns a reference to this icon.

成员变量文档编制

const QString QPlaceIcon:: SingleUrl

Parameter key for an icon that only has a single image URL.

The parameter value to be used with this key is a QUrl . An icon with this parameter set will always return the specified URL regardless of the requested size when url () 被调用。

相关非成员

[noexcept] bool operator!= (const QPlaceIcon & lhs , const QPlaceIcon & rhs )

返回 true 若 lhs 不等于 rhs ,否则返回 false。

[noexcept] bool operator== (const QPlaceIcon & lhs , const QPlaceIcon & rhs )

返回 true 若 lhs 等于 rhs ,否则返回 false。