Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Browser: do not show header in tree view
  • Loading branch information
wonder-sk committed Aug 17, 2011
1 parent a29b49f commit 42418b1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
39 changes: 20 additions & 19 deletions src/app/qgsbrowserdockwidget.cpp
Expand Up @@ -22,26 +22,27 @@ items on the tree view although the drop is actually managed by qgis app.
*/
class QgsBrowserTreeView : public QTreeView
{
public:
QgsBrowserTreeView( QWidget* parent ) : QTreeView(parent)
{
setDragDropMode( QTreeView::DragDrop ); // sets also acceptDrops + dragEnabled
setSelectionMode( QAbstractItemView::ExtendedSelection );
setContextMenuPolicy( Qt::CustomContextMenu );
}
public:
QgsBrowserTreeView( QWidget* parent ) : QTreeView( parent )
{
setDragDropMode( QTreeView::DragDrop ); // sets also acceptDrops + dragEnabled
setSelectionMode( QAbstractItemView::ExtendedSelection );
setContextMenuPolicy( Qt::CustomContextMenu );
setHeaderHidden( true );
}

void dragEnterEvent(QDragEnterEvent* e)
{
// accept drag enter so that our widget will not get ignored
// and drag events will not get passed to QgisApp
e->accept();
}
void dragMoveEvent(QDragMoveEvent* e)
{
// ignore all possibilities where an item could be dropped
// because we want that user drops the item on canvas / legend / app
e->ignore();
}
void dragEnterEvent( QDragEnterEvent* e )
{
// accept drag enter so that our widget will not get ignored
// and drag events will not get passed to QgisApp
e->accept();
}
void dragMoveEvent( QDragMoveEvent* e )
{
// ignore all possibilities where an item could be dropped
// because we want that user drops the item on canvas / legend / app
e->ignore();
}
};

QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
Expand Down
7 changes: 5 additions & 2 deletions src/browser/qgsbrowserbase.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>471</height>
<width>712</width>
<height>469</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -51,6 +51,9 @@
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
Expand Down

0 comments on commit 42418b1

Please sign in to comment.