当前位置: 首页>>代码示例>>C++>>正文


C++ DataProvider::add方法代码示例

本文整理汇总了C++中DataProvider::add方法的典型用法代码示例。如果您正苦于以下问题:C++ DataProvider::add方法的具体用法?C++ DataProvider::add怎么用?C++ DataProvider::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataProvider的用法示例。


在下文中一共展示了DataProvider::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QObject

//! [0]
MapViewDemo::MapViewDemo(bb::cascades::Application *app)
    : QObject(app)
{
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("_mapViewTest", this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    QObject* mapViewAsQObject = root->findChild<QObject*>(QString("mapViewObj"));
    if (mapViewAsQObject) {
        mapView = qobject_cast<bb::cascades::maps::MapView*>(mapViewAsQObject);
        mapView->setCaptionGoButtonVisible(true);
        if (mapView) {
            // creating a data provider just for the device location object. that way, when the clear function is call, this object is not removed.
            DataProvider* deviceLocDataProv = new DataProvider("device-location-data-provider");
            mapView->mapData()->addProvider(deviceLocDataProv);

            // create a geolocation just for the device's location
            deviceLocation = new GeoLocation("device-location-id");
            deviceLocation->setName("Current Device Location");
            deviceLocation->setDescription("<html><a href=\"http://www.blackberry.com\">Hyperlinks</a> are super useful in bubbles.</html>");

            // for that location, replace the standard default pin with the provided bulls eye asset
            Marker bullseye = Marker(UIToolkitSupport::absolutePathFromUrl(
                                QUrl("asset:///images/me.png")), QSize(60, 60),
                                QPoint(29, 29), QPoint(29, 1));
            deviceLocation->setMarker(bullseye);

            deviceLocDataProv->add(deviceLocation);
        }
    }

    // set created root object as a scene
    app->setScene(root);
}
开发者ID:AlessioCampanelli,项目名称:Cascades-Samples,代码行数:39,代码来源:MapViewDemo.cpp


注:本文中的DataProvider::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。