[Interest] Will Qt6 end this enum issue? (or even 5.15?)

Shawn Rutledge Shawn.Rutledge at qt.io
Thu Mar 19 17:16:02 CET 2020


> On 19 Mar 2020, at 15:04, Jason H <jhihn at gmx.com> wrote:
> It seems that enums should be class with a value and label
> console.log(camera.position.label) => "BackFace"
> console.log(camera.position.value) => 1

Yes I have often wished for a way to do that too.  qDebug() << enumValue works so well in C++ as long as you used the Q_ENUM macro, so it would be nice to have an idiomatic way to access the same debug operator in JS.  Then again, I wish we had ubiquitous toString() like Java has, instead of the debug operators only being accessible when you’re using qDebug.  (I think the reason we don’t is that people might think of toString() as a serialization mechanism?  But I’m not sure.). Maybe there’s another idiom on JS that I don’t know about.



More information about the Interest mailing list