combjs

view gui/droplist.cc @ 1:dd02002227a2

- added a few commandline arguments to combjs - trying to make a gui frontend
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 14 Jul 2011 15:40:20 +0300
parents
children
line source
1 #include <stdio.h>
2 #include <QDragMoveEvent>
3 #include "droplist.h"
5 DropList::DropList(QWidget *parent)
6 : QListWidget(parent)
7 {
8 /*setDragEnabled(true);
9 viewport()->setAcceptDrops(true);
10 setDragDropMode(QAbstractItemView::DragDrop);*/
11 }
13 void DropList::dragMoveEvent(QDragMoveEvent *ev)
14 {
15 printf("%s\n", __func__);
16 /*if(ev->source() == this) {
17 ev->ignore();
18 return;
19 }*/
21 /* check if duplicate and then ... */
22 ev->accept();
23 }
25 void DropList::dragEnterEvent(QDragEnterEvent *ev)
26 {
27 printf("%s\n", __func__);
28 if(ev->source() == this) {
29 ev->setDropAction(Qt::MoveAction);
30 ev->accept();
31 } else {
32 ev->acceptProposedAction();
33 }
34 }
36 void DropList::dropEvent(QDropEvent *ev)
37 {
38 const QMimeData *mdata = ev->mimeData();
39 if(mdata->hasText()) {
40 printf("%s: %s\n", __func__, mdata->text().toAscii().data());
41 } else {
42 printf("%s\n", __func__);
43 }
45 if(ev->source() == this) {
46 ev->setDropAction(Qt::MoveAction);
47 ev->accept();
48 } else {
49 ev->acceptProposedAction();
50 }
51 }