[Development] Removing overloaded signals in Qt6

André Somers andre at familiesomers.nl
Fri Nov 29 09:25:19 CET 2019


Hi,

On 29-11-19 09:15, Ville Voutilainen wrote:
> On Wed, 27 Nov 2019 at 17:52, Sérgio Martins via Development
> <development at qt-project.org> wrote:
>> Hi,
>>
>>
>> The Qt5 PMF connect syntax is wonderful and very elegant compared to Qt
>> 4.
>> Unless, ofc, you have overloaded signals, which makes it painful to
>> write and read. Not even qOverload makes it look much better.
>>
>>
>> I suggest we rename such signals, as KDE is already doing for KF6 (maybe
>> leave the old signatures there, to reduce Qt6 SIC)
>> There's also a new clazy check 'overloaded-signal' to help finding them.
>>
>>
>> Relevant bug report: QTBUG-47225
>>
>>
>> I know there are downsides, but keeping things as they are is just
>> worse.
>>
>> Signals and slots are the bread of butter of Qt. Syntax for overloading
>> signals is just too much of a barrier for new-comers, who currently
>> aren't
>> even able to connect a QComboBox without much hassle.
> Seems like a splendid idea to me, showing even advanced programmers
> that they need
> to take an address of a member function with a cast seems to baffle
> them. Any thoughts
> on overloaded slots, or overloaded member functions as slot-targets?
> The latter are a tad
> harder to diagnose.

They are much easier to solve though. I usually just use a trivial 
lambda for these cases.

I'd suggest to start with just adding specific specialized signals next 
to the overloaded ones. Doing that is binary compatible, so it can be 
done in 5.15 already. The overloaded signal can then be marked as 
deprecated. I'm not sure they should be removed completely for 6, but if 
there is a specialized alternative it would already take away the pain 
of the connect statement.

André


> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


More information about the Development mailing list