示例#1
0
void tst_QPlaceImage::supplierTest()
{
    QPlaceImage testObj;
    QVERIFY2(testObj.supplier().supplierId() == QString(), "Wrong default value");
    QPlaceSupplier sup;
    sup.setName("testName1");
    sup.setSupplierId("testId");
    testObj.setSupplier(sup);
    QVERIFY2(testObj.supplier() == sup, "Wrong value returned");
}
示例#2
0
QPlaceImage tst_QPlaceImage::initialSubObject()
{
    QPlaceUser user;
    user.setName("user 1");
    user.setUserId("0001");

    QPlaceSupplier supplier;
    supplier.setName("supplier");
    supplier.setSupplierId("1");

    QPlaceImage image;
    image.setUrl(QUrl(QStringLiteral("file:///opt/icon/img.png")));
    image.setImageId("0001");
    image.setMimeType("image/png");
    image.setUser(user);
    image.setSupplier(supplier);
    image.setAttribution("attribution");

    return image;
}
QPlaceEditorial tst_QPlaceEditorial::initialSubObject()
{
    QPlaceUser user;
    user.setName("user 1");
    user.setUserId("0001");

    QPlaceSupplier supplier;
    supplier.setName("supplier");
    supplier.setSupplierId("1");

    QPlaceEditorial editorial;
    editorial.setTitle("title");
    editorial.setText("text");
    editorial.setLanguage("en");
    editorial.setUser(user);
    editorial.setSupplier(supplier);
    editorial.setAttribution("attribution");

    return editorial;
}
/*!
    \qmlproperty QPlaceSupplier Supplier::supplier

    For details on how to use this property to interface between C++ and QML see
    "\l {location-cpp-qml.html#placesupplier} {Interfaces between C++ and QML Code}".
*/
void QDeclarativeSupplier::setSupplier(const QPlaceSupplier &src, QDeclarativeGeoServiceProvider *plugin)
{
    QPlaceSupplier previous = m_src;
    m_src = src;

   if (previous.name() != m_src.name())
        emit nameChanged();

    if (previous.supplierId() != m_src.supplierId())
        emit supplierIdChanged();

    if (previous.url() != m_src.url())
        emit urlChanged();

    if (m_icon && m_icon->parent() == this) {
        m_icon->setPlugin(plugin);
        m_icon->setIcon(m_src.icon());
    } else if (!m_icon || m_icon->parent() != this) {
        m_icon = new QDeclarativePlaceIcon(m_src.icon(), plugin, this);
        emit iconChanged();
    }
}