Warning, /sdk/cutehmi/extensions/CuteHMI/Services.3/dev/CuteHMI.Services-5.workaround.Qt.bug.txt is written in an unsupported language. File is not indexed.

0001 Problem:
0002 
0003 Function handleCounters() relies on values returned by QState::active().
0004 Unfortunately `active` property is being set to true only after the signal
0005 QState::entered() has been emitted.
0006 
0007 Investigation:
0008 
0009 Following code in `qt5/qtbase/src/corelib/statemachine/qabstractstate.cpp` is
0010 responsible for setting up the `active` property and emitting `entered()`
0011 signal.
0012 
0013 ```
0014 void QAbstractStatePrivate::emitEntered()
0015 {
0016     Q_Q(QAbstractState);
0017     emit q->entered(QAbstractState::QPrivateSignal());
0018     if (!active) {
0019         active = true;
0020         emit q->activeChanged(true);
0021     }
0022 }
0023 ```
0024 
0025 As one can see signal is emitted first and then the property is being set.
0026 
0027 Here's what the [documentation](https://doc.qt.io/qt-6/qabstractstate.html#active-prop)
0028 says about `QAbstractState::active` property:
0029 
0030 > This property holds the active property of this state. A state is active
0031 > between entered() and exited() signals.
0032 
0033 This is strict definition in continuous space, but the program lives in a
0034 discrete space and we end up with an undetermined state, when the signal
0035 `entered()` has been emitted, but `active` property has not been set yet.
0036 Unfortunatelly `entered()` signal can be connected to slots that may rely on
0037 `active` property in this short-lived window.
0038 
0039 Workaround:
0040 
0041 A workaround is to rely on `QAbstractState::activeChanged()` signal instead
0042 of `QAbstractState::entered()` whenever access to `active` property in slot is
0043 needed.
0044 
0045 Snippet:
0046