I'm trying to extend QtPropertyBrowser to accept custom types. I've been following the guide here.
class CCustomPropertyFactory : public QtVariantEditorFactory {
...
}
class CCustomPropertyFactory : public QtVariantEditorFactory {
...
}
To copy to clipboard, switch view to plain text mode
class CCustomPropertyManager : public QtVariantPropertyManager {
...
}
class CCustomPropertyManager : public QtVariantPropertyManager {
...
}
To copy to clipboard, switch view to plain text mode
I'm getting the following linker error when building my code though:
1>------ Build started: Project: MockClient, Configuration: Debug Win32 ------
1>Linking...
1> Creating library C:\***Client.lib and object C:\***Client.exp
1>clientlib.lib(moc_CCustomPropertyFactory.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QtVariantEditorFactory::staticMetaObject" (?staticMetaObject@QtVariantEditorFactory@@2UQMeta Object@@B)
1>clientlib.lib(moc_CCustomPropertyManager.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QtVariantPropertyManager::staticMetaObject" (?staticMetaObject@QtVariantPropertyManager@@2UQMe taObject@@B)
1>C:\***Client.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\****\Debug\BuildLog.htm"
1>MockClient - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
It looks like there is a reference to the staticMetaObject in moc_CCustomPropertyFactory.cpp.
const QMetaObject Epoch
::CCustomPropertyFactory::staticMetaObject = { { &QtVariantEditorFactory::staticMetaObject, qt_meta_stringdata_Epoch__CCustomPropertyFactory,
qt_meta_data_Epoch__CCustomPropertyFactory, 0 }
};
const QMetaObject Epoch::CCustomPropertyFactory::staticMetaObject = {
{ &QtVariantEditorFactory::staticMetaObject, qt_meta_stringdata_Epoch__CCustomPropertyFactory,
qt_meta_data_Epoch__CCustomPropertyFactory, 0 }
};
To copy to clipboard, switch view to plain text mode
But staticMetaObject is only declared (in qobject.h) if qdoc is defined. Should qdoc be defined?
#ifdef qdoc
static QString tr
(const char *sourceText,
const char *comment
= 0,
int n
= -1);
static QString trUtf8
(const char *sourceText,
const char *comment
= 0,
int n
= -1);
#endif
#ifdef qdoc
static QString tr(const char *sourceText, const char *comment = 0, int n = -1);
static QString trUtf8(const char *sourceText, const char *comment = 0, int n = -1);
virtual const QMetaObject *metaObject() const;
static const QMetaObject staticMetaObject;
#endif
To copy to clipboard, switch view to plain text mode
I'm using Qt 4.6.2, QtPropertyBrowser 2.5.1, VS 2008, Windows 7.
Any help would be much appreciated.
Thanks
Stefan
Bookmarks