kontact
dropwidget.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "dropwidget.h"
00023
00024 #include <QDragEnterEvent>
00025 #include <QDropEvent>
00026
00027 DropWidget::DropWidget( QWidget *parent )
00028 : QWidget( parent )
00029 {
00030 setAcceptDrops( true );
00031 }
00032
00033 void DropWidget::dragEnterEvent( QDragEnterEvent *event )
00034 {
00035 if ( event->mimeData()->hasFormat( "application/x-kontact-summary" ) ) {
00036 event->acceptProposedAction();
00037 }
00038 }
00039
00040 void DropWidget::dropEvent( QDropEvent *event )
00041 {
00042 int alignment = ( event->pos().x() < ( width() / 2 ) ? Qt::AlignLeft : Qt::AlignRight );
00043 alignment |= ( event->pos().y() < ( height() / 2 ) ? Qt::AlignTop : Qt::AlignBottom );
00044 emit summaryWidgetDropped( this, event->source(), alignment );
00045 }
00046
00047 #include "dropwidget.moc"