[Interest] Q_ENUMS with foreign enum ?
Martin Koller
kollix at aon.at
Mon Jul 14 11:38:51 CEST 2014
On Monday 14 July 2014 09:11:06 Rutledge Shawn wrote:
>
> On 12 Jul 2014, at 10:03 AM, Martin Koller wrote:
>
> > Hi,
> >
> > is there any possibility to use an enum in the Q_ENUMS macro when the enum is not
> > defined in a QObject derived class ?
> > (Specifically I'm trying to do that with QSslError::SslError)
>
> The Qt namespace has a lot of enums like that. The trick there is to get moc to pretend that the namespace is actually a class.
>
> src/corelib/global/qnamespace.h
This is not what I meant.
The Qt namespace defines enums on its own and the MOC-Hack (#if defined(Q_MOC_RUN)) just makes sure that the enums
can be used in Q_ENUMS
What I need is a FOREIGN enum, e.g. one which is already availabe in a different Qt header, but the enum is not
part of a QObject derived class.
E.g.
#include <QSslError>
class MyClass : public QObject
{
Q_OBJECT
Q_ENUMS(QSslError::SslError) // does not work
};
#include "moc_test.cxx"
In file included from test.cxx:9:0:
moc_test.cxx:66:10: error: ‘staticMetaObject’ is not a member of ‘QSslError’
&QSslError::staticMetaObject,
^
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\ - against proprietary attachments
Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
More information about the Interest
mailing list