File: book.h

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 (44 lines) | stat: -rw-r--r-- 1,088 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
/*
 * Copyright 2024 Evgeny Chesnokov <echesnokov@astralinux.ru>
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

#pragma once

#include <QObject>

class Book final : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
    Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)
    Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged)
    Q_PROPERTY(double rating READ rating WRITE setRating NOTIFY ratingChanged)

public:
    explicit Book(const QString &title, const QString &author, int year, double rating, QObject *parent = nullptr);

    QString title() const;
    void setTitle(const QString &title);

    QString author() const;
    void setAuthor(const QString &author);

    int year() const;
    void setYear(int year);

    double rating() const;
    void setRating(double rating);

Q_SIGNALS:
    void titleChanged();
    void authorChanged();
    void yearChanged();
    void ratingChanged();

private:
    QString m_title;
    QString m_author;
    int m_year;
    double m_rating;
};