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. Emitting a signal using c++ source created in eclipse to be used in a Slot in a Qt generated source header.
Forum Updated to NodeBB v4.3 + New Features

Emitting a signal using c++ source created in eclipse to be used in a Slot in a Qt generated source header.

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 2.3k Views 3 Watching
  • 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.
  • L Offline
    L Offline
    Lineaxe
    wrote on last edited by
    #1

    Hmm, how would I create a signal in Eclipse c++ source code that I can use in my Qt created projects?

    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Lineaxe said:

      Eclipse c++ source code

      What do you mean by that?
      Do you have a .o file u link in or how is it "Eclipse c++ source code"

      To emit signal, the emitting code must be part of Qt object model somehow.
      Not sure how a foreign code could post signals.

      1 Reply Last reply
      0
      • L Lineaxe

        Hmm, how would I create a signal in Eclipse c++ source code that I can use in my Qt created projects?

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        @Lineaxe said:

        Eclipse c++ source code

        There's no such thing. Either source code is in C++ (which is a language) or it's not. The IDE/text editor used to write that source code has no bearing at all. You could write programs in notepad or vi if you wish.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lineaxe
          wrote on last edited by Lineaxe
          #4

          Well put ,
          The Eclipse IDE does produce C++ code ,much of the Code produced is transferable to QT compiler. However, Qt has its libraries and Eclipse has it's set (Of course you add in more libraries) .So I really meant code that was created to compile with Eclipse. Anyhow, the Eclipse code is compiled into a .so library which is being used in a Qt created program. I want to have the Eclipse produce some code that can be used to 'emit' a signal , which I can then use in a slot that has been created inside a Qt project source file header.

          1 Reply Last reply
          0
          • jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            "The Eclipse IDE does produce C++ code" - do you mean a code generator?
            Actually you as developer write C++ code, not Eclipse.
            If you want to use Qt signals/slots then you have to use Qt. That means in your Eclipse project you have to use Qt.
            Do you have to use Eclipse for that library? Why not work on it in QtCreator? It would make things easier.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lineaxe
              wrote on last edited by Lineaxe
              #6

              Well , I wrote that library some time ago , I could cross compile it to an arm 6 computer . It also handled mixing c and c++ source. I was familiar with Eclipse from writing Perl and java code using it. So I learned what was needed to make the library classes work. I probably could create a similar library using QT , it would require learning how it is done in QT. But for the time being I do have the working .so library written.

              kshegunovK 1 Reply Last reply
              0
              • jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                You don't have to rewrite the library. Just change it a bit to be able to emit Qt signals.

                Or provide something else in the library: for example a call-back (you pass function pointer to the library and in the library you call this call-back if you have new notifications). In this case you don't need to bother with Qt in your library.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • L Lineaxe

                  Well , I wrote that library some time ago , I could cross compile it to an arm 6 computer . It also handled mixing c and c++ source. I was familiar with Eclipse from writing Perl and java code using it. So I learned what was needed to make the library classes work. I probably could create a similar library using QT , it would require learning how it is done in QT. But for the time being I do have the working .so library written.

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #8

                  @Lineaxe

                  Anyhow, the Eclipse code is compiled into a .so library which is being used in a Qt created program. I want to have the Eclipse produce some code that can be used to 'emit' a signal , which I can then use in a slot that has been created inside a Qt project source file header.

                  If I understand you correctly, this can't happen without modifying your library code (possibly heavily), as the library has no notion of the application's infrastructure (and this is normal). To sum up the library has no way of knowing what is declared in the application, what classes are available or what interfaces they expose.

                  One thing you could possibly do to work around this is to push an object to the library, which in turn will call a function of that object, and finally this object will emit a Qt signal that you can subscribe to in the application - the observer pattern (which is a glorified callback function basically).

                  Kind regards.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Lineaxe
                    wrote on last edited by Lineaxe
                    #9

                    You know , rewriting the Code to work in Qt isn't such a bad approach in my case. The library is very small at this point. It was written run c code along with c++ . In eclipse I ran into a problem where I couldn't use C++11 along with C++98 in the same project. (The c code required c++98) So , I made a library up that I could use with all my other c++11 code . I have used the library in both eclipse and Qt. So it does makes it more universal of a library than if I rewrite it with signals and slots in Qt. Callback functions are always a good option as well :)

                    1 Reply Last reply
                    0

                    • Login

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