• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • plugins
  • summary
dropwidget.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDE Kontact.
3 
4  Copyright (C) 2004 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "dropwidget.h"
23 
24 #include <QDragEnterEvent>
25 #include <QDropEvent>
26 
27 DropWidget::DropWidget( QWidget *parent )
28  : QWidget( parent )
29 {
30  setAcceptDrops( true );
31 }
32 
33 void DropWidget::dragEnterEvent( QDragEnterEvent *event )
34 {
35  if ( event->mimeData()->hasFormat( QLatin1String("application/x-kontact-summary") ) ) {
36  event->acceptProposedAction();
37  }
38 }
39 
40 void DropWidget::dropEvent( QDropEvent *event )
41 {
42  int alignment = ( event->pos().x() < ( width() / 2 ) ? Qt::AlignLeft : Qt::AlignRight );
43  alignment |= ( event->pos().y() < ( height() / 2 ) ? Qt::AlignTop : Qt::AlignBottom );
44  emit summaryWidgetDropped( this, event->source(), alignment );
45 }
46 
QDropEvent::source
QWidget * source() const
QWidget
QDropEvent::mimeData
const QMimeData * mimeData() const
QMimeData::hasFormat
virtual bool hasFormat(const QString &mimeType) const
QWidget::width
int width() const
DropWidget::dropEvent
void dropEvent(QDropEvent *)
Definition: dropwidget.cpp:40
QDropEvent
DropWidget::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *)
Definition: dropwidget.cpp:33
QWidget::setAcceptDrops
void setAcceptDrops(bool on)
QDragEnterEvent
QLatin1String
DropWidget::DropWidget
DropWidget(QWidget *parent)
Definition: dropwidget.cpp:27
dropwidget.h
DropWidget::summaryWidgetDropped
void summaryWidgetDropped(QWidget *target, QWidget *widget, int alignment)
QWidget::height
int height() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal