Use Q_SIGNALS/Q_EMIT instead of signals/emit in generated sources
ClosedPublic

Authored by kossebau on Sep 15 2018, 11:36 PM.

Details

Summary

Avoid potential clashes on symbols/macros from other libraries
Allows to use the generated header in projects which have
DQT_NO_SIGNALS_SLOTS_KEYWORDS or DQT_NO_KEYWORDS set

Diff Detail

Repository
R881 Rust Qt Binding Generator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau requested review of this revision.Sep 15 2018, 11:36 PM
kossebau created this revision.
vandenoever accepted this revision.Sep 16 2018, 7:05 AM

Better safe than sorry. I was not familiar with this practice. I looked for some information on it and found these https://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/ I found no qt.io docs on QT_NO_SIGNALS_SLOTS_KEYWORDS but using Q_SIGNALS is listed as a good idea at http://doc.qt.io/qt-5/qobject.html#Q_SIGNALS.

Should the code also be using Q_EMIT?

This revision is now accepted and ready to land.Sep 16 2018, 7:05 AM

Better safe than sorry. I was not familiar with this practice. I looked for some information on it and found these https://www.kdab.com/kdab-contributions-to-qt-5-0-part-5/ I found no qt.io docs on QT_NO_SIGNALS_SLOTS_KEYWORDS but using Q_SIGNALS is listed as a good idea at http://doc.qt.io/qt-5/qobject.html#Q_SIGNALS.

Indeed. I was so used to these defines I did not know they are undocumented. Filed https://bugreports.qt.io/browse/QTBUG-70564 to have this sorted out.

Should the code also be using Q_EMIT?

Indeed, that should help people who even use QT_NO_KEYWORDS in their code. Will do another patch for that. Also one coming up with a 0->nullptr change :)

Actually will update this patch to also include Q_EMIT, update coming soon here.

kossebau updated this revision to Diff 41743.Sep 16 2018, 3:45 PM

update to also use Q_EMIT

kossebau retitled this revision from Use "Q_SIGNALS" instead of "signals" in generated sources to Use Q_SIGNALS/Q_EMIT instead of signals/emit in generated sources.Sep 16 2018, 3:47 PM
kossebau edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.