summaryrefslogtreecommitdiff
path: root/src/imports/location/declarativeplaces/qdeclarativecategory.cpp
blob: 3de347a66cbc57e43b1da6f3b22ca6c59f2e5706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "qdeclarativecategory_p.h"

QT_USE_NAMESPACE

/*!
    \qmlclass Category

    \brief The Category element holds various positional data, such as \l
    latitude and \l longitude and.
    \inherits QObject

    \ingroup qml-places
*/

QDeclarativeCategory::QDeclarativeCategory(QObject* parent)
        : QObject(parent) {}

QDeclarativeCategory::QDeclarativeCategory(const QPlaceCategory &category,
        QObject *parent)
        : QObject(parent),
        m_category(category)
{
}

QDeclarativeCategory::~QDeclarativeCategory() {}

void QDeclarativeCategory::setCategory(const QPlaceCategory &category)
{
    QPlaceCategory previous = m_category;
    m_category = category;

    if (category.name() != previous.name()) {
        emit nameChanged();
    }
    if (category.categoryId() != previous.categoryId()) {
        emit categoryIdChanged();
    }
    if (category.description() != previous.description()) {
        emit descriptionChanged();
    }
}

QPlaceCategory QDeclarativeCategory::category()
{
    return m_category;
}

/*!
    \qmlproperty string Category::categoryId

    This property holds the id of the category
*/

void QDeclarativeCategory::setCategoryId(const QString &id)
{
    if (m_category.categoryId() != id) {
        m_category.setCategoryId(id);
        emit categoryIdChanged();
    }
}

QString QDeclarativeCategory::categoryId() const
{
    return m_category.categoryId();
}

/*!
    \qmlproperty string Category::description

    This property holds the description of the category
*/

void QDeclarativeCategory::setDescription(const QString &description)
{
    if (m_category.description() != description) {
        m_category.setDescription(description);
        emit descriptionChanged();
    }
}

QString QDeclarativeCategory::description() const
{
    return m_category.description();
}

/*!
    \qmlproperty string Category::name

    This property holds name of the category
*/

void QDeclarativeCategory::setName(const QString &name)
{
    if (m_category.name() != name) {
        m_category.setName(name);
        emit nameChanged();
    }
}

QString QDeclarativeCategory::name() const
{
    return m_category.name();
}