Skip to content
Permalink
Browse files

Don't show scrollbars when embedding a feature form

  • Loading branch information
m-kuhn committed Jun 6, 2016
1 parent bad0d3e commit c61daf881dc236d5040cc4f9f08dcbb3257f651f
@@ -47,6 +47,7 @@ QgsDualView::QgsDualView( QWidget* parent )
, mLayerCache( nullptr )
, mProgressDlg( nullptr )
, mFeatureSelectionManager( nullptr )
, mAttributeEditorScrollArea( nullptr )
{
setupUi( this );

@@ -83,10 +84,17 @@ void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const Qg
mTableView->setModel( mFilterModel );
mFeatureList->setModel( mFeatureListModel );
mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext );
if ( !mAttributeEditorScrollArea->layout() )
mAttributeEditorScrollArea->setLayout( new QGridLayout() );
mAttributeEditorScrollArea->layout()->addWidget( mAttributeForm );
mAttributeEditorScrollArea->setWidget( mAttributeForm );
if ( !context.parentContext() )
{
mAttributeEditorScrollArea = new QScrollArea();
mAttributeEditorScrollArea->setWidgetResizable( true );
mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea );
mAttributeEditorScrollArea->setWidget( mAttributeForm );
}
else
{
mAttributeEditor->layout()->addWidget( mAttributeForm );
}

mAttributeForm->hideButtonBox();

@@ -31,6 +31,7 @@ class QgsAttributeForm;
class QgsFeatureRequest;
class QSignalMapper;
class QgsMapLayerAction;
class QScrollArea;

/**
* This widget is used to show the attributes of a set of features of a {@link QgsVectorLayer}.
@@ -333,6 +334,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
QgsDistanceArea mDistanceArea;
QString mDisplayExpression;
QgsAttributeTableConfig mConfig;
QScrollArea* mAttributeEditorScrollArea;

friend class TestQgsDualView;
};
@@ -1137,15 +1137,21 @@ void QgsAttributeForm::init()
QGridLayout* gridLayout = new QGridLayout( formWidget );
formWidget->setLayout( gridLayout );

// put the form into a scroll area to nicely handle cases with lots of attributes

QScrollArea* scrollArea = new QScrollArea( this );
scrollArea->setWidget( formWidget );
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
scrollArea->setFrameShadow( QFrame::Plain );
scrollArea->setFocusProxy( this );
layout->addWidget( scrollArea );
if ( mContext.formMode() != QgsAttributeEditorContext::Embed )
{
// put the form into a scroll area to nicely handle cases with lots of attributes
QScrollArea* scrollArea = new QScrollArea( this );
scrollArea->setWidget( formWidget );
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
scrollArea->setFrameShadow( QFrame::Plain );
scrollArea->setFocusProxy( this );
layout->addWidget( scrollArea );
}
else
{
layout->addWidget( formWidget );
}

int row = 0;
Q_FOREACH ( const QgsField& field, mLayer->fields().toList() )
@@ -148,24 +148,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="mAttributeEditorScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="mAttributeEditorLayout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>229</width>
<height>503</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4"/>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>

3 comments on commit c61daf8

@nyalldawson

This comment has been minimized.

Copy link
Contributor

@nyalldawson nyalldawson replied Jun 7, 2016

@m-kuhn what's the rationale behind this change? Having it in a scroll area worked nicely for the new search mode

@nyalldawson

This comment has been minimized.

Copy link
Contributor

@nyalldawson nyalldawson replied Jun 7, 2016

@m-kuhn I think it's also caused a regression with long forms in the identify results pop ups in that the form now can be taller than the screen

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Jun 7, 2016

The idea is that the scrollbar should always be on the topmost widget and not having many embedded scrollbars.
E.g. relation editors were always the same size with scrollbars and often too small.

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