-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfsview.cpp
More file actions
39 lines (35 loc) · 1.04 KB
/
fsview.cpp
File metadata and controls
39 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "fsview.h"
void FSView::init()
{
this->setIndentation(0);
this->setSelectionBehavior (QAbstractItemView::SelectRows);
this->setSortingEnabled(true);
this->sortByColumn(0, Qt::AscendingOrder);
this->setItemsExpandable(false);
this->hideColumn(1);
this->hideColumn(2);
this->hideColumn(3);
this->setUniformRowHeights(true);
this->setExpandsOnDoubleClick(false);
this->setAutoScroll(true);
}
void FSView::mousePressEvent(QMouseEvent *event)
{
QModelIndex index = indexAt(event->pos());
QTreeView::mousePressEvent(event);
if(index.row() == -1 && index.column() == -1){
clearSelection();
QModelIndex newIndex;
selectionModel()->setCurrentIndex(newIndex, QItemSelectionModel::Select);
emit selectionClearedSignal();
}
}
void FSView::dragEnterEvent(QDragEnterEvent *event){
//FSView::setDragDropOverwriteMode(true);
event->acceptProposedAction();
}
void FSView::dropEvent(QDropEvent *e)
{
e->setDropAction(Qt::MoveAction);
QTreeView::dropEvent(e);
}