Icon QML Type

The Icon type represents an icon image source which can have multiple sizes. 更多...

import 语句: import QtLocation 5.3
Since: Qt Location 5.5

特性

方法

详细描述

The Icon type can be used in conjunction with an Image type to display an icon. The url() function is used to construct an icon URL of a requested size, the icon which most closely matches the requested size is returned.

The Icon type also has a parameters map which is a set of key value pairs. The precise keys to use depend on the plugin being used. The parameters map is used by the Plugin to determine which URL to return.

In the case where an icon can only possibly have one image URL, the parameter key of "singleUrl" can be used with a QUrl value. Any Icon with this parameter will always return the specified URL regardless of the requested icon size and not defer to any Plugin.

The following code shows how to display a 64x64 pixel icon:

import QtQuick 2.0
import QtPositioning 5.5
import QtLocation 5.6
Image {
    source: icon.url(Qt.size(64, 64))
}
					

Alternatively, a default sized icon can be specified like so:

    source: icon.url()
					

特性文档编制

icon : QPlaceIcon

For details on how to use this property to interface between C++ and QML see " Interfaces between C++ and QML Code ".

参数 : 对象

This property holds the parameters of the icon and is a map. These parameters are used by the plugin 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.

Note, due to limitations of the QQmlPropertyMap , it is not possible to declaratively specify the parameters in QML, assignment of parameters keys and values can only be accomplished by JavaScript.

plugin : Plugin

The property holds the plugin that is responsible for managing this icon.


方法文档编制

url url ( size size )

Returns a URL for the icon image that most closely matches the given size .

If no plugin has been assigned to the icon, and the parameters do not contain the 'singleUrl' key, a default constructed URL is returned.