Skip to content
Permalink
Browse files

Use a vertical layout for property assistant when in dock mode

  • Loading branch information
nyalldawson committed Feb 14, 2017
1 parent 76e2781 commit 7bf97be9417b31a88a964d0f8ea47ec0ecdd37de
@@ -64,6 +64,10 @@ QgsPropertyAssistantWidget::QgsPropertyAssistantWidget( QWidget* parent ,
mLegendPreview->setItemDelegate( new ItemDelegate( &mPreviewList ) );
mLegendPreview->setHeaderHidden( true );
mLegendPreview->expandAll();
mLegendVerticalFrame->setLayout( new QVBoxLayout() );
mLegendVerticalFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
mLegendVerticalFrame->layout()->setMargin( 0 );
mLegendVerticalFrame->hide();

switch ( definition.standardTemplate() )
{
@@ -116,6 +120,17 @@ void QgsPropertyAssistantWidget::updateProperty( QgsProperty& property )
property.setTransformer( mTransformerWidget->createTransformer( minValueSpinBox->value(), maxValueSpinBox->value() ) );
}

void QgsPropertyAssistantWidget::setDockMode( bool dockMode )
{
QgsPanelWidget::setDockMode( dockMode );

if ( dockMode && mLegendVerticalFrame->isHidden() )
{
mLegendVerticalFrame->layout()->addWidget( mLegendPreview );
mLegendVerticalFrame->show();
}
}

void QgsPropertyAssistantWidget::computeValuesFromLayer()
{
if ( !mLayer )
@@ -107,6 +107,8 @@ class GUI_EXPORT QgsPropertyAssistantWidget : public QgsPanelWidget, private Ui:

void setSymbol( std::shared_ptr< QgsSymbol > symbol ) { mSymbol = symbol; updatePreview(); }

void setDockMode( bool dockMode ) override;

private slots:
void computeValuesFromLayer();
void updatePreview();
@@ -10,7 +10,17 @@
<height>332</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,1,0">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0">
<item row="0" column="1" rowspan="2">
<widget class="QTreeView" name="mLegendPreview">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
@@ -129,13 +139,13 @@
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QTreeView" name="mLegendPreview">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
<item row="2" column="0">
<widget class="QFrame" name="mLegendVerticalFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>

0 comments on commit 7bf97be

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