That turned out easier than I thought. Just register the class to the QUiLoader instance with registerCustomWidget.
Big thanks for the help, that saved my day (week)! http://www.pyside.org/docs/pyside/PySide/QtUiTools/QUiLoader.html#PySide.QtUiTools.PySide.QtUiTools.QUiLoader.registerCustomWidget On Thu, Dec 22, 2011 at 8:34 AM, Nathan Smith <nathanjsm...@gmail.com>wrote: > I always use uic, so I don't know. Perhaps someone else on the list knows. > > Nathan > On Dec 21, 2011 6:24 PM, "Åke Kullenberg" <ake.kullenb...@gmail.com> > wrote: > >> Thanks for this. I got it to work if I use pyside-uic. But if I try to >> load the ui file in the script with a QUiLoader, I get this line: >> >> "QFormBuilder was unable to create a custom widget of the class >> 'mycustom'; defaulting to base class 'QToolButton'." >> >> Is there any way to fix that? >> >> On Thu, Dec 22, 2011 at 12:04 AM, Nathan Smith <nathanjsm...@gmail.com>wrote: >> >>> Åke, >>> >>> There used to be a QtDesigner plugin for PySide, but I don't think it >>> ever worked. Fortunately, you can still use Designer even without the >>> plugin by using the "promotion" system. Say, for example, you've created >>> MyLineEdit, a QLineEdit subclass. >>> >>> 1. In Designer, drop a QLineEdit on the form where you'd like your >>> MyLineEdit to go >>> 2. Right click on the QLineEdit widget you added to the form and >>> select "Promote to...". >>> 3. In "Promoted class name:", enter MyLineEdit. >>> 4. In "Header file", enter package/path/to/MyLineEdit.h, where >>> package/path/to is the Python package path to the .py file that contains >>> the MyLineEdit widget class. pyside-uic converts this into "from >>> package.path.to import MyLineEdit" >>> 5. Click "Add" >>> 6. Click "Promote" >>> >>> The next time you add a QLineEdit to the form, you can use the promotion >>> you've already defined, so you don't have to go through these steps for >>> each widget. The downside to this approach is that you don't have access >>> to the widget's custom properties like you would through a plugin. >>> >>> Good luck! >>> >>> Nathan >>> >>> On Wed, Dec 21, 2011 at 4:46 AM, Åke Kullenberg < >>> ake.kullenb...@gmail.com> wrote: >>> >>>> AFAIK there is no way to import custom pyside widgets in QtDesigner. Is >>>> there any particular reason for this? This is a huge shame, QtDesigner is a >>>> major time saver in terms of producing straightforward ui components such >>>> as dialogs. Other python gui frameworks really don't have anything like it >>>> to offer either, so it's definitely a big competitive advantage for >>>> pyside/qt. However If I can't use custom pyside widgets QtDesigner is a lot >>>> less useful IMHO. >>>> _______________________________________________ >>>> PySide mailing list >>>> PySide@lists.pyside.org >>>> http://lists.pyside.org/listinfo/pyside >>>> >>>> >>> >>
_______________________________________________ PySide mailing list PySide@lists.pyside.org http://lists.pyside.org/listinfo/pyside