Skip to content
Permalink
Browse files

[styledock] Layer picker

  • Loading branch information
NathanW2 committed Jun 2, 2016
1 parent 7433d32 commit 7dd1c592f04b999f553b9f8901bcc3d7a7a82149
Showing with 39 additions and 28 deletions.
  1. +3 −2 src/app/qgsmapstylingwidget.cpp
  2. +6 −0 src/gui/qgsmaplayercombobox.cpp
  3. +30 −26 src/ui/qgsmapstylingwidgetbase.ui
@@ -56,6 +56,7 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QList<QgsMapStyl
connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) );
connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) );
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( mLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( setLayer( QgsMapLayer* ) ) );

mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false );
}
@@ -64,7 +65,7 @@ void QgsMapStylingWidget::setLayer( QgsMapLayer *layer )
{
if ( !layer || !layer->isSpatial() )
{
mLayerTitle->setText( QString() );
mLayerCombo->setLayer( nullptr );
mStackedWidget->setCurrentIndex( mNotSupportedPage );
return;
}
@@ -188,7 +189,7 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()

mUndoWidget->setUndoStack( layer->undoStackStyles() );

mLayerTitle->setText( layer->name() );
whileBlocking( mLayerCombo )->setLayer( layer );

int row = mOptionsListWidget->currentIndex().row();

@@ -30,6 +30,12 @@ QgsMapLayerComboBox::QgsMapLayerComboBox( QWidget *parent )

void QgsMapLayerComboBox::setLayer( QgsMapLayer *layer )
{
if ( !layer )
{
setCurrentIndex( -1 );
return;
}

QModelIndex idx = mProxyModel->sourceLayerModel()->indexFromLayer( layer );
if ( idx.isValid() )
{
@@ -14,16 +14,7 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>3</number>
</property>
<item row="0" column="0">
@@ -44,21 +35,12 @@
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>3</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -153,17 +135,32 @@
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Layer name</string>
<string>Layer</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mLayerTitle">
<property name="readOnly">
<bool>true</bool>
<widget class="QgsMapLayerComboBox" name="mLayerCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
</widget>
</item>
@@ -208,6 +205,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsMapLayerComboBox</class>
<extends>QComboBox</extends>
<header>qgsmaplayercombobox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../images/images.qrc"/>
</resources>

0 comments on commit 7dd1c59

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