plugin accessing data from qApp
-
wrote on 27 Jul 2016, 14:06 last edited by
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?
-
Hi,
Can you give more information about that plugin wanting to access
qApp
? -
wrote on 28 Jul 2016, 07:12 last edited by
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. -
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.
-
wrote on 29 Jul 2016, 18:40 last edited by
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.
-
Did you load the plugin properly ?
5/6