Skip to content
Permalink
Browse files

use layer items paramWidget() in browser properties

  • Loading branch information
blazek committed Sep 25, 2015
1 parent 228d816 commit 2ef38ff922d6f6b792dd8edcd91a256138ecebc9
Showing with 27 additions and 6 deletions.
  1. +24 −5 src/app/qgsbrowserdockwidget.cpp
  2. +3 −1 src/app/qgsbrowserdockwidget.h
@@ -281,18 +281,37 @@ QgsBrowserPropertiesWidget::QgsBrowserPropertiesWidget( QWidget* parent ) :
{
}

void QgsBrowserPropertiesWidget::setWidget( QWidget* paramWidget )
{
QVBoxLayout *layout = new QVBoxLayout( this );
paramWidget->setParent( this );
layout->addWidget( paramWidget );
}

QgsBrowserPropertiesWidget* QgsBrowserPropertiesWidget::createWidget( QgsDataItem* item, QWidget* parent )
{
QgsBrowserPropertiesWidget* propertiesWidget = 0;
if ( item->type() == QgsDataItem::Layer )
// In general, we would like to show all items' paramWidget, but top level items like
// WMS etc. have currently too large widgets which do not fit well to browser properties widget
if ( item->type() == QgsDataItem::Directory )
{
propertiesWidget = new QgsBrowserLayerProperties( parent );
propertiesWidget = new QgsBrowserDirectoryProperties( parent );
propertiesWidget->setItem( item );
}
else if ( item->type() == QgsDataItem::Directory )
else if ( item->type() == QgsDataItem::Layer )
{
propertiesWidget = new QgsBrowserDirectoryProperties( parent );
propertiesWidget->setItem( item );
// prefer item's widget over standard layer widget
QWidget *paramWidget = item->paramWidget();
if ( paramWidget )
{
propertiesWidget = new QgsBrowserPropertiesWidget( parent );
propertiesWidget->setWidget( paramWidget );
}
else
{
propertiesWidget = new QgsBrowserLayerProperties( parent );
propertiesWidget->setItem( item );
}
}
return propertiesWidget;
}
@@ -47,7 +47,9 @@ class QgsBrowserPropertiesWidget : public QWidget
public:
QgsBrowserPropertiesWidget( QWidget* parent = 0 );
static QgsBrowserPropertiesWidget* createWidget( QgsDataItem* item, QWidget* parent = 0 );
virtual void setItem( QgsDataItem* item ) = 0;
virtual void setItem( QgsDataItem* item ) { Q_UNUSED( item ) }
/** Set content widget, usually item paramWidget. Takes ownership. */
virtual void setWidget( QWidget* widget );

/** Sets whether the properties widget should display in condensed mode, ie, for display in a dock
* widget rather than it's own separate dialog.

0 comments on commit 2ef38ff

Please sign in to comment.
You can’t perform that action at this time.