[PyQt] Using drag+drop in a QComboBox

Andreas Pakulat apaku at gmx.de
Tue Oct 30 18:29:46 GMT 2012


On Tue, Oct 30, 2012 at 5:50 PM, Chris Beaumont <beaumont at hawaii.edu> wrote:
> I'm having some trouble getting drag+drop to work properly within a
> QComboBox widget. I've posted to SO:
> http://stackoverflow.com/questions/13141143/pyqt4-items-disappear-when-using-drag-and-drop-with-qcombobox
> I thought I'd try here as well. In short, I want to be able to rearrange
> entries in a QComboBox with the mouse, but
> the dragged items keep disappearing instead of moving. My code is pasted
> below. Is there anything obviously wrong here?

Personally I'd say you're simply using the wrong widget. A combobox is
for most people a small widget that allows to select an entry from a
list by having a popup opened and closed automatically. In particular
I wouldn't be surprised if dragging an item off the open popup would
immediately close it on some platforms. Not to mention that such a
behaviour in a combobox is surprising and not very discoverable for
most users since its not something thats commonly used.

So can you explain why you need the items to be re-arrangable inside a combobox?


More information about the PyQt mailing list