Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSerialPort::sendBreak() is deprecated but no alternative is proposed



  • The subject is self-explanatory: the official docs states the sendBreak() function is deprecated but they don't propose an alternative. How do they suppose we can send a break now?

    Edit: @aha_1980 corrected link


  • Lifetime Qt Champion

    @Mark81 Out of curiosity, for what do you need this function?



  • For example to generate a DMX-512 signal.
    But, generally speaking, if something becomes obsolete or deprecated one should know how to do the same thing with the newer functions. At least, IMHO.


  • Lifetime Qt Champion

    @Mark81

    The commit that deprecated the function contains the following message:

    Improve usage of the break state for the Tx line

    1. Now the sendBreak() method is deprecated since it is blocking and
      impossible to implement same behavior on different platforms using
      their API's. Besides, this method can be implemented via
      setBreakEnabled() and QTimer.
    1. Introduced the new property named as "breakEnabled" which consist
      of setBreakEnabled() and isBreakEnabled() methods and the signal
      breakEnabledChanged().

    Note: After opening, the port always is in non-break state.

    So it seems setBreakEnabled() is the function to use now.



  • Thank you. I didn't searched for the commit, just relied on the documentation. Next time I'll try to do that.


  • Lifetime Qt Champion

    @Mark81

    Well, maybe the sentence "This function is deprecated" could be "This function is deprecated. Use xxx instead".

    But at least, at the end of the sendBreak() chapter, there is a "see also" link to setBreakEnabled().

    Regards


Log in to reply