Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI improvements in symbol layer widgets #220

Merged
merged 1 commit into from
Oct 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mRotationSpinBox->setValue( mLayer->angle() );
mOutlineWidthSpinBox->setValue( mLayer->outlineWidth() );

btnChangeColorBorder->setColor( mLayer->outlineColor() );
btnChangeColorFill->setColor( mLayer->fillColor() );

QList<QListWidgetItem *> symbolItemList = mShapeListWidget->findItems( mLayer->symbolName(), Qt::MatchExactly );
if ( symbolItemList.size() > 0 )
{
Expand Down Expand Up @@ -192,6 +195,7 @@ void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorBorder_clicked()
if ( newColor.isValid() )
{
mLayer->setOutlineColor( newColor );
btnChangeColorBorder->setColor( newColor );
emit changed();
}
}
Expand All @@ -205,6 +209,7 @@ void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorFill_clicked()
if ( newColor.isValid() )
{
mLayer->setFillColor( newColor );
btnChangeColorFill->setColor( newColor );
emit changed();
}
}
Expand Down
51 changes: 15 additions & 36 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ void QgsSvgMarkerSymbolLayerV2Widget::setGuiForSvg( const QgsSvgMarkerSymbolLaye
mChangeBorderColorButton->setEnabled( hasOutlineParam );
mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );

if ( hasFillParam )
mChangeColorButton->setColor( defaultFill );
if ( hasOutlineParam )
mChangeBorderColorButton->setColor( defaultOutline );

mFileLineEdit->blockSignals( true );
mFileLineEdit->setText( layer->path() );
mFileLineEdit->blockSignals( false );
Expand Down Expand Up @@ -795,6 +800,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeColorButton_clicked()
if ( c.isValid() )
{
mLayer->setFillColor( c );
mChangeColorButton->setColor( c );
emit changed();
}
}
Expand All @@ -809,6 +815,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeBorderColorButton_clicked()
if ( c.isValid() )
{
mLayer->setOutlineColor( c );
mChangeBorderColorButton->setColor( c );
emit changed();
}
}
Expand Down Expand Up @@ -886,7 +893,6 @@ QgsSVGFillSymbolLayerWidget::QgsSVGFillSymbolLayerWidget( const QgsVectorLayer*
setupUi( this );
mSvgTreeView->setHeaderHidden( true );
insertIcons();
updateOutlineIcon();

connect( mSvgListView->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( setFile( const QModelIndex& ) ) );
connect( mSvgTreeView->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( populateIcons( const QModelIndex& ) ) );
Expand All @@ -912,7 +918,6 @@ void QgsSVGFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* layer )
mSVGLineEdit->setText( mLayer->svgFilePath() );
mRotationSpinBox->setValue( mLayer->angle() );
}
updateOutlineIcon();
updateParamGui();
}

Expand Down Expand Up @@ -989,17 +994,6 @@ void QgsSVGFillSymbolLayerWidget::populateIcons( const QModelIndex& idx )
emit changed();
}

void QgsSVGFillSymbolLayerWidget::on_mChangeOutlinePushButton_clicked()
{
QgsSymbolV2SelectorDialog dlg( mLayer->subSymbol(), QgsStyleV2::defaultStyle(), mVectorLayer, this );
if ( dlg.exec() == QDialog::Rejected )
{
return;
}

updateOutlineIcon();
emit changed();
}

void QgsSVGFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged( double d )
{
Expand All @@ -1010,23 +1004,18 @@ void QgsSVGFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged( double d )
emit changed();
}

void QgsSVGFillSymbolLayerWidget::updateOutlineIcon()
{
if ( mLayer )
{
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mLayer->subSymbol(), mChangeOutlinePushButton->iconSize() );
mChangeOutlinePushButton->setIcon( icon );
}
}

