2023-03-17 14:42:47 +00:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
2022-05-13 13:12:05 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2023-03-17 14:42:47 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#ifndef HAPPYBIRTHDAYSONG_H
|
|
|
|
#define HAPPYBIRTHDAYSONG_H
|
|
|
|
|
2012-02-16 04:43:03 +00:00
|
|
|
#include <QQmlProperty>
|
2023-03-17 14:42:47 +00:00
|
|
|
#include <QQmlPropertyValueSource>
|
2020-01-13 11:49:05 +00:00
|
|
|
#include <qqml.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <QStringList>
|
|
|
|
|
2012-02-16 04:43:03 +00:00
|
|
|
class HappyBirthdaySong : public QObject, public QQmlPropertyValueSource
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-02-16 04:43:03 +00:00
|
|
|
Q_INTERFACES(QQmlPropertyValueSource)
|
2023-03-17 14:42:47 +00:00
|
|
|
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL)
|
2020-01-13 11:49:05 +00:00
|
|
|
QML_ELEMENT
|
2011-04-27 10:05:43 +00:00
|
|
|
public:
|
2021-11-02 08:04:21 +00:00
|
|
|
explicit HappyBirthdaySong(QObject *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2019-08-19 09:06:39 +00:00
|
|
|
void setTarget(const QQmlProperty &) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
void setName(const QString &);
|
|
|
|
|
2023-03-17 14:42:47 +00:00
|
|
|
signals:
|
|
|
|
void nameChanged();
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private slots:
|
|
|
|
void advance();
|
|
|
|
|
|
|
|
private:
|
2021-11-02 08:04:21 +00:00
|
|
|
qsizetype m_line = -1;
|
2011-04-27 10:05:43 +00:00
|
|
|
QStringList m_lyrics;
|
2012-02-16 04:43:03 +00:00
|
|
|
QQmlProperty m_target;
|
2011-04-27 10:05:43 +00:00
|
|
|
QString m_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // HAPPYBIRTHDAYSONG_H
|