KAboutPerson Class

Header: #include <KAboutData>
CMake: find_package(KF6 REQUIRED COMPONENTS CoreAddons)
target_link_libraries(mytarget PRIVATE KF6::CoreAddons)

Public Functions

KAboutPerson(const QString &name = QString(), const QString &task = QString(), const QString &emailAddress = QString(), const QString &webAddress = QString(), const QUrl &avatarUrl = QUrl())
KAboutPerson(const KAboutPerson &other)
(since 6.0) QUrl avatarUrl() const
QString emailAddress() const
QString name() const
QString task() const
QString webAddress() const
KAboutPerson &operator=(const KAboutPerson &other)

Static Public Members

(since 5.18) KAboutPerson fromJSON(const QJsonObject &obj)

Detailed Description

This class is used to store information about a person or developer. It can store the person's name, a task, an email address and a link to a home page. This class is intended for use in the KAboutData class, but it can be used elsewhere as well. Normally you should at least define the person's name. Creating a KAboutPerson object by yourself is relatively useless, but the KAboutData methods KAboutData::authors() and KAboutData::credits() return lists of KAboutPerson data objects which you can examine.

Example usage within a main(), retrieving the list of people involved with a program and re-using data from one of them:

KAboutData about("khello", i18n("KHello"), "0.1",
                  i18n("A KDE version of Hello, world!"),
                  KAboutLicense::LGPL,
                  i18n("Copyright (C) 2014 Developer"));

about.addAuthor(i18n("Joe Developer"), i18n("developer"), "joe@host.com", 0);
QList<KAboutPerson> people = about.authors();
about.addCredit(people[0].name(), people[0].task());

Member Function Documentation

[explicit] KAboutPerson::KAboutPerson(const QString &name = QString(), const QString &task = QString(), const QString &emailAddress = QString(), const QString &webAddress = QString(), const QUrl &avatarUrl = QUrl())

Convenience constructor

name The name of the person.

task The task of this person.

emailAddress The email address of the person.

webAddress Home page of the person.

avatarUrl URL to the avatar of the person, since 6.0

name default argument, since 5.53

KAboutPerson::KAboutPerson(const KAboutPerson &other)

Copy constructor. Performs a deep copy.

other object to copy

[since 6.0] QUrl KAboutPerson::avatarUrl() const

Returns an URL pointing to the user's avatar

Note: Getter function for property avatarUrl.

This function was introduced in 6.0.

QString KAboutPerson::emailAddress() const

The person's email address Returns the person's email address (can be QString(), if it has been constructed with an empty email)

Note: Getter function for property emailAddress.

[static, since 5.18] KAboutPerson KAboutPerson::fromJSON(const QJsonObject &obj)

Creates a KAboutPerson from a JSON object with the following structure:

KeyAccessor
Namename()
EMailemailAddress()
Tasktask()
WebsitewebAddress()
AvatarUrlavatarUrl()

The Name and Task key are translatable (by using e.g. a "Task[de_DE]" key) The AvatarUrl exists since version 6.0

This function was introduced in 5.18.

QString KAboutPerson::name() const

The person's name Returns the person's name (can be QString(), if it has been constructed with an empty name)

Note: Getter function for property name.

QString KAboutPerson::task() const

The person's task Returns the person's task (can be QString(), if it has been constructed with an empty task)

Note: Getter function for property task.

QString KAboutPerson::webAddress() const

The home page or a relevant link Returns the persons home page (can be QString(), if it has been constructed with an empty home page)

Note: Getter function for property webAddress.

KAboutPerson &KAboutPerson::operator=(const KAboutPerson &other)

Assignment operator. Performs a deep copy.

other object to copy