File: book.cpp

package info (click to toggle)
kirigami-addons 1.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,324 kB
  • sloc: ansic: 31,525; cpp: 3,607; xml: 82; java: 76; makefile: 4; sh: 1
file content (67 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright 2024 Evgeny Chesnokov <echesnokov@astralinux.ru>
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

#include "book.h"

Book::Book(const QString &title, const QString &author, int year, double rating, QObject *parent)
    : QObject(parent)
    , m_title(title)
    , m_author(author)
    , m_year(year)
    , m_rating(rating)
{
}

QString Book::title() const
{
    return m_title;
}

void Book::setTitle(const QString &title)
{
    if (m_title != title) {
        m_title = title;
        Q_EMIT titleChanged();
    }
}

QString Book::author() const
{
    return m_author;
}

void Book::setAuthor(const QString &author)
{
    if (m_author != author) {
        m_author = author;
        Q_EMIT authorChanged();
    }
}

int Book::year() const
{
    return m_year;
}

void Book::setYear(int year)
{
    if (m_year != year) {
        m_year = year;
        Q_EMIT yearChanged();
    }
}

double Book::rating() const
{
    return m_rating;
}

void Book::setRating(double rating)
{
    if (m_rating != rating) {
        m_rating = rating;
        Q_EMIT ratingChanged();
    }
}