Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DnD forms: Make tabs scrollable
Fix #10389
  • Loading branch information
m-kuhn committed Jun 2, 2014
1 parent 402c0dc commit 7f21918
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/core/qgsvectorlayer.h
Expand Up @@ -97,17 +97,21 @@ class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorElement
{
public:
QgsAttributeEditorContainer( QString name, QObject *parent )
: QgsAttributeEditorElement( AeTypeContainer, name, parent ) {}
: QgsAttributeEditorElement( AeTypeContainer, name, parent )
, mIsGroupBox( true )
{}

~QgsAttributeEditorContainer() {}

virtual QDomElement toDomElement( QDomDocument& doc ) const;
virtual void addChildElement( QgsAttributeEditorElement *widget );
virtual bool isGroupBox() const { return true; }
virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
virtual bool isGroupBox() const { return mIsGroupBox; }
QList<QgsAttributeEditorElement*> children() const { return mChildren; }
virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;

private:
bool mIsGroupBox;
QList<QgsAttributeEditorElement*> mChildren;
};

Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsattributeform.cpp
Expand Up @@ -321,7 +321,7 @@ void QgsAttributeForm::init()
QTabWidget* tabWidget = new QTabWidget( this );
layout()->addWidget( tabWidget );

Q_FOREACH( const QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
Q_FOREACH( QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
{
QWidget* tabPage = new QWidget( tabWidget );

Expand All @@ -330,6 +330,8 @@ void QgsAttributeForm::init()

if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer )
{
QgsAttributeEditorContainer* containerDef = dynamic_cast<QgsAttributeEditorContainer*>( widgDef );
containerDef->setIsGroupBox( false ); // Toplevel widgets are tabs not groupboxes
QString dummy1;
bool dummy2;
tabPageLayout->addWidget( createWidgetFromDef( widgDef, tabPage, mLayer, mContext, dummy1, dummy2 ) );
Expand Down

0 comments on commit 7f21918

Please sign in to comment.