~ubuntu-branches/ubuntu/saucy/goldencheetah/saucy

« back to all changes in this revision

Viewing changes to src/IntervalTreeView.cpp

  • Committer: Package Import Robot
  • Author(s): KURASHIKI Satoru
  • Date: 2013-08-18 07:02:45 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130818070245-zgdvb47e1k3mtgil
Tags: 3.0-3
debian/control: remove needless dependency. (Closes: #719571)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2012 Damien Grauser (Damien.Grauser@pev-geneve.ch)
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the Free
 
6
 * Software Foundation; either version 2 of the License, or (at your option)
 
7
 * any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
12
 * more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc., 51
 
16
 * Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
#include "IntervalTreeView.h"
 
20
#include "IntervalItem.h"
 
21
#include "MainWindow.h"
 
22
 
 
23
 
 
24
IntervalTreeView::IntervalTreeView(MainWindow *mainWindow) : mainWindow(mainWindow)
 
25
{
 
26
    setDragDropMode(QAbstractItemView::InternalMove);
 
27
    setDragDropOverwriteMode(true);
 
28
    setDropIndicatorShown(true);
 
29
#ifdef Q_OS_MAC
 
30
    setAttribute(Qt::WA_MacShowFocusRect, 0);
 
31
#endif
 
32
    invisibleRootItem()->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
 
33
}
 
34
 
 
35
void
 
36
IntervalTreeView::dropEvent(QDropEvent* event)
 
37
{
 
38
    IntervalItem* item1 = (IntervalItem *)itemAt(event->pos());
 
39
    QTreeWidget::dropEvent(event);
 
40
    IntervalItem* item2 = (IntervalItem *)itemAt(event->pos());
 
41
 
 
42
    if (item1==topLevelItem(0) || item1 != item2)
 
43
        QTreeWidget::itemChanged(item2, 0);
 
44
}