[PyQt] Designer source

Andreas Pakulat apaku at gmx.de
Fri Mar 9 11:09:03 GMT 2012


On 09.03.12 09:38:06, Hans-Peter Jansen wrote:
> Am Thursday 08 March 2012 23:08:09 schrieb Andreas Pakulat:
> > On 08.03.12 19:42:39, Detlev Offenbach wrote:
> > > Am Donnerstag, 8. März 2012, 09:49:41 schrieb Andreas Pakulat:
> > > > On 08.03.12 09:35:51, Andreas Pakulat wrote:
> > > > > On 07.03.12 16:14:18, JPolk wrote:
> > > > > > ...'cause it would make it easier for me to merge Designer with
> > > > > > Maya ;-)>
> > > > >
> > > > > Write Maya in C++ ;P
> > > >
> > > > Hmm, on a more serious note, you won't get around writing C++. AFAIK
> > > > the public API of the QtDesigner library (and hence also the PyQt
> > > > module) does not include the necessary functions to actually create a
> > > > designer yourself. One needs to use one or two private headers from
> > > > QtDesigner for the necessary functions. You could of course simply wrap
> > > > that private API in a simple class and expose that via sip to Python
> > > > and then do all the rest in Python.
> > >
> > > If somebody would do that and maintain it over time I would be the first
> > > to use to integrate Designer into the eric IDE.
> >
> > Its not an easy task though, we had something somewhat-working for
> > KDevelop4 in a plugin, but it did require some nasty hacks and
> > workarounds the designer API. Its simply not really meant to be added to
> > "arbitrary" IDE's, but mainly geared towards the designer standalone
> > app.
> >
> > Note, I'm basing that information on Qt4.5/4.6, i.e. a point in time
> > where QtCreator was still in its early stages. Maybe in more recent
> > Qt versions this got improved to provide better integration for
> > QtCreator.
> 
> My humble guess is: it's easier to create a module, that resembles the main 
> designer functionality, than wrapping that biest,

Actually my PyQt4 already comes with a QtDesigner module and that looks
somewhat complete.

> given, that a lot of the necessary hacks are done to work around the
> inflexibility of C++ for that purpose.

The main hackery in C++ was getting a grip on the entry-point that the
QtDesigner module provides to instantiate all the various parts of it
(action-editor, property-editor, workspace area, widget-list, gui
actions). The other problem was more related to decisions done for
KDevelop, designer really requires all .ui files to be in the same
workspace widget. Working around this limitation was I believe a major
pain point in the KDevelop plugin before it was abandoned.

I'm not sure how much of designer's code works around C++ limitations.
Some things are more workarounds for the Qt widgets not being designed
for something like designer in the first place (i.e. there's a
wrapping-widget or even just look-a-like widget for the fancies Qt
widgets inside designers codebase).

Andreas



More information about the PyQt mailing list