combjs
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gui/droplist.cc Thu Jul 14 15:40:20 2011 +0300 1.3 @@ -0,0 +1,51 @@ 1.4 +#include <stdio.h> 1.5 +#include <QDragMoveEvent> 1.6 +#include "droplist.h" 1.7 + 1.8 +DropList::DropList(QWidget *parent) 1.9 + : QListWidget(parent) 1.10 +{ 1.11 + /*setDragEnabled(true); 1.12 + viewport()->setAcceptDrops(true); 1.13 + setDragDropMode(QAbstractItemView::DragDrop);*/ 1.14 +} 1.15 + 1.16 +void DropList::dragMoveEvent(QDragMoveEvent *ev) 1.17 +{ 1.18 + printf("%s\n", __func__); 1.19 + /*if(ev->source() == this) { 1.20 + ev->ignore(); 1.21 + return; 1.22 + }*/ 1.23 + 1.24 + /* check if duplicate and then ... */ 1.25 + ev->accept(); 1.26 +} 1.27 + 1.28 +void DropList::dragEnterEvent(QDragEnterEvent *ev) 1.29 +{ 1.30 + printf("%s\n", __func__); 1.31 + if(ev->source() == this) { 1.32 + ev->setDropAction(Qt::MoveAction); 1.33 + ev->accept(); 1.34 + } else { 1.35 + ev->acceptProposedAction(); 1.36 + } 1.37 +} 1.38 + 1.39 +void DropList::dropEvent(QDropEvent *ev) 1.40 +{ 1.41 + const QMimeData *mdata = ev->mimeData(); 1.42 + if(mdata->hasText()) { 1.43 + printf("%s: %s\n", __func__, mdata->text().toAscii().data()); 1.44 + } else { 1.45 + printf("%s\n", __func__); 1.46 + } 1.47 + 1.48 + if(ev->source() == this) { 1.49 + ev->setDropAction(Qt::MoveAction); 1.50 + ev->accept(); 1.51 + } else { 1.52 + ev->acceptProposedAction(); 1.53 + } 1.54 +}