Replace deprecated `stateChanged` function with `checkStateChanged` that was first introduced in QT 6.7 but keep the old code to maintain compatibility with older versions of QT.