[Interest] Using another Class's enum in your class

Jason H scorp1us at yahoo.com
Thu Feb 13 21:20:03 CET 2014

Yes, I am no image processing expert, or OpenCL expert.

Oh, I thought I was clear, I am trying to get video (file and camera) and pass it to the ZBar library for processing. ZBar takes barcode images and give you barcodes. I said it expects "Y800" (identical to 8-bpp gray). It doesn't take a container, just a uchar buffer. I do not have control over the zbar library.

Sorry, for the confusion but that was not my attitude. I know why QImage does not support YUV formats. The only part I am frustrated about is QVideoProbe is not very cross-platform. Videos on Windows and Linux, Cameras on Android, No support on Mac or OSX. So now I'm going into QAbstractVideoSurface, which is an area I am not very comfortable with. 

Sorry for coming off disrespectful. I'm just a little frustrated, but VERY thankful for all the help!!

From: Alan Ezust <alan.ezust at gmail.com>
To: Jason H <scorp1us at yahoo.com> 
Cc: Interests Qt <interest at qt-project.org> 
Sent: Thursday, February 13, 2014 1:38 PM
Subject: Re: [Interest] Using another Class's enum in your class

(crickets chirp)

I was wondering if anyone was going to tackle this. It's a question I often asked. And in finding an answer, I looked at the Qt source code. Which may have been a bad idea. 

With the exception of the "Qt" namespace, that's what Qt does itself, using int instead of the
enum from another Q_OBJECT class. 

The way Qt put Q_ENUMS into the Qt namespace is by pretending it is a QObject when moc processes it and pretending it is a namespace when it is compiled by the compiler. Which is a bit of a hack.

Another idea is to put all the Q_ENUMS in the most basey of base classes and have all of your other classes inherit from that class and then you can use the Q_ENUM in all the derived types.

I ended up writing my own Enum class that converts to/from int and QString and using that instead of Q_ENUMS for these kind of situations. 

I don't know the best answer to your question. I was hoping someone else would say something.

On Wed, Feb 12, 2014 at 6:38 AM, Jason H <scorp1us at yahoo.com> wrote:

The Q_ENUMS() macro will do what I want -- for QObject derived class enums. But what does one do about an enum that is not QObject derived?
>Q_PROPERTY(int/*QImage::Format*/ imageFormat READ imageFormat WRITE setImageFormat); //works
>Q_PROPERTY(QImage::Format imageFormat READ imageFormat WRITE setImageFormat) //causes bad moc code
>---bad code--------
>static const QMetaObject*qt_meta_extradata_VideoSurface[]={
>&QImage::staticMetaObject, // "staticmetaObject is not a member of QImage"
>For now I'm just using an int. What should I be doing?
>Interest mailing list
>Interest at qt-project.org

More information about the Interest mailing list