Warning, file /office/calligra/gemini/PropertyContainer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2012 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PROPERTYCONTAINER_H 0008 #define PROPERTYCONTAINER_H 0009 0010 #include <QObject> 0011 #include <QVariant> 0012 0013 /** 0014 * The only purpose of this class is to expose the dynamic property 0015 * system of Qt to QML, so we can set and get properties on a generic 0016 * object. It is a little bit of a hack, but QML deliberately does 0017 * not have access to this (according to the developers). 0018 */ 0019 class PropertyContainer : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit PropertyContainer(QString name, QObject* parent = 0); 0024 ~PropertyContainer() override; 0025 0026 // As QObject already as setProperty and property() functions, we must 0027 // name ours differently 0028 Q_INVOKABLE void writeProperty(QString name, QVariant value); 0029 Q_INVOKABLE QVariant readProperty(QString name); 0030 0031 Q_INVOKABLE QString name(); 0032 private: 0033 QString m_name; 0034 }; 0035 0036 #endif // PROPERTYCONTAINER_H