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