Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Keyword "signals" used in a library
Forum Update on Monday, May 27th 2025

Keyword "signals" used in a library

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 516 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Romain.Besso
    wrote on last edited by
    #1

    Hello,
    I use QT4.8.3 and I have a problem in the compilation of my project because of a library that I include, a variable is called "signals". What are the solutions to avoid this kind of problem?

    Thanks in advance

    Romain

    J.HilkJ 1 Reply Last reply
    0
    • R Romain.Besso

      Hello,
      I use QT4.8.3 and I have a problem in the compilation of my project because of a library that I include, a variable is called "signals". What are the solutions to avoid this kind of problem?

      Thanks in advance

      Romain

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Romain-Besso

      CONFIG += no_keywords

      https://doc.qt.io/qt-5/signalsandslots.html#3rd-party-signals-and-slots

      but than you'll have to use the alternative macros

      Q_SIGNALS (or Q_SIGNAL), Q_SLOTS (or Q_SLOT), and Q_EMIT

      in all of your code.
      Good luck refactoring :D


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      JonBJ 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @Romain-Besso

        CONFIG += no_keywords

        https://doc.qt.io/qt-5/signalsandslots.html#3rd-party-signals-and-slots

        but than you'll have to use the alternative macros

        Q_SIGNALS (or Q_SIGNAL), Q_SLOTS (or Q_SLOT), and Q_EMIT

        in all of your code.
        Good luck refactoring :D

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @J-Hilk , @Romain-Besso

        Correct me if I'm wrong, but in order to avoid that "refactoring": Are you able to place the library's #include <...h> statement somewhere in your code before you #include anything from Qt (including watch out for nested includes)? If so won't that make it possible for the library to not see any signals definition from Qt, but after that the Qt definition takes over? Might be worth a stab first....

        J.HilkJ 1 Reply Last reply
        0
        • R Offline
          R Offline
          Romain.Besso
          wrote on last edited by
          #4

          Ty for answers, what about #define QT_NO_KEYWORDS ?

          Christian EhrlicherC 1 Reply Last reply
          0
          • R Romain.Besso

            Ty for answers, what about #define QT_NO_KEYWORDS ?

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Romain-Besso said in Keyword "signals" used in a library:

            what about #define QT_NO_KEYWORDS ?

            This is what

            CONFIG += no_keywords

            does for you.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • JonBJ JonB

              @J-Hilk , @Romain-Besso

              Correct me if I'm wrong, but in order to avoid that "refactoring": Are you able to place the library's #include <...h> statement somewhere in your code before you #include anything from Qt (including watch out for nested includes)? If so won't that make it possible for the library to not see any signals definition from Qt, but after that the Qt definition takes over? Might be worth a stab first....

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @JonB
              you don't have to worry about the Qt libraries/includes, those are already with the alternative macros, iirc.

              the rest, I'm not sure what you mean :D


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Romain.Besso
                wrote on last edited by Romain.Besso
                #7

                CONFIG += no_keywords also remove things like foreach, any solution to only remove signals slots emit ?
                Because I really need to use foreach

                Christian EhrlicherC 1 Reply Last reply
                0
                • R Romain.Besso

                  CONFIG += no_keywords also remove things like foreach, any solution to only remove signals slots emit ?
                  Because I really need to use foreach

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Romain-Besso said in Keyword "signals" used in a library:

                  Because I really need to use foreach

                  Use Q_FOREACH then.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    or better yet, the c++ range for
                    https://en.cppreference.com/w/cpp/language/range-for

                    that works with qt containers just fine


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    2

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved