コード例 #1
0
void PlaceInformationDialog::accept()
{
    bool create = false;

    if(!m_place) {
        m_place = Qp::create<Place>();
        create = true;
    }

    m_place->setCity(ui->lineEditTown->text());
    m_place->setPostalCode(ui->lineEditPLZ->text().toInt());
    m_place->setStreet(ui->lineEditStreet->text());
    m_place->setHouseNumber(ui->lineEditNumber->text().toInt());
    m_place->setCityEmblem(ui->imageWellIcon->pixmap());

    Qp::update(m_place);


    if(create)
        emit placeAdded(m_place);

    QDialog::accept();
}
コード例 #2
0
ファイル: qplacemanager.cpp プロジェクト: MarianMMX/MarianMMX
QT_BEGIN_NAMESPACE

/*!
    \class QPlaceManager
    \inmodule QtLocation
    \ingroup QtLocation-places
    \ingroup QtLocation-places-manager
    \since 5.5

    \brief The QPlaceManager class provides the interface which allows clients to access
    places stored in a particular backend.

    The following table gives an overview of the functionality provided by the QPlaceManager
    \table
        \header
            \li Functionality
            \li Description
        \row
            \li Searching for places
            \li Using set of parameters such as a search term and search area, relevant places
               can be returned to the user.
        \row
            \li Categories
            \li Places can be classified as belonging to different categories.  The
               manager supports access to these categories.
        \row
            \li Search term suggestions
            \li Given a partially complete search term, a list of potential
               search terms can be given.
        \row
            \li Recommendations
            \li Given an existing place, a set of similar recommended places can
               be suggested to the user.
        \row
            \li Rich Content
            \li Rich content such as images, reviews etc can be retrieved in a paged
               fashion.
        \row
            \li Place or Category management
            \li Places and categories may be saved and removed.  It is possible
               for notifications to be given when this happens.
        \row
            \li Localization
            \li Different locales may be specified to return place
               data in different languages.
    \endtable

    \section1 Obtaining a QPlaceManager Instance
    Creation of a QPlaceManager is facilitated by the QGeoServiceProvider.
    See \l {Initializing a manager} for an example on how to create a manager.


    \section1 Asynchronous Interface
    The QPlaceManager class provides an abstraction of the datastore which contains place information.
    The functions provided by the QPlaceManager and primarily asynchronous and follow
    a request-reply model.   Typically a request is given to the manager, consisting
    of a various set of parameters and a reply object is created.  The reply object
    has a signal to notify when the request is done, and once completed, the reply
    contains the results of the request, along with any errors that occurred, if any.

    An asynchronous request is generally handled as follows:
    \snippet places/requesthandler.h Simple search
    \dots
    \dots
    \snippet places/requesthandler.h Simple search handler

    See \l {Common Operations} for a list of examples demonstrating how the QPlaceManger
    is used.

    \section1 Category Initialization
    Sometime during startup of an application, the initializeCategories() function should
    be called to setup the categories.  Initializing the categories enables the usage of the
    following functions:

    \list
        \li QPlaceManager::childCategories()
        \li QPlaceManager::category()
        \li QPlaceManager::parentCategoryId()
        \li QPlaceManager::childCategoryIds();
    \endlist

    If the categories need to be refreshed or reloaded, the initializeCategories() function
    may be called again.

*/

/*!
    Constructs a new manager with the specified \a parent and with the
    implementation provided by \a engine.

    This constructor is used internally by QGeoServiceProviderFactory. Regular
    users should acquire instances of QGeoRoutingManager with
    QGeoServiceProvider::routingManager();
*/
QPlaceManager::QPlaceManager(QPlaceManagerEngine *engine, QObject *parent)
    : QObject(parent), d(engine)
{
    if (d) {
        d->setParent(this);
        d->d_ptr->manager = this;

        qRegisterMetaType<QPlaceCategory>();

        connect(d, SIGNAL(finished(QPlaceReply*)), this, SIGNAL(finished(QPlaceReply*)));
        connect(d, SIGNAL(error(QPlaceReply*,QPlaceReply::Error)),
                this, SIGNAL(error(QPlaceReply*,QPlaceReply::Error)));

        connect(d, SIGNAL(placeAdded(QString)),
                this, SIGNAL(placeAdded(QString)), Qt::QueuedConnection);
        connect(d, SIGNAL(placeUpdated(QString)),
                this, SIGNAL(placeUpdated(QString)), Qt::QueuedConnection);
        connect(d, SIGNAL(placeRemoved(QString)),
                this, SIGNAL(placeRemoved(QString)), Qt::QueuedConnection);

        connect(d, SIGNAL(categoryAdded(QPlaceCategory,QString)),
                this, SIGNAL(categoryAdded(QPlaceCategory,QString)));
        connect(d, SIGNAL(categoryUpdated(QPlaceCategory,QString)),
                this, SIGNAL(categoryUpdated(QPlaceCategory,QString)));
        connect(d, SIGNAL(categoryRemoved(QString,QString)),
                this, SIGNAL(categoryRemoved(QString,QString)));
        connect(d, SIGNAL(dataChanged()),
                this, SIGNAL(dataChanged()), Qt::QueuedConnection);
    } else {