Skip to content

Commit 7f21918

Browse files
committedJun 2, 2014
DnD forms: Make tabs scrollable
Fix #10389
1 parent 402c0dc commit 7f21918

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎src/core/qgsvectorlayer.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,21 @@ class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorElement
9797
{
9898
public:
9999
QgsAttributeEditorContainer( QString name, QObject *parent )
100-
: QgsAttributeEditorElement( AeTypeContainer, name, parent ) {}
100+
: QgsAttributeEditorElement( AeTypeContainer, name, parent )
101+
, mIsGroupBox( true )
102+
{}
101103

102104
~QgsAttributeEditorContainer() {}
103105

104106
virtual QDomElement toDomElement( QDomDocument& doc ) const;
105107
virtual void addChildElement( QgsAttributeEditorElement *widget );
106-
virtual bool isGroupBox() const { return true; }
108+
virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
109+
virtual bool isGroupBox() const { return mIsGroupBox; }
107110
QList<QgsAttributeEditorElement*> children() const { return mChildren; }
108111
virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
109112

110113
private:
114+
bool mIsGroupBox;
111115
QList<QgsAttributeEditorElement*> mChildren;
112116
};
113117

‎src/gui/qgsattributeform.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void QgsAttributeForm::init()
321321
QTabWidget* tabWidget = new QTabWidget( this );
322322
layout()->addWidget( tabWidget );
323323

324-
Q_FOREACH( const QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
324+
Q_FOREACH( QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
325325
{
326326
QWidget* tabPage = new QWidget( tabWidget );
327327

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

331331
if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer )
332332
{
333+
QgsAttributeEditorContainer* containerDef = dynamic_cast<QgsAttributeEditorContainer*>( widgDef );
334+
containerDef->setIsGroupBox( false ); // Toplevel widgets are tabs not groupboxes
333335
QString dummy1;
334336
bool dummy2;
335337
tabPageLayout->addWidget( createWidgetFromDef( widgDef, tabPage, mLayer, mContext, dummy1, dummy2 ) );

0 commit comments

Comments
 (0)
Please sign in to comment.