[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Accessing PyQt designer
From: David Boddie <david () boddie ! org ! uk>
Date: 2015-10-19 21:24:11
Message-ID: 201510192324.12104.david () boddie ! org ! uk
[Download RAW message or body]
On Tue Oct 13 15:41:28 BST 2015, Carl Wolff wrote:
> can somebody help me with adding functionality to designer with python,
> preferably by some code examples?
What functionality do you want to add?
> I already succeeded to create custom python widgets and to expose them to
> designer: so that is not a problem.
>
> But the documentation states also the following code in
> http://doc.qt.io/qt-4.8/qdesignerformwindowmanagerinterface.html , but for
> me it is totally unclear how to proceed from here with Python.
As far as I can remember, a lot of the classes like that expose details of
Designer's implementation without really providing a convenient way to extend
Designer itself, other than by using a custom widget plugin (or another type
of plugin) as a way of running the code you want to extend Designer with.
It looks like Designer passes a QDesignerFormEditorInterface instance to your
plugins's initialize method:
http://doc.qt.io/qt-4.8/qdesignercustomwidgetinterface.html#initialize
You can then call its formWindowManager method to get a
QDesignerFormWindowManagerInterface instance:
http://doc.qt.io/qt-4.8/qdesignerformeditorinterface.html#formWindowManager
Then you can access the form windows using the window manager interface:
http://doc.qt.io/qt-4.8/qdesignerformwindowmanagerinterface.html
So, to summarize, in your QPyDesignerCustomWidgetPlugin class, you do
something like this with the initialize method:
def initialize(formEditor):
windowManager = formEditor.formWindowManager()
for i in range(windowManager.formWindowCount()):
window = windowManager.formWindow(i)
Hope this helps,
David
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic