mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-04 00:06:46 -05:00
Fix hardcoded border for raster legend items (fix #13540)
Previously raster legend items always had a fixed black border. Now there's options to change the color/width of this border or disable it entirely.
This commit is contained in:
parent
307806ab65
commit
d1be2ff214
@ -68,6 +68,7 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
|
||||
LegendIconSymbolSpace,
|
||||
LegendBoxSpace,
|
||||
LegendColumnSpace,
|
||||
LegendRasterBorderWidth,
|
||||
//composer picture
|
||||
ComposerPictureRotation,
|
||||
// composer scalebar
|
||||
|
||||
@ -129,6 +129,61 @@ class QgsComposerLegend : QgsComposerItem
|
||||
int equalColumnWidth() const;
|
||||
void setEqualColumnWidth( bool s );
|
||||
|
||||
/** Returns whether a border will be drawn around raster symbol items.
|
||||
* @see setDrawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
bool drawRasterBorder() const;
|
||||
|
||||
/** Sets whether a border will be drawn around raster symbol items.
|
||||
* @param enabled set to true to draw borders
|
||||
* @see drawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setDrawRasterBorder( bool enabled );
|
||||
|
||||
/** Returns the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderColor()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
QColor rasterBorderColor() const;
|
||||
|
||||
/** Sets the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param color border color
|
||||
* @see rasterBorderColor()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderColor( const QColor& color );
|
||||
|
||||
/** Returns the border width (in millimeters) for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderWidth()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
double rasterBorderWidth() const;
|
||||
|
||||
/** Sets the border width for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param width border width in millimeters
|
||||
* @see rasterBorderWidth()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderWidth( double width );
|
||||
|
||||
void setComposerMap( const QgsComposerMap* map );
|
||||
const QgsComposerMap* composerMap() const;
|
||||
|
||||
|
||||
@ -59,6 +59,61 @@ class QgsLegendSettings
|
||||
QSizeF symbolSize() const;
|
||||
void setSymbolSize( QSizeF s );
|
||||
|
||||
/** Returns whether a border will be drawn around raster symbol items.
|
||||
* @see setDrawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
bool drawRasterBorder() const;
|
||||
|
||||
/** Sets whether a border will be drawn around raster symbol items.
|
||||
* @param enabled set to true to draw borders
|
||||
* @see drawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setDrawRasterBorder( bool enabled );
|
||||
|
||||
/** Returns the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderColor()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
QColor rasterBorderColor() const;
|
||||
|
||||
/** Sets the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param color border color
|
||||
* @see rasterBorderColor()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderColor( const QColor& color );
|
||||
|
||||
/** Returns the border width (in millimeters) for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderWidth()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
double rasterBorderWidth() const;
|
||||
|
||||
/** Sets the border width for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param width border width in millimeters
|
||||
* @see rasterBorderWidth()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderWidth( double width );
|
||||
|
||||
QSizeF wmsLegendSize() const;
|
||||
void setWmsLegendSize( QSizeF s );
|
||||
|
||||
|
||||
@ -103,6 +103,10 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend )
|
||||
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
|
||||
mFontColorButton->setContext( "composer" );
|
||||
|
||||
mRasterBorderColorButton->setColorDialogTitle( tr( "Select border color" ) );
|
||||
mRasterBorderColorButton->setAllowAlpha( true );
|
||||
mRasterBorderColorButton->setContext( "composer " );
|
||||
|
||||
//add widget for item properties
|
||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, legend );
|
||||
mainLayout->addWidget( itemPropertiesWidget );
|
||||
@ -161,6 +165,11 @@ void QgsComposerLegendWidget::setGuiElements()
|
||||
mIconLabelSpaceSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::SymbolLabel ).margin( QgsComposerLegendStyle::Left ) );
|
||||
mBoxSpaceSpinBox->setValue( mLegend->boxSpace() );
|
||||
mColumnSpaceSpinBox->setValue( mLegend->columnSpace() );
|
||||
|
||||
mRasterBorderGroupBox->setChecked( mLegend->drawRasterBorder() );
|
||||
mRasterBorderWidthSpinBox->setValue( mLegend->rasterBorderWidth() );
|
||||
mRasterBorderColorButton->setColor( mLegend->rasterBorderColor() );
|
||||
|
||||
mCheckBoxAutoUpdate->setChecked( mLegend->autoUpdateModel() );
|
||||
refreshMapComboBox();
|
||||
|
||||
@ -613,6 +622,47 @@ void QgsComposerLegendWidget::on_mMapComboBox_currentIndexChanged( int index )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerLegendWidget::on_mRasterBorderGroupBox_toggled( bool state )
|
||||
{
|
||||
if ( !mLegend )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mLegend->beginCommand( tr( "Legend raster borders" ) );
|
||||
mLegend->setDrawRasterBorder( state );
|
||||
mLegend->adjustBoxSize();
|
||||
mLegend->update();
|
||||
mLegend->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerLegendWidget::on_mRasterBorderWidthSpinBox_valueChanged( double d )
|
||||
{
|
||||
if ( !mLegend )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mLegend->beginCommand( tr( "Legend raster border width" ), QgsComposerMergeCommand::LegendRasterBorderWidth );
|
||||
mLegend->setRasterBorderWidth( d );
|
||||
mLegend->adjustBoxSize();
|
||||
mLegend->update();
|
||||
mLegend->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerLegendWidget::on_mRasterBorderColorButton_colorChanged( const QColor& newColor )
|
||||
{
|
||||
if ( !mLegend )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mLegend->beginCommand( tr( "Legend raster border color" ) );
|
||||
mLegend->setRasterBorderColor( newColor );
|
||||
mLegend->update();
|
||||
mLegend->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerLegendWidget::on_mAddToolButton_clicked()
|
||||
{
|
||||
if ( !mLegend )
|
||||
@ -894,6 +944,9 @@ void QgsComposerLegendWidget::blockAllSignals( bool b )
|
||||
mBoxSpaceSpinBox->blockSignals( b );
|
||||
mColumnSpaceSpinBox->blockSignals( b );
|
||||
mFontColorButton->blockSignals( b );
|
||||
mRasterBorderGroupBox->blockSignals( b );
|
||||
mRasterBorderColorButton->blockSignals( b );
|
||||
mRasterBorderWidthSpinBox->blockSignals( b );
|
||||
}
|
||||
|
||||
void QgsComposerLegendWidget::refreshMapComboBox()
|
||||
|
||||
@ -69,6 +69,10 @@ class QgsComposerLegendWidget: public QgsComposerItemBaseWidget, private Ui::Qgs
|
||||
void on_mCheckBoxAutoUpdate_stateChanged( int state );
|
||||
void on_mMapComboBox_currentIndexChanged( int index );
|
||||
|
||||
void on_mRasterBorderGroupBox_toggled( bool state );
|
||||
void on_mRasterBorderWidthSpinBox_valueChanged( double d );
|
||||
void on_mRasterBorderColorButton_colorChanged( const QColor& newColor );
|
||||
|
||||
//item manipulation
|
||||
void on_mMoveDownToolButton_clicked();
|
||||
void on_mMoveUpToolButton_clicked();
|
||||
|
||||
@ -102,6 +102,7 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
||||
LegendIconSymbolSpace,
|
||||
LegendBoxSpace,
|
||||
LegendColumnSpace,
|
||||
LegendRasterBorderWidth,
|
||||
//composer picture
|
||||
ComposerPictureRotation,
|
||||
// composer scalebar
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "qgslegendrenderer.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgssymbollayerv2utils.h"
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QPainter>
|
||||
@ -241,6 +242,14 @@ void QgsComposerLegend::setSplitLayer( bool s ) { mSettings.setSplitLayer( s );
|
||||
bool QgsComposerLegend::equalColumnWidth() const { return mSettings.equalColumnWidth(); }
|
||||
void QgsComposerLegend::setEqualColumnWidth( bool s ) { mSettings.setEqualColumnWidth( s ); }
|
||||
|
||||
bool QgsComposerLegend::drawRasterBorder() const { return mSettings.drawRasterBorder(); }
|
||||
void QgsComposerLegend::setDrawRasterBorder( bool enabled ) { mSettings.setDrawRasterBorder( enabled ); }
|
||||
|
||||
QColor QgsComposerLegend::rasterBorderColor() const { return mSettings.rasterBorderColor(); }
|
||||
void QgsComposerLegend::setRasterBorderColor( const QColor& color ) { mSettings.setRasterBorderColor( color ); }
|
||||
|
||||
double QgsComposerLegend::rasterBorderWidth() const { return mSettings.rasterBorderWidth(); }
|
||||
void QgsComposerLegend::setRasterBorderWidth( double width ) { mSettings.setRasterBorderWidth( width ); }
|
||||
|
||||
void QgsComposerLegend::synchronizeWithModel()
|
||||
{
|
||||
@ -279,6 +288,11 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
|
||||
|
||||
composerLegendElem.setAttribute( "symbolWidth", QString::number( mSettings.symbolSize().width() ) );
|
||||
composerLegendElem.setAttribute( "symbolHeight", QString::number( mSettings.symbolSize().height() ) );
|
||||
|
||||
composerLegendElem.setAttribute( "rasterBorder", mSettings.drawRasterBorder() );
|
||||
composerLegendElem.setAttribute( "rasterBorderColor", QgsSymbolLayerV2Utils::encodeColor( mSettings.rasterBorderColor() ) );
|
||||
composerLegendElem.setAttribute( "rasterBorderWidth", QString::number( mSettings.rasterBorderWidth() ) );
|
||||
|
||||
composerLegendElem.setAttribute( "wmsLegendWidth", QString::number( mSettings.wmsLegendSize().width() ) );
|
||||
composerLegendElem.setAttribute( "wmsLegendHeight", QString::number( mSettings.wmsLegendSize().height() ) );
|
||||
composerLegendElem.setAttribute( "wrapChar", mSettings.wrapChar() );
|
||||
@ -402,6 +416,10 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
|
||||
mSettings.setSymbolSize( QSizeF( itemElem.attribute( "symbolWidth", "7.0" ).toDouble(), itemElem.attribute( "symbolHeight", "14.0" ).toDouble() ) );
|
||||
mSettings.setWmsLegendSize( QSizeF( itemElem.attribute( "wmsLegendWidth", "50" ).toDouble(), itemElem.attribute( "wmsLegendHeight", "25" ).toDouble() ) );
|
||||
|
||||
mSettings.setDrawRasterBorder( itemElem.attribute( "rasterBorder", "1" ) != "0" );
|
||||
mSettings.setRasterBorderColor( QgsSymbolLayerV2Utils::decodeColor( itemElem.attribute( "rasterBorderColor", "0,0,0" ) ) );
|
||||
mSettings.setRasterBorderWidth( itemElem.attribute( "rasterBorderWidth", "0" ).toDouble() );
|
||||
|
||||
mSettings.setWrapChar( itemElem.attribute( "wrapChar" ) );
|
||||
|
||||
//composer map
|
||||
|
||||
@ -156,6 +156,61 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
|
||||
bool equalColumnWidth() const;
|
||||
void setEqualColumnWidth( bool s );
|
||||
|
||||
/** Returns whether a border will be drawn around raster symbol items.
|
||||
* @see setDrawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
bool drawRasterBorder() const;
|
||||
|
||||
/** Sets whether a border will be drawn around raster symbol items.
|
||||
* @param enabled set to true to draw borders
|
||||
* @see drawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setDrawRasterBorder( bool enabled );
|
||||
|
||||
/** Returns the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderColor()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
QColor rasterBorderColor() const;
|
||||
|
||||
/** Sets the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param color border color
|
||||
* @see rasterBorderColor()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderColor( const QColor& color );
|
||||
|
||||
/** Returns the border width (in millimeters) for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderWidth()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
double rasterBorderWidth() const;
|
||||
|
||||
/** Sets the border width for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param width border width in millimeters
|
||||
* @see rasterBorderWidth()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderWidth( double width );
|
||||
|
||||
void setComposerMap( const QgsComposerMap* map );
|
||||
const QgsComposerMap* composerMap() const { return mComposerMap;}
|
||||
|
||||
|
||||
@ -515,8 +515,21 @@ QSizeF QgsRasterSymbolLegendNode::drawSymbol( const QgsLegendSettings& settings,
|
||||
if ( QgsRasterRenderer* rasterRenderer = rasterLayer->renderer() )
|
||||
itemColor.setAlpha( rasterRenderer->opacity() * 255.0 );
|
||||
}
|
||||
|
||||
ctx->painter->setBrush( itemColor );
|
||||
|
||||
if ( settings.drawRasterBorder() )
|
||||
{
|
||||
QPen pen;
|
||||
pen.setColor( settings.rasterBorderColor() );
|
||||
pen.setWidthF( settings.rasterBorderWidth() );
|
||||
pen.setJoinStyle( Qt::MiterJoin );
|
||||
ctx->painter->setPen( pen );
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx->painter->setPen( Qt::NoPen );
|
||||
}
|
||||
|
||||
ctx->painter->drawRect( QRectF( ctx->point.x(), ctx->point.y() + ( itemHeight - settings.symbolSize().height() ) / 2,
|
||||
settings.symbolSize().width(), settings.symbolSize().height() ) );
|
||||
}
|
||||
|
||||
@ -30,6 +30,9 @@ QgsLegendSettings::QgsLegendSettings()
|
||||
, mColumnCount( 1 )
|
||||
, mSplitLayer( false )
|
||||
, mEqualColumnWidth( false )
|
||||
, mRasterSymbolBorder( true )
|
||||
, mRasterBorderColor( Qt::black )
|
||||
, mRasterBorderWidth( 0.0 )
|
||||
, mMmPerMapUnit( 1 )
|
||||
, mUseAdvancedEffects( true )
|
||||
, mMapScale( 1 )
|
||||
|
||||
@ -82,6 +82,61 @@ class CORE_EXPORT QgsLegendSettings
|
||||
QSizeF symbolSize() const {return mSymbolSize;}
|
||||
void setSymbolSize( QSizeF s ) {mSymbolSize = s;}
|
||||
|
||||
/** Returns whether a border will be drawn around raster symbol items.
|
||||
* @see setDrawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
bool drawRasterBorder() const { return mRasterSymbolBorder; }
|
||||
|
||||
/** Sets whether a border will be drawn around raster symbol items.
|
||||
* @param enabled set to true to draw borders
|
||||
* @see drawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setDrawRasterBorder( bool enabled ) { mRasterSymbolBorder = enabled; }
|
||||
|
||||
/** Returns the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderColor()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
QColor rasterBorderColor() const { return mRasterBorderColor; }
|
||||
|
||||
/** Sets the border color for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param color border color
|
||||
* @see rasterBorderColor()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderWidth()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderColor( const QColor& color ) { mRasterBorderColor = color; }
|
||||
|
||||
/** Returns the border width (in millimeters) for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @see setRasterBorderWidth()
|
||||
* @see drawRasterBorder()
|
||||
* @see rasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
double rasterBorderWidth() const { return mRasterBorderWidth; }
|
||||
|
||||
/** Sets the border width for the border drawn around raster symbol items. The border is
|
||||
* only drawn if drawRasterBorder() is true.
|
||||
* @param width border width in millimeters
|
||||
* @see rasterBorderWidth()
|
||||
* @see setDrawRasterBorder()
|
||||
* @see setRasterBorderColor()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setRasterBorderWidth( double width ) { mRasterBorderWidth = width; }
|
||||
|
||||
QSizeF wmsLegendSize() const {return mWmsLegendSize;}
|
||||
void setWmsLegendSize( QSizeF s ) {mWmsLegendSize = s;}
|
||||
|
||||
@ -174,6 +229,10 @@ class CORE_EXPORT QgsLegendSettings
|
||||
/** Use the same width (maximum) for all columns */
|
||||
bool mEqualColumnWidth;
|
||||
|
||||
bool mRasterSymbolBorder;
|
||||
QColor mRasterBorderColor;
|
||||
double mRasterBorderWidth;
|
||||
|
||||
QMap<QgsComposerLegendStyle::Style, QgsComposerLegendStyle> mStyleMap;
|
||||
|
||||
/** Conversion ratio between millimeters and map units - for symbols with size given in map units */
|
||||
|
||||
@ -63,9 +63,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<y>-420</y>
|
||||
<width>375</width>
|
||||
<height>1291</height>
|
||||
<height>1392</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mainLayout">
|
||||
@ -226,7 +226,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
@ -636,6 +636,108 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QgsCollapsibleGroupBoxBasic" name="mRasterBorderGroupBox">
|
||||
<property name="title">
|
||||
<string>Draw border for raster symbols</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="syncGroup" stdset="0">
|
||||
<string notr="true">composeritem</string>
|
||||
</property>
|
||||
<property name="collapsed" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Border color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QgsColorButtonV2" name="mRasterBorderColorButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mOutlineWidthLabel">
|
||||
<property name="text">
|
||||
<string>Thickness</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mRasterBorderWidthSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QgsDoubleSpinBox" name="mRasterBorderWidthSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>Hairline</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -956,6 +1058,9 @@
|
||||
<tabstop>mSymbolsColGroupBox</tabstop>
|
||||
<tabstop>mSymbolWidthSpinBox</tabstop>
|
||||
<tabstop>mSymbolHeightSpinBox</tabstop>
|
||||
<tabstop>mRasterBorderGroupBox</tabstop>
|
||||
<tabstop>mRasterBorderColorButton</tabstop>
|
||||
<tabstop>mRasterBorderWidthSpinBox</tabstop>
|
||||
<tabstop>mSymbolsColGroupBox_2</tabstop>
|
||||
<tabstop>mWmsLegendWidthSpinBox</tabstop>
|
||||
<tabstop>mWmsLegendHeightSpinBox</tabstop>
|
||||
|
||||
@ -98,6 +98,7 @@ class TestQgsLegendRenderer : public QObject
|
||||
void testLongSymbolText();
|
||||
void testThreeColumns();
|
||||
void testFilterByMap();
|
||||
void testRasterBorder();
|
||||
|
||||
private:
|
||||
QgsLayerTreeGroup* mRoot;
|
||||
@ -327,5 +328,22 @@ void TestQgsLegendRenderer::testFilterByMap()
|
||||
QVERIFY( _verifyImage( testName, mReport ) );
|
||||
}
|
||||
|
||||
void TestQgsLegendRenderer::testRasterBorder()
|
||||
{
|
||||
QString testName = "legend_raster_border";
|
||||
|
||||
QgsLayerTreeGroup* root = new QgsLayerTreeGroup();
|
||||
root->addLayer( mRL );
|
||||
|
||||
QgsLayerTreeModel legendModel( root );
|
||||
|
||||
QgsLegendSettings settings;
|
||||
_setStandardTestFont( settings );
|
||||
settings.setRasterBorderWidth( 2 );
|
||||
settings.setRasterBorderColor( Qt::green );
|
||||
_renderLegend( testName, &legendModel, settings );
|
||||
QVERIFY( _verifyImage( testName, mReport ) );
|
||||
}
|
||||
|
||||
QTEST_MAIN( TestQgsLegendRenderer )
|
||||
#include "testqgslegendrenderer.moc"
|
||||
|
||||
BIN
tests/testdata/control_images/legend/expected_legend_raster_border/expected_legend_raster_border.png
vendored
Normal file
BIN
tests/testdata/control_images/legend/expected_legend_raster_border/expected_legend_raster_border.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 808 B |
Loading…
x
Reference in New Issue
Block a user