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

kopete/kopete

  • sources
  • kde-4.12
  • kdenetwork
  • kopete
  • kopete
  • config
  • status
statustreeview.h
Go to the documentation of this file.
1 /*
2  statustreeview.h
3 
4  Copyright (c) 2008 by Roman Jarosz <kedgedev@centrum.cz>
5  Kopete (c) 2008 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 
17 #ifndef STATUSTREEVIEW_H
18 #define STATUSTREEVIEW_H
19 
20 #include <QtGui/QTreeView>
21 #include <QtGui/QDrag>
22 
23 class StatusTreeView : public QTreeView
24 {
25 public:
26  StatusTreeView( QWidget * parent = 0 ) : QTreeView( parent ) {}
27 
28 protected:
29  // FIXME: is there an easier way to set default action of QDrag to Qt::MoveAction
30  virtual void startDrag( Qt::DropActions supportedActions )
31  {
32  QModelIndexList indexes = selectedIndexes();
33  if ( indexes.count() > 0 )
34  {
35  QMimeData *data = model()->mimeData( indexes );
36  if ( !data )
37  return;
38 
39  QDrag *drag = new QDrag( this );
40  drag->setMimeData( data );
41  if ( drag->exec( supportedActions, Qt::MoveAction ) == Qt::MoveAction )
42  {
43  const QItemSelection selection = selectionModel()->selection();
44  QList<QItemSelectionRange>::const_iterator it = selection.begin();
45 
46  for ( ; it != selection.end(); ++it )
47  {
48  QModelIndex parent = (*it).parent();
49  if ( (*it).left() != 0 )
50  continue;
51  if ( (*it).right() != ( model()->columnCount(parent) - 1 ) )
52  continue;
53  int count = (*it).bottom() - (*it).top() + 1;
54  model()->removeRows( (*it).top(), count, parent );
55  }
56  }
57  }
58  }
59 };
60 
61 #endif
QWidget
QTreeView
StatusTreeView::StatusTreeView
StatusTreeView(QWidget *parent=0)
Definition: statustreeview.h:26
StatusTreeView
Definition: statustreeview.h:23
StatusTreeView::startDrag
virtual void startDrag(Qt::DropActions supportedActions)
Definition: statustreeview.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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