Module Expr Str Import alias Import alias Import alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults AttributeLoad AttributeLoad NameLoad attr attr body If UnaryOpNot Call AttributeLoad NameLoad attr body Return NameLoad Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Index Call AttributeLoad NameLoad attr If CompareEq NameLoad AttributeLoad AttributeLoad NameLoad attr attr body Return NameLoad orelse If CompareEq NameLoad AttributeLoad AttributeLoad NameLoad attr attr body Return Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call AttributeLoad NameLoad attr body Return BinOpBitOr BinOpBitOr BinOpBitOr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr orelse Return BinOpBitOr BinOpBitOr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str For NameStore NameLoad body If Call AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpAdd Str Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list FunctionDef arguments args defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Return ListComp TupleLoad SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num NameLoad comprehension NameStore NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad Num Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr If Call AttributeLoad Call AttributeLoad NameLoad attr attr Str body Expr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Print Call AttributeLoad NameLoad attr Str decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad Num Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad Num Num Num Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Num Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If Call AttributeLoad NameLoad attr body If CompareGtE BinOpSub Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num Call AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list decorator_list If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr
N/A N/A 
Custom QListView

This script demonstrates
 - DND item
 - DND item from window A to window B

Tested environment:
    Mac OS X 10.6.8

Docs

 - http://doc.qt.nokia.com/latest/model-view-programming.html#using-drag-and-drop-with-item-views

 - Qt - QAbstractItemView, PySide - QListView
 - Qt - QAbstractItemModel, PySide - QAbstractItemModel
 - PySide - QMimeData

 N/A glob N/A os N/A sys PyQt4 QtCore PyQt4 QtGui ListModel N/A N/A QtCore QAbstractListModel N/A __init__ N/A N/A self os_list N/A N/A N/A N/A N/A N/A super ListModel self __init__ N/A N/A self os_list os_list N/A rowCount N/A N/A self parent N/A N/A N/A N/A len N/A self os_list N/A data N/A N/A self index role N/A N/A N/A QtCore Qt DisplayRole N/A N/A N/A N/A N/A index isValid N/A N/A None N/A N/A os_name os_logo_path N/A N/A self os_list N/A N/A N/A index row N/A N/A role N/A N/A QtCore Qt DisplayRole N/A N/A os_name N/A N/A N/A role N/A N/A QtCore Qt DecorationRole N/A N/A N/A N/A QtGui QIcon os_logo_path N/A None N/A flags N/A N/A self idx N/A N/A N/A N/A N/A idx isValid N/A N/A N/A N/A N/A N/A N/A QtCore Qt ItemIsDragEnabled N/A N/A QtCore Qt ItemIsDropEnabled N/A N/A QtCore Qt ItemIsSelectable N/A N/A QtCore Qt ItemIsEnabled N/A N/A N/A N/A N/A N/A QtCore Qt ItemIsDropEnabled N/A N/A QtCore Qt ItemIsSelectable N/A N/A QtCore Qt ItemIsEnabled N/A supportedDropActions N/A N/A self N/A N/A N/A N/A N/A QtCore Qt MoveAction N/A mimeData N/A N/A self idxes N/A N/A N/A N/A N/A N/A super ListModel self mimeData idxes N/A mime_data N/A N/A QtCore QMimeData N/A encoded_data N/A idx idxes N/A N/A N/A N/A idx isValid N/A N/A encoded_data N/A N/A N/A self data idx role N/A N/A QtCore Qt DisplayRole N/A N/A N/A mime_data setData text/plain encoded_data N/A mime_data N/A N/A ListView N/A N/A QtGui QListView N/A __init__ N/A N/A self parent N/A None N/A N/A N/A N/A N/A super ListView self __init__ parent N/A N/A self data_sources N/A create_data_source N/A list_model N/A ListModel N/A self data_sources N/A N/A N/A self setModel list_model N/A N/A N/A self setIconSize N/A N/A QtCore QSize 50 50 N/A N/A N/A self setSpacing 5 N/A N/A N/A self setUniformItemSizes True N/A N/A N/A self setDropIndicatorShown True N/A N/A N/A self setMovement N/A N/A QtGui QListView Free N/A N/A N/A self setSelectionMode N/A N/A QtGui QAbstractItemView ExtendedSelection N/A N/A N/A self setDragEnabled True N/A N/A N/A self setAcceptDrops True N/A N/A create_data_source N/A N/A N/A N/A N/A logos N/A N/A glob glob *.png N/A N/A N/A N/A N/A N/A N/A os path splitext i N/A 0 i N/A i logos N/A ChatWin N/A N/A QtGui QWidget N/A __init__ N/A N/A self parent N/A None N/A N/A N/A N/A N/A super ChatWin self __init__ N/A N/A self demo parent N/A N/A x y w h N/A 200 200 300 400 N/A N/A N/A self setGeometry x y w h N/A N/A N/A self setAcceptDrops True N/A show_and_raise N/A N/A self N/A N/A N/A N/A N/A self show N/A N/A N/A self raise_ N/A dragEnterEvent N/A N/A self evt N/A N/A N/A N/A N/A evt accept N/A N/A N/A N/A N/A evt mimeData hasFormat text/plain N/A N/A N/A N/A evt accept N/A N/A N/A N/A evt ignore N/A dropEvent N/A N/A self evt N/A N/A N/A N/A N/A evt accept N/A mime_data N/A N/A evt mimeData N/A N/A N/A mime_data data text/plain N/A N/A Demo N/A N/A QtGui QWidget N/A __init__ N/A N/A self N/A N/A N/A N/A N/A N/A super Demo self __init__ N/A N/A x y w h N/A 500 200 300 400 N/A N/A N/A self setGeometry x y w h N/A N/A self list_view N/A ListView self N/A N/A x y w h N/A 5 5 290 250 N/A N/A N/A N/A self list_view setGeometry x y w h N/A N/A self lineedit N/A N/A QtGui QLineEdit self N/A N/A N/A N/A self lineedit move 5 260 N/A N/A N/A N/A N/A self lineedit textEdited connect N/A self _lineedit_textEdited N/A N/A self chat_win N/A ChatWin self N/A N/A N/A N/A self chat_win show_and_raise N/A _lineedit_textEdited N/A N/A self text N/A N/A N/A N/A text N/A N/A N/A N/A N/A self list_view clearSelection N/A N/A N/A N/A N/A self list_view keyboardSearch text N/A idx N/A N/A N/A self list_view currentIndex N/A N/A N/A idx isValid N/A N/A N/A N/A N/A len N/A N/A self list_view data_sources 1 N/A N/A idx row N/A N/A N/A N/A N/A N/A self list_view data_sources pop N/A N/A idx row N/A N/A N/A N/A self list_view update N/A show_and_raise N/A N/A self N/A N/A N/A N/A N/A self show N/A N/A N/A self raise_ N/A N/A N/A N/A __name__ __main__ N/A N/A app N/A N/A QtGui QApplication N/A sys argv N/A demo N/A Demo N/A N/A N/A demo show_and_raise N/A N/A N/A sys exit N/A N/A app exec_