How to drop a custom QStandardItem into a QListView

It looks like you want setItemPrototype. This provides an item factory for the model, so that it will implicitly use your custom class whenever necessary. All you need to do is reimplement clone() in your item class: class MyItem(QtGui.QStandardItem): ”’This is the item I’d like to drop into the view”’ def __init__(self, parent=None): super(MyItem, self).__init__(parent) … Read more

Why does PySide implicitely create object members from class members for Signals?

They are not copies. If you check the type of those, you’ll see that the class attribute is PySide.QtCore.Signal and the instance attribute is PySide.QtCore.SignalInstance. print “type(obj1.sig): {}”.format(type(obj1.sig)) print “type(obj2.sig): {}”.format(type(obj2.sig)) print “type(Klass.sig): {}”.format(type(Klass.sig)) # type(obj1.sig): <type ‘PySide.QtCore.SignalInstance’> # type(obj2.sig): <type ‘PySide.QtCore.SignalInstance’> # type(Klass.sig): <type ‘PySide.QtCore.Signal’> This is necessary because of the way Qt defines … Read more

Why python executable opens new window instance when function by multiprocessing module is called on windows

If you want to use multiprocessing as a frozen executable, you need to call multiprocessing.freeze_support() at the beginning of your main script. This will allow multiprocessing to “take over” when it spawns its worker processes. See also https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Multiprocessing

How do i resize the contents of a QScrollArea as more widgets are placed inside

If you’re coming here from Google and not having luck with the accepted answer, that’s because you’re missing the other secret invocation: QScrollArea::setWidget. You must create and explicitly identify a single widget which is to be scrolled. It’s not enough to just add the item as a child! Adding multiple items directly to the ScrollArea … Read more

How do I load children from .ui file in PySide?

UPDATE: The original solution below was written for PySide (Qt4). It still works with both PySide2 (Qt5) and PySide6 (Qt6), but with a couple of provisos: The connectSlotsByName feature requires that the corresponding slots are decorated with an appropriate QtCore.Slot. Custom/Promoted widgets aren’t handled automatically. The required classes must be explicily imported and registered with … Read more