Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qplaceuser.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qplaceuser.h"
5#include "qplaceuser_p.h"
6
7QT_USE_NAMESPACE
8
9QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceUserPrivate)
10
11bool QPlaceUserPrivate::operator==(const QPlaceUserPrivate &other) const
12{
13 return userId == other.userId && name == other.name;
14}
15
16/*!
17 \class QPlaceUser
18 \inmodule QtLocation
19 \ingroup QtLocation-places
20 \ingroup QtLocation-places-data
21 \since 5.6
22
23 \brief The QPlaceUser class represents an individual user.
24*/
25
26/*!
27 \qmlvaluetype user
28 \inqmlmodule QtLocation
29 \ingroup qml-QtLocation5-places
30 \ingroup qml-QtLocation5-places-data
31 \since QtLocation 5.5
32
33 \brief The user type identifies a user who contributed a particular \l Place content item.
34
35 Each \l Place content item has an associated user who contributed the content. This type
36 provides information about that user.
37
38 \section1 Example
39
40 The following example shows how to display information about the user who
41 submitted an editorial:
42
43 \snippet declarative/places.qml QtQuick import
44 \snippet declarative/maps.qml QtLocation import
45 \codeline
46 \snippet declarative/places.qml EditorialModel
47
48 \sa ImageModel, ReviewModel, EditorialModel
49*/
50
51/*!
52 Constructs a new user object.
53*/
54QPlaceUser::QPlaceUser()
55 : d(new QPlaceUserPrivate)
56{
57}
58
59/*!
60 Constructs a copy of \a other.
61*/
62QPlaceUser::QPlaceUser(const QPlaceUser &other) noexcept = default;
63
64/*!
65 Destroys the user object.
66*/
67QPlaceUser::~QPlaceUser() = default;
68
69/*!
70 Assigns \a other to this user and returns a reference to this user.
71*/
72QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other) noexcept
73{
74 if (this == &other)
75 return *this;
76
77 d = other.d;
78 return *this;
79}
80
81/*!
82 \fn bool QPlaceUser::operator==(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
83
84 Returns true if \a lhs is equal to \a rhs, otherwise returns false.
85*/
86
87/*!
88 \fn bool QPlaceUser::operator!=(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
89
90 Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
91*/
92
93bool QPlaceUser::isEqual(const QPlaceUser &other) const noexcept
94{
95 return (*d) == *(other.d);
96}
97
98/*!
99 \qmlproperty string QtLocation::user::userId
100
101 This property holds the unique identifier of the user.
102*/
103
104/*!
105 \property QPlaceUser::userId
106 \brief the identifier of the user.
107*/
108QString QPlaceUser::userId() const
109{
110 return d->userId;
111}
112
113void QPlaceUser::setUserId(const QString &identifier)
114{
115 d->userId = identifier;
116}
117
118/*!
119 \qmlproperty string QtLocation::user::name
120
121 This property holds the name of a user.
122*/
123
124/*!
125 \property QPlaceUser::name
126 \brief the name of the user.
127*/
128QString QPlaceUser::name() const
129{
130 return d->name;
131}
132
133void QPlaceUser::setName(const QString &name)
134{
135 d->name = name;
136}
137
138#include "moc_qplaceuser.cpp"