Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

QPluginLoader #169

Unanswered
727854320 asked this question in Q&A
Oct 11, 2022 · 11 comments · 30 replies
Discussion options

abc = QPluginLoader(os.path.realpath(os.listdir(os.getcwd())[0])) 	##<PySide2.QtCore.QPluginLoader(0x1f8f39b5900) at 0x000001F8F494EE40>
plugin = abc.instance() 	##<PySide2.QtCore.QObject(0x1f8f39b5a50) at 0x000001F8F494EEC0>
if plugin:
	print(abc.metaData()) 	##{'IID': 'org.qt-project.Qt.QDesignerCustomWidgetInterface', 'archreq': 0, 'className': 'gamewidgetPlugin', 'debug': False, 'version': 331264}

So far it looks like the plug-in has loaded successfully
But how do I generate a plug-in as a widget and add it to my container

You must be logged in to vote

Replies: 11 comments 30 replies

Comment options

QDesignerCustomWidgetInterface is the designer plugin. are you written desinger custom plugin?

You must be logged in to vote
1 reply
Comment options

yes Yes it is QDesignerCustomWidgetInterface

Comment options

  1. PySide is not support Qt Designer plugin yet. but PyQt5.
  2. you can see https://github.com/PyQt5/QtDesignerPlugins/tree/master/Designer
  3. must have pyqtplugin5 plugin
You must be logged in to vote
4 replies
Comment options

can you speak Chinese?

Comment options

I looked at your project and couldn't find anything about loading and generating plugins.

Comment options

My previous code was found according to pyqt document, and now I can print out IID and version number. This means that I've loaded successfully, I just haven't found a way to generate the widget.

Comment options

你会说中文吗?
你早说啊

Comment options

abc = QPluginLoader("This is a dll file path test.dll")

You must be logged in to vote
9 replies
Comment options

插件可以做ui
我是用插件做了一个小部件
类似于你例子中的
image
这个案例

Comment options

我的插件是一个对于应用程序的扩展,属于插件的动态加载

Comment options

插件可以做ui 我是用插件做了一个小部件 类似于你例子中的 image 这个案例

这种只是适合于 设计师用的。 设计师有单独的规范,
而且它的前提也是 先写了 设计师的插件。在插件里 嵌入了py。 然后py加载 py写的插件 又按照设计师的规范 来写的自定义控件

Comment options

我并不是设计一个界面
我是 界面+程序 并生成了一个dll动态库的文件
qt可以读取我的动态库并加载到我的应用程序中
这就形成了qt的插件式开发
你可以看看
https://doc.qt.io/qtforpython-6/overviews/plugins.html

Comment options

我并不是设计一个界面 我是 界面+程序 并生成了一个dll动态库的文件 qt可以读取我的动态库并加载到我的应用程序中 这就形成了qt的插件式开发 你可以看看 https://doc.qt.io/qtforpython-6/overviews/plugins.html

所以到头来我一直没搞清
现在应该明白了
你是想用 C++ 的Qt 加载 你python qt写的 dll库?
还是 python qt 加载 (c++ 写的qt插件)
还是 python qt 加载 (python 写的 qt插件 dll)

Comment options

这种方式我还没试过。估计支持不太好。
我只是到分别用两种来实现
1、PyQt5 的sip 封装
2、PySide6 的 https://doc.qt.io/qtforpython/shiboken6/index.html

You must be logged in to vote
0 replies
Comment options

QPluginLoader 这种方式等我有空试一下

You must be logged in to vote
4 replies
Comment options

在使用之前我是用c++qt生成了一个dll文件
你可能也需要一个dll文件
如果有结果,无论是好是坏,请及时告诉我,这对我很重要

Comment options

在使用之前我是用c++qt生成了一个dll文件 你可能也需要一个dll文件 如果有结果,无论是好是坏,请及时告诉我,这对我很重要

所以是这样子?python qt 加载 (c++ 写的qt插件)来显示 自定义的 界面

Comment options

是的 当然如果你找到了用pyqt生成dll的方式也可以告诉我

Comment options

是的 当然如果你找到了用pyqt生成dll的方式也可以告诉我

pyqt封装有现成的

1、PyQt5 的sip 封装
2、PySide6 的 https://doc.qt.io/qtforpython/shiboken6/index.html

封装好可以。python 可以直接 import 和正常 python模块调用一样方便

Comment options

是用py sip封装的吗

You must be logged in to vote
2 replies
Comment options

是用py sip封装的吗

对啊。这个东西可以把 c++写的 东西 封装成 pyd。 给python直接使用,。 PyQt5的pyd就是用它做的

Comment options

是不是这样的
image
然后会把这样的文件生成.py文件
我去了解一下sip

Comment options

You must be logged in to vote
1 reply
Comment options

在编写configure.py 之后编译的时候
找不到"XXX.sbf"你有碰到这种情况吗?
我找了很久没有找到解决方法

Comment options

这个应该是自动生成的。注意排查下每一步的执行结果。看看日志错误等

You must be logged in to vote
2 replies
Comment options

我创建了一个新的虚拟环境 弄好了 感谢
QPluginLoader 尝试了没

Comment options

看了下。这个东西py用不了的。这是专门给c++用的。需要.h 头文件里定义的类型

Comment options

pyqt qobject_cast 有用过吗

You must be logged in to vote
2 replies
Comment options

pyqt qobject_cast 有用过吗

没有。这些函数都是c++里用的。

Comment options

在pyqt里转换类型用什么

Comment options

我最终用库解决了加载的问题

我想问下上传文件和文件夹可以用什么实现

You must be logged in to vote
4 replies
Comment options

post 提交啊。文件夹可以压缩zip
或者sftp协议

Comment options

额 我想问pyqt用图形界面用什么选择文件或者文件夹

Comment options

QFileDialog

Comment options

好的

Comment options

pyqt 批量创建按钮并连接另一个按钮的信号槽
我现在连接槽的时候连接的是最后一个按钮 前面的按钮没连接上

You must be logged in to vote
1 reply
Comment options

解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /