Hi Phil, attached is an implementation of QWidgetFactory based on the PyQt snapshot from 25.01. Since it's my first PyQt module, it would be nice, if you take a look over it, especially into the sip files. Any Transfer* magic missing? The win parts of quimod.sip are definitely wrong, but I don't know better, yet.
At least, QWidgetFactory.create("some.ui") seems to work fine on linux. I've kept your copyright, but added myself to it. I hope, this is fine with you. Pete
--- build.py.orig 2003-01-26 02:03:04.000000000 +0100 +++ build.py 2003-01-30 17:58:49.000000000 +0100 @@ -345,19 +345,20 @@ TARGET = qttest CONFIG = qt @TEST_OPENGL@ console warn_off release @BL_THREAD@ INCLUDEPATH = . @BL_INCLUDEPATH@ DEFINES = @BL_DEFINES@ SOURCES = qttest.cpp -LIBS += @TEST_SCILIBDIR@ +LIBS += @TEST_SCILIBDIR@ @TEST_QUILIBDIR@ win32:LIBS += @BL_PYLIB@ """) - # Disable OpenGL and QScintilla support by default. + # Disable OpenGL, QScintilla and Qui support by default. global proPatches proPatches["TOPENGL"] = [re.compile("@TEST_OPENGL@",re.M), ""] proPatches["TSCILIBDIR"] = [re.compile("@TEST_SCILIBDIR@",re.M), ""] + proPatches["TQUILIBDIR"] = [re.compile("@TEST_QUILIBDIR@",re.M), ""] # Create a dummy source file to suppress a qmake warning. copyToFile("qttest.cpp","") buildMakefile("qttest.pro") @@ -978,10 +979,22 @@ # Put things back. proPatches["TSCILIBDIR"] = [re.compile("@TEST_SCILIBDIR@",re.M), ""] buildMakefile("qttest.pro") + if qtVersion >= 0x030000: + quilib = "" + if sys.platform == "win32": + quilib = "qui.lib" + else: + quilib = "-lqui" + proPatches["TQUILIBDIR"] = [re.compile("@TEST_QUILIBDIR@",re.M), quilib] + buildMakefile("qttest.pro") + tryModule("qui", "qwidgetfactory.h", "QWidgetFactory()") + # Put things back. + proPatches["TQUILIBDIR"] = [re.compile("@TEST_QUILIBDIR@",re.M), ""] + buildMakefile("qttest.pro") def generateFeatures(featfile): """Generate the header file describing the Qt features that are enabled if it doesn't already exist. (If it already exists then we are probably cross
// This is the SIP interface definition for the qui module of PyQt. // // Copyright (c) 2003 // Hans-Peter Jansen <[EMAIL PROTECTED]> // Riverbank Computing Limited <[EMAIL PROTECTED]> // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2, or (at your option) any later // version. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %Module qui 0 %Import qtmod.sip %Include copying.sip %Include qwidgetfactory.sip // The project file template. %Makefile qui.pro # The project file for the qui module. # # Copyright (c) 2003 # Riverbank Computing Limited <[EMAIL PROTECTED]> # # This file is part of PyQt. # # This copy of PyQt is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2, or (at your option) any later # version. # # PyQt is supplied in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # PyQt; see the file LICENSE. If not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TEMPLATE = lib TARGET = @BL_TARGET@ DESTDIR = @BL_DESTDIR@ CONFIG += qt warn_off @BL_DEBUG@ @BL_SIP@ @BL_DLL@ @BL_THREAD@ INCLUDEPATH = . ../qt @BL_INCLUDEPATH@ DEFINES = SIP_MAKE_MODULE_DLL @BL_DEFINES@ sip3:unix:LIBS += -L@BL_DESTDIR@ -lqtcmodule -L@BL_SIPMODDIR@ -lsip -lqui sip3:win32:LIBS += @BL_DESTDIR@\libqtc.lib @BL_SIPMODDIR@\libsip.lib @BL_PYLIB@ @BL_QUILIBDIR@\qui.lib sip4:unix:LIBS += -lqui sip4:win32:LIBS += @BL_PYLIB@ @BL_QUILIBDIR@\qui.lib SOURCES = \ $B HEADERS = \ $H %End
// This is the SIP interface definition for QWidgetFactory. // // Copyright (c) 2003 // Hans-Peter Jansen <[EMAIL PROTECTED]> // Riverbank Computing Limited <[EMAIL PROTECTED]> // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2, or (at your option) any later // version. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %ExportedDoc <Sect2><Title>QWidgetFactory (Qt v3+)</Title> <Para> <Literal>QWidgetFactory</Literal> is fully implemented. </Para> </Sect2> %End %If (Qt_3_0_0 -) class QWidgetFactory { %HeaderCode #include <qwidgetfactory.h> %End public: QWidgetFactory(); static QWidget *create(const QString &, QObject * = 0, QWidget * = 0, const char * = 0); static QWidget *create(QIODevice *, QObject * = 0, QWidget * = 0, const char * = 0); static void addWidgetFactory(QWidgetFactory * /Transfer/); static void loadImages(const QString &); virtual QWidget *createWidget(const QString &, QWidget *, const char *) const; }; %End