Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support For Using Custom(User made) Plugins. #1120

Closed
antony-jr opened this issue May 31, 2020 · 3 comments
Closed

Support For Using Custom(User made) Plugins. #1120

antony-jr opened this issue May 31, 2020 · 3 comments

Comments

@antony-jr
Copy link

In the current version of the binding, I was able to load my plugin successfully but I could not access my methods or signals. Anyway to do this now?? Since QMetaObject seems to be incomplete, So I cannot use it to call my methods too.

I'm just opening this issue for you to consider this feature, I'm in no hurry.

Here is what I'm talking about.

import (
   "fmt"
   "flags"
   "github.com/therecipe/qt/core"
   "github.com/therecipe/qt/widgets"
);

func main(){
        PLUGIN_PATH := "/libMyPlugin.so";
        flag.Parse()
        args := flag.Args()
        app := widgets.NewQApplication(len(args), args);
        pluginLoader := core.NewQPluginLoader(nil);
        pluginLoader.SetFileName(PLUGIN_PATH);
        status := pluginLoader.Load();
        fmt.Println("Loaded:: ", status);

        MyPlugin := pluginLoader.Instance();
        fmt.Println("Address:: ", MyPlugin);
        
        // Let's call a method from the interface of 
        // the plugin.
       // MyPlugin.setFile("Something.data");
       // But the above will fail.
}
@amlwwalker
Copy link

Did you see this? #759 (comment)

@antony-jr
Copy link
Author

@amlwwalker Are you suggesting that I use golang's plugin package by wrapping the qt plugin itself in the golang's plugin? I don't know but PySide and PyQt5 have a good solution on this take.

To put it simply, I want to do what python binding can do, something like this,

from PySide.QtCore import QPluginLoader

loader = QPluginLoader('path/to/plugin.so')
loader.load()
qobject = loader.instance()
qobject.MyMethodFromPluginInterface()

@amlwwalker
Copy link

Yeah basically I am, the reason I am, is because I brought this topic up a while ago and @therecipe suggested this was the way to go. I guess it depends what you are after, I'm not sure what the capability of the Qt plugins vs the Go plugins are, but the Go approach did it for what I needed. Here is a link to the conversation I had

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants