[PyQt] Drag and Drop when using designer
Andreas Pakulat
apaku at gmx.de
Thu Oct 25 10:06:33 BST 2007
On 25.10.07 04:22:39, Nahuel Defossé wrote:
> Hi!
>
> I've made all my gui with designer. I have some List Views there that need
> drag and drop funcitonality so I need to add them some methods to handle the
> drop events properly, and set the accept drops to True... but I can't add
> those methods with setattr, they don't work, it seems I have to subclass the
> List Views.
I'm not sure if thats really needed, never created itemviews that can do
drag and drop. The puzzle example indicates however that you don't need
to change the listviews, only the underlying model which needs to
provide mimeData and dropMimeData and probably also mimeTypes. Then you
just need to enable the drag/drop on the listviews by setting their dnd
properties to true.
> Is there any way to get the drop thing without altering the set up that
> setupUi method does?
You should never try to alter the generated code. If a subclass is
really needed you should create a new widget class and use the promoting
feature to have code generated that uses your new widget. See the
designer documentation for how that works.
Andreas
--
Future looks spotty. You will spill soup in late evening.
More information about the PyQt
mailing list