Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
scrollarea.cpp
Go to the documentation of this file.
1 #include <QDebug>
2 #include <QDropEvent>
3 #include <QMimeData>
4 
5 #include "scrollarea.h"
6 
7 ScrollArea::ScrollArea( QWidget *parent ) : QScrollArea( parent ) {
8 }
9 
10 void ScrollArea::dragEnterEvent( QDragEnterEvent *event ) {
11  qDebug( ) << "enter event: " << event;
12  event->accept( );
13 }
14 
15 void ScrollArea::dragMoveEvent( QDragMoveEvent *event ) {
16  Q_UNUSED( event )
17  /* qDebug() << "move event: " << event; */
18 }
19 
20 void ScrollArea::dragLeaveEvent( QDragLeaveEvent *event ) {
21  Q_UNUSED( event )
22  /* qDebug() << "leave event: " << event; */
23 }
24 
25 void ScrollArea::dropEvent( QDropEvent *event ) {
26  qDebug( ) << "drop event: " << event;
27  /*
28  * if (event->mimeData()->hasImage()) {
29  * emit pixmap(QPixmap::fromImage(qvariant_cast<QImage>(event->mimeData()->imageData())));
30  * }
31  */
32  if( event->mimeData( )->hasText( ) ) {
33  emit item( event->mimeData( )->text( ) );
34  }
35 }
virtual void dropEvent(QDropEvent *event) override
Definition: scrollarea.cpp:25
void item(const QString &text)
virtual void dragLeaveEvent(QDragLeaveEvent *event) override
Definition: scrollarea.cpp:20
virtual void dragMoveEvent(QDragMoveEvent *event) override
Definition: scrollarea.cpp:15
virtual void dragEnterEvent(QDragEnterEvent *event) override
Definition: scrollarea.cpp:10
ScrollArea(QWidget *parent=0)
Definition: scrollarea.cpp:7