X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtgui%2Fbufferview.cpp;h=0fae80d62c0af90dc65a452b6e844ad5340eebe2;hp=33eab930e7e14edddc0a970906febaec140830a3;hb=a5c0b0735d9a448be2556dfe5dc8e89bb4176cd7;hpb=ec07b6300b6b3b125127ad2d7cd42fabeb020b1b diff --git a/src/qtgui/bufferview.cpp b/src/qtgui/bufferview.cpp index 33eab930..0fae80d6 100644 --- a/src/qtgui/bufferview.cpp +++ b/src/qtgui/bufferview.cpp @@ -30,7 +30,7 @@ BufferView::BufferView(QWidget *parent) : QTreeView(parent) { void BufferView::init() { setIndentation(10); - //header()->hide(); + header()->hide(); header()->hideSection(1); expandAll(); @@ -47,7 +47,10 @@ void BufferView::init() { connect(this, SIGNAL(doubleClicked(const QModelIndex &)), model(), SLOT(doubleClickReceived(const QModelIndex &))); - connect(model(), SIGNAL(updateSelection(const QModelIndex &, QItemSelectionModel::SelectionFlags)), + connect(model(), SIGNAL(selectionChanged(const QModelIndex &)), + this, SLOT(select(const QModelIndex &))); + + connect(this, SIGNAL(selectionChanged(const QModelIndex &, QItemSelectionModel::SelectionFlags)), selectionModel(), SLOT(select(const QModelIndex &, QItemSelectionModel::SelectionFlags))); } @@ -55,8 +58,9 @@ void BufferView::init() { void BufferView::setFilteredModel(QAbstractItemModel *model, BufferViewFilter::Modes mode, QStringList nets) { BufferViewFilter *filter = new BufferViewFilter(model, mode, nets); setModel(filter); - connect(this, SIGNAL(dragEnter()), filter, SLOT(enterDrag())); - connect(this, SIGNAL(dragLeave()), filter, SLOT(leaveDrag())); + connect(this, SIGNAL(eventDropped(QDropEvent *)), filter, SLOT(dropEvent(QDropEvent *))); + //connect(this, SIGNAL(dragEnter()), filter, SLOT(enterDrag())); + //connect(this, SIGNAL(dragLeave()), filter, SLOT(leaveDrag())); } void BufferView::setModel(QAbstractItemModel *model) { @@ -64,6 +68,23 @@ void BufferView::setModel(QAbstractItemModel *model) { init(); } +void BufferView::select(const QModelIndex ¤t) { + emit selectionChanged(current, QItemSelectionModel::ClearAndSelect); +} + +void BufferView::dropEvent(QDropEvent *event) { + if(event->source() == this) { + // this is either a merge or a sort operation... + // currently only merges are supported + } else { + emit eventDropped(event); + } + QTreeView::dropEvent(event); + +} + +/* + done prettier now.. // dragEnterEvent and dragLeaveEvent are needed to keep track of the active // view when customizing them via drag and drop void BufferView::dragEnterEvent(QDragEnterEvent *event) { @@ -75,6 +96,7 @@ void BufferView::dragLeaveEvent(QDragLeaveEvent *event) { emit dragLeave(); QTreeView::dragLeaveEvent(event); } +*/ // ensure that newly inserted network nodes are expanded per default void BufferView::rowsInserted(const QModelIndex & parent, int start, int end) {