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. plugin accessing data from qApp
Forum Update on Monday, May 27th 2025

plugin accessing data from qApp

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.3k 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.
  • I Offline
    I Offline
    itpenguin
    wrote on 27 Jul 2016, 14:06 last edited by
    #1

    Plugins are normally made for accessing plugin methods in the main program.

    Now I have an application, where the plugin needs to call a method from the main program.
    How is this done?
    I have a working solution using QMetaObject::invoke(), but using this is rather complex.

    Is there an easier way to call an application method from within the plugin?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Jul 2016, 22:06 last edited by
      #2

      Hi,

      Can you give more information about that plugin wanting to access qApp ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • I Offline
        I Offline
        itpenguin
        wrote on 28 Jul 2016, 07:12 last edited by
        #3

        OK, the problem is solved.
        I have to declare methods in the main application to be virtual, if they are to be called from inside the lib. That's because of dynamic linking of the address.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 28 Jul 2016, 20:15 last edited by
          #4

          Can you explain what you mean by that ?

          Method called from libraries don't need to be virtual at all unless you want the library users to be able to re-implement them.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • I Offline
            I Offline
            itpenguin
            wrote on 29 Jul 2016, 18:40 last edited by
            #5

            If I call a method of an class of the main application form inside the plugin, I get a runtime error, because the address of the method is not found.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 29 Jul 2016, 21:21 last edited by
              #6

              Did you load the plugin properly ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              5/6

              29 Jul 2016, 18:40

              • Login

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