Qt World Summit: Submit your Presentation

Question about Qt's signals and slots portability?

  • Hi,

    If understood it correctly, signals and slots are implemented with macros.
    Then if I write an app that uses signals and slots and an app that uses just the standard c++.
    They both should be equally portable, right? (emit keyword??)


  • Your assumption is correct. Code that makes use of Qt's extentions to C++ is first transformed to ordinary C++ code using the MOC (meta object compiler) and then compiled to object code by any standard compliant C++ compiler.

  • @Wieland thanks for clarification!

  • HI and welcome to devnet,

    just to add something to what @Wieland said; you can also use CONFIG+=no_keywords in your .pro file.

    In that case you have to use Q_SIGNALS, Q_SLOTS, Q_EMIT instead signals, slots, emit; this is useful when you use a 3rdparty source code parser which doesn't understand these special Qt keywords.

    Qt suggests to use these macros when you release a public library.

  • @mcosta thanks! :)

Log in to reply