[Development] Enum classes in signals?

Jason H jhihn at gmx.com
Tue Feb 5 18:04:50 CET 2019


> Sent: Tuesday, February 05, 2019 at 11:58 AM
> From: "Thiago Macieira" <thiago.macieira at intel.com>
> To: development at qt-project.org
> Subject: Re: [Development] Enum classes in signals?
>
> On Tuesday, 5 February 2019 08:43:03 PST Jason H wrote:
> > While I prefer enum classes myself, I just had to connect to a signal with
> > one in it. This was unfortunate as I was attempting to use the old
> > connection syntax SIGNAL()/SLOT() macros. I was not aware that the old
> > syntax were being deprecated? What is the policy on this?
> 
> They're not exactly deprecated, but they're older than the new syntax and they 
> don't check at compile time that the connection can succeed.
> 
> > Should signals not use enum classes?
> 
> Unknown. I don't see why they shouldn't, but you haven't shared any error 
> messages, so I can't tell.
> 
> > Should Qt not use enum classes?
> 
> Enum classes are fine in Qt.
> 
> > Should Qt support old connection syntax? Where/when?
> 
> Yes. It should be supported for the millions of lines of code that existed 
> before the new syntax was introduced in 2012.
> 
> > Should all new connections be in the modern syntax?
> 
> Yes, if you can.

Great thanks for clarifying that. I use Qt principals in my own application code (they tend to be the best - well reasoned at least). So if there was something that I hadn't considered, I'd want to take that into account and avoid any gotchas down the road. I just started using enum classes myself.



More information about the Development mailing list