Qt defines an enumeration Qt::CheckState
which is used (for instance) by QCheckBox::checkState
and QCheckBox::setCheckState
.
What is surprising/confusing is that Qt defines the signal QCheckBox::stateChanged
with an int
argument instead of a Qt::CheckState
, forcing us to lose the Qt::CheckState
semantic when we want to define a slot to connect to this signal, which is quite annoying and makes the enumeration a bit useless.
Is there any rational behind such a decision or is this a Qt blunder ?
Qt defines an enumeration Qt::CheckState
which is used (for instance) by QCheckBox::checkState
and QCheckBox::setCheckState
.
What is surprising/confusing is that Qt defines the signal QCheckBox::stateChanged
with an int
argument instead of a Qt::CheckState
, forcing us to lose the Qt::CheckState
semantic when we want to define a slot to connect to this signal, which is quite annoying and makes the enumeration a bit useless.
Is there any rational behind such a decision or is this a Qt blunder ?
Share Improve this question edited Apr 3 at 8:48 Fareanor asked Mar 31 at 12:10 FareanorFareanor 6,8132 gold badges15 silver badges45 bronze badges 6 | Show 1 more comment1 Answer
Reset to default -1According to the QT documentation, they focus on their slot-signal mechanism to be type safe:
The signature of a signal must match the signature of the receiving slot.
Making signal's signature dependent on specific enum will not be vesratile enough in some situation, especially when taking into account the everlasting problem of backward compatibility
int
too so probably historical reasons. – Botje Commented Mar 31 at 12:13int
instead of the dedicatedQt::CheckState
?" - You have to ask the creators/implementors of Qt that - have you tried that? – Jesper Juhl Commented Mar 31 at 12:15Qt::CheckState
have a meta data? If not then queued connections for such signal would not work. – Marek R Commented Mar 31 at 13:06