kasts/src/about.h
Felipe Kinoshita e1c80bff3d
Don't use contextProperty to make KAboutData available on QML
Context properties always takes in a QVariant, which means that
whenever you access the property it is re-evaluated because in
between each access the property may be changed as
setContextProperty() can be used at any moment in time.
2021-09-28 17:46:01 -03:00

28 lines
559 B
C++

/**
* SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <QObject>
#include <KAboutData>
class AboutType : public QObject
{
Q_OBJECT
Q_PROPERTY(KAboutData aboutData READ aboutData CONSTANT)
public:
static AboutType &instance()
{
static AboutType _instance;
return _instance;
}
[[nodiscard]] KAboutData aboutData() const
{
return KAboutData::applicationData();
}
};