Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
Future release
-
None
-
Fedora Linux qt 5.7 final, QtRemoteObjects commit 1a025808cb2ef171fdd35e68da56c78577d5954d
-
18cdd36ab105b0a1b375563812be2b1b08f9f666
Description
I'm trying to feed repc with QObject based class blow:
#ifndef SIMPLETICKER_H #define SIMPLETICKER_H #include <QObject> #include <QTimer> class SimpleTicker : public QObject { Q_OBJECT Q_PROPERTY(quint64 ticks READ ticks WRITE setTicks NOTIFY ticksChanged) uint64_t m_ticks; public: explicit SimpleTicker(QObject* parent = 0); quint64 ticks() const { return m_ticks; } public slots: void setTicks(quint64 ticks) { if (m_ticks == ticks) return; m_ticks = ticks; emit ticksChanged(ticks); } signals: void ticksChanged(quint64 ticks); }; #endif // SIMPLETICKER_H
As you see class is very simple, slots and signals bodies generated with QtCreator refactoring eq: Generate missing Q_PROPERTY members. And here is output of repc -o replica
#ifndef REP_SIMPLETICKER_REPLICA_H #define REP_SIMPLETICKER_REPLICA_H // This is an autogenerated file. // Do not edit this file, any changes made will be lost the next time it is generated. #include <QtCore/qobject.h> #include <QtCore/qdatastream.h> #include <QtCore/qvariant.h> #include <QtCore/qmetatype.h> #include <QtRemoteObjects/qremoteobjectnode.h> #include <QtRemoteObjects/qremoteobjectpendingcall.h> #include <QtRemoteObjects/qremoteobjectreplica.h> class SimpleTickerReplica : public QRemoteObjectReplica { Q_OBJECT Q_CLASSINFO(QCLASSINFO_REMOTEOBJECT_TYPE, "SimpleTicker") friend class QRemoteObjectNode; public: SimpleTickerReplica() : QRemoteObjectReplica() { initialize(); } SimpleTickerReplica(QRemoteObjectNode *node, const QString &name = QString()) : QRemoteObjectReplica(ConstructWithNode) { initializeNode(node, name); } void initialize() { QVariantList properties; properties.reserve(1); properties << QVariant::fromValue(quint64()); setProperties(properties); } public: virtual ~SimpleTickerReplica() {} Q_PROPERTY(quint64 ticks READ ticks WRITE setTicks NOTIFY ticksChanged) quint64 ticks() const { const QVariant variant = propAsVariant(0); if (!variant.canConvert<quint64>()) { qWarning() << "QtRO cannot convert the property ticks to type quint64"; } return variant.value<quint64 >(); } void setTicks(quint64 ticks) { static int __repc_index = SimpleTickerReplica::staticMetaObject.indexOfProperty("ticks"); QVariantList __repc_args; __repc_args << QVariant::fromValue(ticks); send(QMetaObject::WriteProperty, __repc_index, __repc_args); } Q_SIGNALS: void ticksChanged(quint64); void ticksChanged(quint64 ticks); public Q_SLOTS: void setTicks(quint64 ticks) { static int __repc_index = SimpleTickerReplica::staticMetaObject.indexOfSlot("setTicks(quint64)"); QVariantList __repc_args; __repc_args << QVariant::fromValue(ticks) ; send(QMetaObject::InvokeMetaMethod, __repc_index, __repc_args); } }; #if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0)) #endif #endif // REP_SIMPLETICKER_REPLICA_H
and here is output of repc -o rep
class SimpleTicker
{
PROP(quint64 ticks);
SLOT(void setTicks(quint64 ticks));
}
So as you can see in generated C++ source signals and slots declared twice, and in generated rep file property's setter declared as separate slot.
I would love to provide patch for it myself, but first I must figure out how to use all this Gerrit stuff.