20 #include <QDragEnterEvent>
22 #include <QMouseEvent>
32 setObjectName( name );
34 setAcceptDrops(
true );
35 leftButtonDown =
false;
42 if ( foundList.isEmpty() )
return false;
48 if ( evt->mimeData()->hasText() ) {
49 evt->acceptProposedAction();
57 if ( evt->mimeData()->hasText() ) {
58 evt->acceptProposedAction();
67 if ( evt->mimeData()->hasText() ) {
68 text = evt->mimeData()->text();
73 if ( !( text == i18n(
"Ignore" ) && QString(evt->source()->objectName()) ==
"FieldList" &&
74 evt->source() != this )) {
75 QListWidgetItem *lwi = itemAt( evt->pos() );
76 if ( lwi == 0 && evt->pos().y() > visualItemRect(item(count()-1)).bottom() ) {
79 int i = row( itemAt( evt->pos() ) );
80 insertItem( i, text );
87 if ( !( text == i18n(
"Ignore" ) && QString(evt->source()->objectName()) ==
"FieldPool" &&
88 evt->source() != this ) ) {
90 delete fp->takeItem( fp->currentRow() );
93 evt->acceptProposedAction();
98 QListWidget::mousePressEvent( evt );
100 if ( evt->button() == Qt::LeftButton ) {
101 leftButtonDown =
true;
106 QListWidget::mouseReleaseEvent( evt );
108 if ( evt->button() == Qt::LeftButton ) {
109 leftButtonDown =
false;
115 if ( leftButtonDown ) {
116 leftButtonDown =
false;
118 QDrag *drag =
new QDrag(
this );
119 QMimeData *mimeData =
new QMimeData;
120 mimeData->setText( currentItem()->text() );
121 drag->setMimeData( mimeData );
128 #include "draglistbox.moc"
bool contains(const QString &s) const
void dropEvent(QDropEvent *evt)
void mouseReleaseEvent(QMouseEvent *)
Extension of KListWidget that allows Drag-and-Drop with other DragListBoxes.
void dragMoveEvent(QDragMoveEvent *evt)
void mousePressEvent(QMouseEvent *evt)
DragListBox(QWidget *parent=0, const char *name=0)
Default constructor.
void mouseMoveEvent(QMouseEvent *)
void dragEnterEvent(QDragEnterEvent *evt)
~DragListBox()
Default destructor.