void QgsSVGFillSymbolLayerWidget::updateParamGui()
{
//activate gui for svg parameters only if supported by the svg file
bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
QColor defaultFill, defaultOutline;
double defaultOutlineWidth;
QgsSvgCache::instance()->containsParams( mSVGLineEdit->text(), hasFillParam, defaultFill, hasOutlineParam, defaultOutline, hasOutlineWidthParam, defaultOutlineWidth );
if ( hasFillParam )
mChangeColorButton->setColor( defaultFill );
mChangeColorButton->setEnabled( hasFillParam );
if ( hasOutlineParam )
mChangeBorderColorButton->setColor( defaultOutline );
mChangeBorderColorButton->setEnabled( hasOutlineParam );
mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
}
Expand All @@ -1041,6 +1030,7 @@ void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_clicked()
if ( c.isValid() )
{
mLayer->setSvgFillColor( c );
mChangeColorButton->setColor( c );
emit changed();
}
}
Expand All @@ -1055,6 +1045,7 @@ void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_clicked()
if ( c.isValid() )
{
mLayer->setSvgOutlineColor( c );
mChangeBorderColorButton->setColor( c );
emit changed();
}
}
Expand Down Expand Up @@ -1091,6 +1082,7 @@ void QgsLinePatternFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* laye
mDistanceSpinBox->setValue( mLayer->distance() );
mLineWidthSpinBox->setValue( mLayer->lineWidth() );
mOffsetSpinBox->setValue( mLayer->offset() );
mColorPushButton->setColor( mLayer->color() );
}
}

Expand Down Expand Up @@ -1143,25 +1135,12 @@ void QgsLinePatternFillSymbolLayerWidget::on_mColorPushButton_clicked()
if ( c.isValid() )
{
mLayer->setColor( c );
mColorPushButton->setColor( c );
emit changed();
}
}
}

void QgsLinePatternFillSymbolLayerWidget::on_mOutlinePushButton_clicked()
{
if ( mLayer )
{
QgsSymbolV2SelectorDialog dlg( mLayer->subSymbol(), QgsStyleV2::defaultStyle(), mVectorLayer, this );
if ( dlg.exec() == QDialog::Rejected )
{
return;
}

//updateOutlineIcon();
emit changed();
}
}

/////////////

Expand Down
3 changes: 0 additions & 3 deletions src/gui/symbology-ng/qgssymbollayerv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, pr
//sets new output unit. Is called on combo box or spin box change
void setOutputUnit();
void insertIcons();
void updateOutlineIcon();
void updateParamGui();

private slots:
Expand All @@ -272,7 +271,6 @@ class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, pr
void on_mSVGLineEdit_textChanged( const QString & text );
void setFile( const QModelIndex& item );
void populateIcons( const QModelIndex& item );
void on_mChangeOutlinePushButton_clicked();
void on_mRotationSpinBox_valueChanged( double d );
void on_mChangeColorButton_clicked();
void on_mChangeBorderColorButton_clicked();
Expand Down Expand Up @@ -306,7 +304,6 @@ class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Wi
void on_mLineWidthSpinBox_valueChanged( double d );
void on_mOffsetSpinBox_valueChanged( double d );
void on_mColorPushButton_clicked();
void on_mOutlinePushButton_clicked();
};

//////////
Expand Down
19 changes: 16 additions & 3 deletions src/ui/symbollayer/widget_ellipse.ui
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,32 @@
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="mDDShapeComboBox"/>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mDDRotationComboBox"/>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="mDDShapeComboBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mDDRotationLabel">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
Expand Down
82 changes: 41 additions & 41 deletions src/ui/symbollayer/widget_fontmarker.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<width>399</width>
<height>300</height>
</rect>
</property>
Expand All @@ -31,20 +31,10 @@
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Font family</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QFontComboBox" name="cboFont"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Color</string>
<string>Size</string>
</property>
</widget>
</item>
Expand All @@ -55,17 +45,10 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Rotation</string>
<string>Font family</string>
</property>
</widget>
</item>
Expand All @@ -82,23 +65,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="spinSize">
<property name="decimals">
<number>5</number>
</property>
<property name="value">
<double>12.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Offset X,Y</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down Expand Up @@ -129,6 +95,40 @@
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Offset X,Y</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="spinSize">
<property name="decimals">
<number>5</number>
</property>
<property name="value">
<double>12.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="cboFont"/>
</item>
</layout>
</item>
<item>
Expand Down