-
-
Notifications
You must be signed in to change notification settings - Fork 2k
-
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
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 11 comments 30 replies
-
QDesignerCustomWidgetInterface is the designer plugin. are you written desinger custom plugin?
Beta Was this translation helpful? Give feedback.
All reactions
-
yes Yes it is QDesignerCustomWidgetInterface
Beta Was this translation helpful? Give feedback.
All reactions
-
- PySide is not support Qt Designer plugin yet. but PyQt5.
- you can see https://github.com/PyQt5/QtDesignerPlugins/tree/master/Designer
- must have
pyqtplugin5
plugin
Beta Was this translation helpful? Give feedback.
All reactions
-
can you speak Chinese?
Beta Was this translation helpful? Give feedback.
All reactions
-
I looked at your project and couldn't find anything about loading and generating plugins.
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
你会说中文吗?
你早说啊
Beta Was this translation helpful? Give feedback.
All reactions
-
abc = QPluginLoader("This is a dll file path test.dll")
Beta Was this translation helpful? Give feedback.
All reactions
-
插件可以做ui
我是用插件做了一个小部件
类似于你例子中的
image
这个案例
Beta Was this translation helpful? Give feedback.
All reactions
-
我的插件是一个对于应用程序的扩展,属于插件的动态加载
Beta Was this translation helpful? Give feedback.
All reactions
-
插件可以做ui 我是用插件做了一个小部件 类似于你例子中的 image 这个案例
这种只是适合于 设计师用的。 设计师有单独的规范,
而且它的前提也是 先写了 设计师的插件。在插件里 嵌入了py。 然后py加载 py写的插件 又按照设计师的规范 来写的自定义控件
Beta Was this translation helpful? Give feedback.
All reactions
-
我并不是设计一个界面
我是 界面+程序 并生成了一个dll动态库的文件
qt可以读取我的动态库并加载到我的应用程序中
这就形成了qt的插件式开发
你可以看看
https://doc.qt.io/qtforpython-6/overviews/plugins.html
Beta Was this translation helpful? Give feedback.
All reactions
-
我并不是设计一个界面 我是 界面+程序 并生成了一个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)
Beta Was this translation helpful? Give feedback.
All reactions
-
这种方式我还没试过。估计支持不太好。
我只是到分别用两种来实现
1、PyQt5 的sip 封装
2、PySide6 的 https://doc.qt.io/qtforpython/shiboken6/index.html
Beta Was this translation helpful? Give feedback.
All reactions
-
QPluginLoader 这种方式等我有空试一下
Beta Was this translation helpful? Give feedback.
All reactions
-
在使用之前我是用c++qt生成了一个dll文件
你可能也需要一个dll文件
如果有结果,无论是好是坏,请及时告诉我,这对我很重要
Beta Was this translation helpful? Give feedback.
All reactions
-
在使用之前我是用c++qt生成了一个dll文件 你可能也需要一个dll文件 如果有结果,无论是好是坏,请及时告诉我,这对我很重要
所以是这样子?python qt 加载 (c++ 写的qt插件)来显示 自定义的 界面
Beta Was this translation helpful? Give feedback.
All reactions
-
是的 当然如果你找到了用pyqt生成dll的方式也可以告诉我
Beta Was this translation helpful? Give feedback.
All reactions
-
是的 当然如果你找到了用pyqt生成dll的方式也可以告诉我
pyqt封装有现成的
1、PyQt5 的sip 封装
2、PySide6 的 https://doc.qt.io/qtforpython/shiboken6/index.html
封装好可以。python 可以直接 import 和正常 python模块调用一样方便
Beta Was this translation helpful? Give feedback.
All reactions
-
是用py sip封装的吗
Beta Was this translation helpful? Give feedback.
All reactions
-
是用py sip封装的吗
对啊。这个东西可以把 c++写的 东西 封装成 pyd。 给python直接使用,。 PyQt5的pyd就是用它做的
Beta Was this translation helpful? Give feedback.
All reactions
-
是不是这样的
image
然后会把这样的文件生成.py文件
我去了解一下sip
Beta Was this translation helpful? Give feedback.
All reactions
-
我这里有一点例子你可以了解下
https://github.com/PyQt5/PyQt/tree/master/QLabel/Lib/QtNinePatch (sip用法过时了。需要去看新的官网文档)
Beta Was this translation helpful? Give feedback.
All reactions
-
在编写configure.py 之后编译的时候
找不到"XXX.sbf"你有碰到这种情况吗?
我找了很久没有找到解决方法
Beta Was this translation helpful? Give feedback.
All reactions
-
这个应该是自动生成的。注意排查下每一步的执行结果。看看日志错误等
Beta Was this translation helpful? Give feedback.
All reactions
-
我创建了一个新的虚拟环境 弄好了 感谢
QPluginLoader 尝试了没
Beta Was this translation helpful? Give feedback.
All reactions
-
看了下。这个东西py用不了的。这是专门给c++用的。需要.h 头文件里定义的类型
Beta Was this translation helpful? Give feedback.
All reactions
-
pyqt qobject_cast 有用过吗
Beta Was this translation helpful? Give feedback.
All reactions
-
pyqt qobject_cast 有用过吗
没有。这些函数都是c++里用的。
Beta Was this translation helpful? Give feedback.
All reactions
-
在pyqt里转换类型用什么
Beta Was this translation helpful? Give feedback.
All reactions
-
我最终用库解决了加载的问题
我想问下上传文件和文件夹可以用什么实现
Beta Was this translation helpful? Give feedback.
All reactions
-
post 提交啊。文件夹可以压缩zip
或者sftp协议
Beta Was this translation helpful? Give feedback.
All reactions
-
额 我想问pyqt用图形界面用什么选择文件或者文件夹
Beta Was this translation helpful? Give feedback.
All reactions
-
QFileDialog
Beta Was this translation helpful? Give feedback.
All reactions
-
好的
Beta Was this translation helpful? Give feedback.
All reactions
-
pyqt 批量创建按钮并连接另一个按钮的信号槽
我现在连接槽的时候连接的是最后一个按钮 前面的按钮没连接上
Beta Was this translation helpful? Give feedback.
All reactions
-
解决了
Beta Was this translation helpful? Give feedback.