qt - QtRemoteObjects 自动生成的副本标头抱怨未定义的 vtable
问题描述
开始使用 QtRO 并且生成的文件天生就抱怨 vtable:
#ifndef REP_REMOTEEXAMPLE_H
#define REP_REMOTEEXAMPLE_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 remoteExampleReplica : public QRemoteObjectReplica
{
Q_OBJECT
Q_CLASSINFO(QCLASSINFO_REMOTEOBJECT_TYPE, "remoteExample")
Q_CLASSINFO(QCLASSINFO_REMOTEOBJECT_SIGNATURE, "5e40a606abdd95f709878d419edaa735fce25d0d")
public:
remoteExampleReplica() : QRemoteObjectReplica() { initialize(); }
static void registerMetatypes()
{
static bool initialized = false;
if (initialized)
return;
initialized = true;
}
private:
remoteExampleReplica(QRemoteObjectNode *node, const QString &name = QString())
: QRemoteObjectReplica(ConstructWithNode)
{
initializeNode(node, name);
}
void initialize() override
{
remoteExampleReplica::registerMetatypes();
QVariantList properties;
properties.reserve(0);
setProperties(properties);
}
public:
virtual ~remoteExampleReplica() {}
Q_SIGNALS:
void Close(QString a);
void Open(QString b);
public Q_SLOTS:
void onClosed()
{
static int __repc_index = remoteExampleReplica::staticMetaObject.indexOfSlot("onClosed()");
QVariantList __repc_args;
send(QMetaObject::InvokeMetaMethod, __repc_index, __repc_args);
}
void onOpened()
{
static int __repc_index = remoteExampleReplica::staticMetaObject.indexOfSlot("onOpened()");
QVariantList __repc_args;
send(QMetaObject::InvokeMetaMethod, __repc_index, __repc_args);
}
private:
friend class QT_PREPEND_NAMESPACE(QRemoteObjectNode);
};
#if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
#endif
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
#endif // REP_REMOTEEXAMPLE_H
问题指向私有构造函数。我只在我的代码中包含了副本标头,而没有真正使用远程对象作为测试运行。我已经阅读了很多关于 vtables 如何工作以及链接器抱怨 vtable 的内容,但在这种情况下,使用私有构造函数,我不确定问题是什么。
我错过了远程对象的实现吗?我没有正确生成文件吗?
.rep:
class remoteExample
{
SIGNAL(Close(QString a));
SIGNAL(Open(QString b));
SLOT(onClosed());
SLOT(onOpened());
};
解决方案
推荐阅读
- python - PySimpleGUI 输出元素换行符
- javascript - 自定义 Javascript 在 Wordpress 中不起作用
- c# - 如何在 Xamarin 的同一 API 中传递表单数据和 json?
- flutter - 使用ffmpeg向视频添加音频不起作用
- javascript - 使用递归函数时如何避免模块之间的循环依赖?
- flutter - 在颤振/飞镖中与图像下的小部件交互
- javascript - 傀儡师的麻烦。或者,至少,javascript 的麻烦;你决定,请
- javascript - NPM 版本历史 API
- javascript - 基于嵌套对象数组的过滤器
- octopus-deploy - Octopus 部署 JSON 变量替换未按预期工作