[FEATURE][composer] Add controls for changing zebra frame colors and line thickness, fix output of zebra style grids (fix #8767)

This commit is contained in:
nyalldawson 2013-12-29 08:37:00 +11:00 committed by Nyall Dawson
parent afbd2ac2ce
commit aa3e40a0eb
8 changed files with 347 additions and 57 deletions

View File

@ -247,6 +247,32 @@ class QgsComposerMap : QgsComposerItem
@note: this function was added in version 1.9*/
void setGridFrameWidth( double w );
double gridFrameWidth() const;
/**Set grid frame pen thickness
@note: this function was added in version 2.1*/
void setGridFramePenSize( double w );
double gridFramePenSize() const;
/**Sets pen color for grid frame
@note: this function was added in version 2.1*/
void setGridFramePenColor( const QColor& c );
/**Get pen color for grid frame
@note: this function was added in version 2.1*/
QColor gridFramePenColor() const;
/**Sets first fill color for grid zebra frame
@note: this function was added in version 2.1*/
void setGridFrameFillColor1( const QColor& c );
/**Get first fill color for grid zebra frame
@note: this function was added in version 2.1*/
QColor gridFrameFillColor1() const;
/**Sets second fill color for grid zebra frame
@note: this function was added in version 2.1*/
void setGridFrameFillColor2( const QColor& c );
/**Get second fill color for grid zebra frame
@note: this function was added in version 2.1*/
QColor gridFrameFillColor2() const;
/** Returns the grid's blending mode
@note added in version 2.0*/

View File

@ -61,6 +61,9 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidg
mAnnotationFormatComboBox->insertItem( 1, tr( "DegreeMinute" ) );
mAnnotationFormatComboBox->insertItem( 2, tr( "DegreeMinuteSecond" ) );
mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mAnnotationFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
insertAnnotationPositionEntries( mAnnotationPositionTopComboBox );
@ -74,9 +77,22 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidg
mFrameStyleComboBox->insertItem( 0, tr( "No frame" ) );
mFrameStyleComboBox->insertItem( 1, tr( "Zebra" ) );
mGridFramePenColorButton->setColorDialogTitle( tr( "Select grid frame color" ) );
mGridFramePenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridFrameFill1ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
mGridFrameFill1ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mGridFrameFill2ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
mGridFrameFill2ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
//set initial state of frame style controls
toggleFrameControls( false );
connect( mGridCheckBox, SIGNAL( toggled( bool ) ),
mDrawAnnotationCheckableGroupBox, SLOT( setEnabled( bool ) ) );
connect( mFrameStyleComboBox, SIGNAL( currentIndexChanged( QString ) ),
this, SLOT( frameStyleChanged( QString ) ) );
if ( composerMap )
{
connect( composerMap, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
@ -339,14 +355,20 @@ void QgsComposerMapWidget::updateGuiElements()
//grid frame
mFrameWidthSpinBox->setValue( mComposerMap->gridFrameWidth() );
mGridFramePenSizeSpinBox->setValue( mComposerMap->gridFramePenSize() );
mGridFramePenColorButton->setColor( mComposerMap->gridFramePenColor() );
mGridFrameFill1ColorButton->setColor( mComposerMap->gridFrameFillColor1() );
mGridFrameFill2ColorButton->setColor( mComposerMap->gridFrameFillColor2() );
QgsComposerMap::GridFrameStyle gridFrameStyle = mComposerMap->gridFrameStyle();
if ( gridFrameStyle == QgsComposerMap::Zebra )
{
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findText( tr( "Zebra" ) ) );
toggleFrameControls( true );
}
else //NoGridFrame
{
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findText( tr( "No frame" ) ) );
toggleFrameControls( false );
}
//grid blend mode
@ -369,8 +391,6 @@ void QgsComposerMapWidget::updateGuiElements()
initAnnotationDirectionBox( mAnnotationDirectionComboBoxBottom, mComposerMap->gridAnnotationDirection( QgsComposerMap::Bottom ) );
mAnnotationFontColorButton->setColor( mComposerMap->annotationFontColor() );
mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mAnnotationFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mDistanceToMapFrameSpinBox->setValue( mComposerMap->annotationFrameDistance() );
@ -454,6 +474,10 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
mDrawCanvasItemsCheckBox->blockSignals( b );
mFrameStyleComboBox->blockSignals( b );
mFrameWidthSpinBox->blockSignals( b );
mGridFramePenSizeSpinBox->blockSignals( b );
mGridFramePenColorButton->blockSignals( b );
mGridFrameFill1ColorButton->blockSignals( b );
mGridFrameFill2ColorButton->blockSignals( b );
mOverviewFrameMapComboBox->blockSignals( b );
mOverviewFrameStyleButton->blockSignals( b );
mOverviewBlendModeComboBox->blockSignals( b );
@ -880,8 +904,23 @@ void QgsComposerMapWidget::on_mCoordinatePrecisionSpinBox_valueChanged( int valu
mComposerMap->endCommand();
}
void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled )
{
//set status of frame controls
mFrameWidthSpinBox->setEnabled( frameEnabled );
mGridFramePenSizeSpinBox->setEnabled( frameEnabled );
mGridFramePenColorButton->setEnabled( frameEnabled );
mGridFrameFill1ColorButton->setEnabled( frameEnabled );
mGridFrameFill2ColorButton->setEnabled( frameEnabled );
mFrameWidthLabel->setEnabled( frameEnabled );
mFramePenLabel->setEnabled( frameEnabled );
mFrameFillLabel->setEnabled( frameEnabled );
}
void QgsComposerMapWidget::on_mFrameStyleComboBox_currentIndexChanged( const QString& text )
{
toggleFrameControls( text != tr( "No frame" ) );
if ( !mComposerMap )
{
return;
@ -913,6 +952,54 @@ void QgsComposerMapWidget::on_mFrameWidthSpinBox_valueChanged( double d )
}
}
void QgsComposerMapWidget::on_mGridFramePenSizeSpinBox_valueChanged( double d )
{
if ( mComposerMap )
{
mComposerMap->beginCommand( tr( "Changed grid frame line thickness" ) );
mComposerMap->setGridFramePenSize( d );
mComposerMap->updateBoundingRect();
mComposerMap->update();
mComposerMap->endCommand();
}
}
void QgsComposerMapWidget::on_mGridFramePenColorButton_colorChanged( const QColor& newColor )
{
if ( !mComposerMap )
{
return;
}
mComposerMap->beginCommand( tr( "Grid frame color changed" ) );
mComposerMap->setGridFramePenColor( newColor );
mComposerMap->update();
mComposerMap->endCommand();
}
void QgsComposerMapWidget::on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor )
{
if ( !mComposerMap )
{
return;
}
mComposerMap->beginCommand( tr( "Grid frame first fill color changed" ) );
mComposerMap->setGridFrameFillColor1( newColor );
mComposerMap->update();
mComposerMap->endCommand();
}
void QgsComposerMapWidget::on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor )
{
if ( !mComposerMap )
{
return;
}
mComposerMap->beginCommand( tr( "Grid frame second fill color changed" ) );
mComposerMap->setGridFrameFillColor2( newColor );
mComposerMap->update();
mComposerMap->endCommand();
}
void QgsComposerMapWidget::showEvent( QShowEvent * event )
{
refreshMapComboBox();

View File

@ -85,6 +85,10 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
void on_mFrameWidthSpinBox_valueChanged( double d );
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );
protected:
void showEvent( QShowEvent * event );
@ -122,6 +126,9 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
/**Updates the map combo box with the current composer map ids*/
void refreshMapComboBox();
/**Enables/disables grid frame related controls*/
void toggleFrameControls( bool frameEnabled );
};
#endif

View File

@ -49,6 +49,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w
mTopGridAnnotationPosition( OutsideMapFrame ), mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ),
mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ), mTopGridAnnotationDirection( Horizontal ),
mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ),
mGridFramePenThickness( 0.5 ), mGridFramePenColor( QColor( 0, 0, 0 ) ), mGridFrameFillColor1( Qt::white ), mGridFrameFillColor2( Qt::black ),
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mComposition = composition;
@ -105,8 +106,9 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
mLeftGridAnnotationPosition( OutsideMapFrame ), mRightGridAnnotationPosition( OutsideMapFrame ),
mTopGridAnnotationPosition( OutsideMapFrame ), mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ),
mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ), mTopGridAnnotationDirection( Horizontal ),
mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ), mCrossLength( 3 ),
mMapCanvas( 0 ), mDrawCanvasItems( true )
mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ), mGridFramePenThickness( 0.5 ),
mGridFramePenColor( QColor( 0, 0, 0 ) ), mGridFrameFillColor1( Qt::white ), mGridFrameFillColor2( Qt::black ),
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mOverviewFrameMapSymbol = 0;
mGridLineSymbol = 0;
@ -865,6 +867,28 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
gridElem.setAttribute( "crossLength", qgsDoubleToString( mCrossLength ) );
gridElem.setAttribute( "gridFrameStyle", mGridFrameStyle );
gridElem.setAttribute( "gridFrameWidth", qgsDoubleToString( mGridFrameWidth ) );
gridElem.setAttribute( "gridFramePenThickness", qgsDoubleToString( mGridFramePenThickness ) );
//grid frame pen color
QDomElement framePenColorElem = doc.createElement( "framePenColor" );
framePenColorElem.setAttribute( "red", mGridFramePenColor.red() );
framePenColorElem.setAttribute( "green", mGridFramePenColor.green() );
framePenColorElem.setAttribute( "blue", mGridFramePenColor.blue() );
framePenColorElem.setAttribute( "alpha", mGridFramePenColor.alpha() );
gridElem.appendChild( framePenColorElem );
//grid frame fill colors
QDomElement frameFillColor1Elem = doc.createElement( "frameFillColor1" );
frameFillColor1Elem.setAttribute( "red", mGridFrameFillColor1.red() );
frameFillColor1Elem.setAttribute( "green", mGridFrameFillColor1.green() );
frameFillColor1Elem.setAttribute( "blue", mGridFrameFillColor1.blue() );
frameFillColor1Elem.setAttribute( "alpha", mGridFrameFillColor1.alpha() );
gridElem.appendChild( frameFillColor1Elem );
QDomElement frameFillColor2Elem = doc.createElement( "frameFillColor2" );
frameFillColor2Elem.setAttribute( "red", mGridFrameFillColor2.red() );
frameFillColor2Elem.setAttribute( "green", mGridFrameFillColor2.green() );
frameFillColor2Elem.setAttribute( "blue", mGridFrameFillColor2.blue() );
frameFillColor2Elem.setAttribute( "alpha", mGridFrameFillColor2.alpha() );
gridElem.appendChild( frameFillColor2Elem );
gridElem.setAttribute( "gridBlendMode", QgsMapRenderer::getBlendModeEnum( mGridBlendMode ) );
QDomElement gridLineStyleElem = QgsSymbolLayerV2Utils::saveSymbol( QString(), mGridLineSymbol, doc );
gridElem.appendChild( gridLineStyleElem );
@ -889,6 +913,7 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
annotationFontColorElem.setAttribute( "red", mGridAnnotationFontColor.red() );
annotationFontColorElem.setAttribute( "green", mGridAnnotationFontColor.green() );
annotationFontColorElem.setAttribute( "blue", mGridAnnotationFontColor.blue() );
annotationFontColorElem.setAttribute( "alpha", mGridAnnotationFontColor.alpha() );
annotationElem.appendChild( annotationFontColorElem );
gridElem.appendChild( annotationElem );
@ -1027,6 +1052,54 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
mCrossLength = gridElem.attribute( "crossLength", "3" ).toDouble();
mGridFrameStyle = ( QgsComposerMap::GridFrameStyle )gridElem.attribute( "gridFrameStyle", "0" ).toInt();
mGridFrameWidth = gridElem.attribute( "gridFrameWidth", "2.0" ).toDouble();
mGridFramePenThickness = gridElem.attribute( "gridFramePenThickness", "0.5" ).toDouble();
//grid frame pen color
QDomNodeList gridFramePenColorList = gridElem.elementsByTagName( "framePenColor" );
if ( gridFramePenColorList.size() > 0 )
{
QDomElement penColorElem = gridFramePenColorList.at( 0 ).toElement();
int red = penColorElem.attribute( "red", "0" ).toInt();
int green = penColorElem.attribute( "green", "0" ).toInt();
int blue = penColorElem.attribute( "blue", "0" ).toInt();
int alpha = penColorElem.attribute( "alpha", "255" ).toInt();
mGridFramePenColor = QColor( red, green, blue, alpha );
}
else
{
mGridFramePenColor = QColor( 0, 0, 0 );
}
//grid frame fill color 1
QDomNodeList gridFrameFillColor1List = gridElem.elementsByTagName( "frameFillColor1" );
if ( gridFrameFillColor1List.size() > 0 )
{
QDomElement fillColorElem = gridFrameFillColor1List.at( 0 ).toElement();
int red = fillColorElem.attribute( "red", "0" ).toInt();
int green = fillColorElem.attribute( "green", "0" ).toInt();
int blue = fillColorElem.attribute( "blue", "0" ).toInt();
int alpha = fillColorElem.attribute( "alpha", "255" ).toInt();
mGridFrameFillColor1 = QColor( red, green, blue, alpha );
}
else
{
mGridFrameFillColor1 = Qt::white;
}
//grid frame fill color 2
QDomNodeList gridFrameFillColor2List = gridElem.elementsByTagName( "frameFillColor2" );
if ( gridFrameFillColor2List.size() > 0 )
{
QDomElement fillColorElem = gridFrameFillColor2List.at( 0 ).toElement();
int red = fillColorElem.attribute( "red", "0" ).toInt();
int green = fillColorElem.attribute( "green", "0" ).toInt();
int blue = fillColorElem.attribute( "blue", "0" ).toInt();
int alpha = fillColorElem.attribute( "alpha", "255" ).toInt();
mGridFrameFillColor2 = QColor( red, green, blue, alpha );
}
else
{
mGridFrameFillColor2 = Qt::black;
}
setGridBlendMode( QgsMapRenderer::getCompositionMode(( QgsMapRenderer::BlendMode ) gridElem.attribute( "gridBlendMode", "0" ).toUInt() ) );
QDomElement gridSymbolElem = gridElem.firstChildElement( "symbol" );
@ -1070,7 +1143,8 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
int red = fontColorElem.attribute( "red", "0" ).toInt();
int green = fontColorElem.attribute( "green", "0" ).toInt();
int blue = fontColorElem.attribute( "blue", "0" ).toInt();
mGridAnnotationFontColor = QColor( red, green, blue );
int alpha = fontColorElem.attribute( "alpha", "255" ).toInt();
mGridAnnotationFontColor = QColor( red, green, blue, alpha );
}
else
{
@ -1268,7 +1342,7 @@ void QgsComposerMap::drawGridLine( const QLineF& line, QPainter* p )
void QgsComposerMap::drawGridFrameBorder( QPainter* p, const QMap< double, double >& borderPos, Border border )
{
double currentCoord = - mGridFrameWidth;
bool white = true;
bool color1 = true;
double x = 0;
double y = 0;
double width = 0;
@ -1287,10 +1361,15 @@ void QgsComposerMap::drawGridFrameBorder( QPainter* p, const QMap< double, doubl
pos.insert( rect().width() + mGridFrameWidth, rect().width() + mGridFrameWidth );
}
//set pen to current frame pen
QPen framePen = QPen( mGridFramePenColor );
framePen.setWidthF( mGridFramePenThickness );
p->setPen( framePen );
QMap< double, double >::const_iterator posIt = pos.constBegin();
for ( ; posIt != pos.constEnd(); ++posIt )
{
p->setBrush( QBrush( white ? Qt::white : Qt::black ) );
p->setBrush( QBrush( color1 ? mGridFrameFillColor1 : mGridFrameFillColor2 ) );
if ( border == Left || border == Right )
{
height = posIt.key() - currentCoord;
@ -1307,7 +1386,7 @@ void QgsComposerMap::drawGridFrameBorder( QPainter* p, const QMap< double, doubl
}
p->drawRect( QRectF( x, y, width, height ) );
currentCoord = posIt.key();
white = !white;
color1 = !color1;
}
}
@ -1347,7 +1426,7 @@ void QgsComposerMap::drawCoordinateAnnotation( QPainter* p, const QPointF& pos,
double ypos = pos.y();
int rotation = 0;
double gridFrameDistance = ( mGridFrameStyle == NoGridFrame ) ? 0 : mGridFrameWidth;
double gridFrameDistance = ( mGridFrameStyle == NoGridFrame ) ? 0 : mGridFrameWidth + ( mGridFramePenThickness / 2.0 );
if ( frameBorder == Left )
{
@ -1801,7 +1880,7 @@ double QgsComposerMap::maxExtension() const
}
//grid frame
double gridFrameDist = ( mGridFrameStyle == NoGridFrame ) ? 0 : mGridFrameWidth;
double gridFrameDist = ( mGridFrameStyle == NoGridFrame ) ? 0 : mGridFrameWidth + ( mGridFramePenThickness / 2.0 );
return maxExtension + mAnnotationFrameDistance + gridFrameDist;
}

View File

@ -287,6 +287,32 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
void setGridFrameWidth( double w ) { mGridFrameWidth = w; }
double gridFrameWidth() const { return mGridFrameWidth; }
/**Set grid frame pen thickness
@note: this function was added in version 2.1*/
void setGridFramePenSize( double w ) { mGridFramePenThickness = w; }
double gridFramePenSize() const { return mGridFramePenThickness; }
/**Sets pen color for grid frame
@note: this function was added in version 2.1*/
void setGridFramePenColor( const QColor& c ) { mGridFramePenColor = c;}
/**Get pen color for grid frame
@note: this function was added in version 2.1*/
QColor gridFramePenColor() const {return mGridFramePenColor;}
/**Sets first fill color for grid zebra frame
@note: this function was added in version 2.1*/
void setGridFrameFillColor1( const QColor& c ) { mGridFrameFillColor1 = c;}
/**Get first fill color for grid zebra frame
@note: this function was added in version 2.1*/
QColor gridFrameFillColor1() const {return mGridFrameFillColor1;}
/**Sets second fill color for grid zebra frame
@note: this function was added in version 2.1*/
void setGridFrameFillColor2( const QColor& c ) { mGridFrameFillColor2 = c;}
/**Get second fill color for grid zebra frame
@note: this function was added in version 2.1*/
QColor gridFrameFillColor2() const {return mGridFrameFillColor2;}
/**In case of annotations, the bounding rectangle can be larger than the map item rectangle
@note this function was added in version 1.4*/
QRectF boundingRect() const;
@ -470,6 +496,10 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
GridFrameStyle mGridFrameStyle;
double mGridFrameWidth;
double mGridFramePenThickness;
QColor mGridFramePenColor;
QColor mGridFrameFillColor1;
QColor mGridFrameFillColor2;
/**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/
QRectF mCurrentRectangle;

View File

@ -54,9 +54,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-376</y>
<y>-420</y>
<width>439</width>
<height>1439</height>
<height>1509</height>
</rect>
</property>
<property name="sizePolicy">
@ -393,32 +393,6 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mFrameStyleLabel">
<property name="text">
<string>Frame style</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="mFrameStyleComboBox"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="mFrameWidthLabel">
<property name="text">
<string>Frame width</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="mLineStyleLabel">
<property name="text">
<string>Line style</string>
@ -428,17 +402,17 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="4" column="1">
<widget class="QPushButton" name="mGridLineStyleButton">
<property name="text">
<string>change...</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="5" column="1">
<widget class="QgsBlendModeComboBox" name="mGridBlendComboBox"/>
</item>
<item row="7" column="0">
<item row="5" column="0">
<widget class="QLabel" name="mGridBlendLabel">
<property name="text">
<string>Blend mode</string>
@ -460,6 +434,88 @@
</item>
</layout>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mGridFrameGroupBox">
<property name="title">
<string>Grid frame</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="mFrameStyleLabel">
<property name="text">
<string>Frame style</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mFrameStyleComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mFrameWidthLabel">
<property name="text">
<string>Frame size</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mFramePenLabel">
<property name="text">
<string>Frame line thickness</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="mGridFramePenSizeSpinBox"/>
</item>
<item row="2" column="2">
<widget class="QgsColorButton" name="mGridFramePenColorButton">
<property name="text">
<string>Color...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mFrameFillLabel">
<property name="text">
<string>Frame fill colors</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QgsColorButton" name="mGridFrameFill1ColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mGridFrameFill2ColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mDrawAnnotationCheckableGroupBox">
<property name="enabled">

View File

@ -75,7 +75,7 @@ void TestQgsComposerMap::initTestCase()
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
mComposerMap->setFrameEnabled( true );
mComposition->addComposerMap( mComposerMap );
mReport = "<h1>Composer Map Tests</h1>\n";
}
@ -84,7 +84,7 @@ void TestQgsComposerMap::cleanupTestCase()
delete mComposition;
delete mMapRenderer;
delete mRasterLayer;
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@ -92,7 +92,7 @@ void TestQgsComposerMap::cleanupTestCase()
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
}
}
}
void TestQgsComposerMap::init()
@ -108,7 +108,7 @@ void TestQgsComposerMap::render()
{
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
QgsCompositionChecker checker( "composermap_render", mComposition );
QVERIFY( checker.testComposition( mReport ) );
}
@ -132,8 +132,8 @@ void TestQgsComposerMap::grid()
mComposerMap->setGridBlendMode( QPainter::CompositionMode_Overlay );
qWarning() << "grid annotation font: " << mComposerMap->gridAnnotationFont().toString() << " exactMatch:" << mComposerMap->gridAnnotationFont().exactMatch();
QgsCompositionChecker checker( "composermap_grid", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
mComposerMap->setGridEnabled( false );
mComposerMap->setShowGridAnnotation( false );
QVERIFY( testResult );
@ -148,8 +148,8 @@ void TestQgsComposerMap::overviewMap()
overviewMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3350923.125 ) );
overviewMap->setOverviewFrameMap( mComposerMap->id() );
QgsCompositionChecker checker( "composermap_overview", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
mComposition->removeComposerItem( overviewMap );
QVERIFY( testResult );
}
@ -165,8 +165,8 @@ void TestQgsComposerMap::overviewMapBlending()
overviewMapBlend->setOverviewBlendMode( QPainter::CompositionMode_Multiply );
QgsCompositionChecker checker( "composermap_overview_blending", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
mComposition->removeComposerItem( overviewMapBlend );
QVERIFY( testResult );
}
@ -182,8 +182,8 @@ void TestQgsComposerMap::overviewMapInvert()
overviewMapInvert->setOverviewInverted( true );
QgsCompositionChecker checker( "composermap_overview_invert", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
mComposition->removeComposerItem( overviewMapInvert );
QVERIFY( testResult );
}
@ -222,11 +222,16 @@ void TestQgsComposerMap::zebraStyle()
mComposerMap->setGridBlendMode( QPainter::CompositionMode_SourceOver );
mComposerMap->setGridFrameStyle( QgsComposerMap::Zebra );
mComposerMap->setGridFrameWidth( 10 );
mComposerMap->setGridFramePenSize( 1 );
mComposerMap->setGridFramePenColor( QColor( 255, 100, 0, 200 ) );
mComposerMap->setGridFrameFillColor1( QColor( 50, 90, 50, 100 ) );
mComposerMap->setGridFrameFillColor2( QColor( 200, 220, 100, 60 ) );
mComposerMap->setGridEnabled( true );
QgsCompositionChecker checker( "composermap_zebrastyle", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
QVERIFY( testResult );
}
@ -242,8 +247,8 @@ void TestQgsComposerMap::overviewMapCenter()
overviewMapCenter->setOverviewCentered( true );
QgsCompositionChecker checker( "composermap_overview_center", mComposition );
bool testResult = checker.testComposition( mReport);
bool testResult = checker.testComposition( mReport );
mComposition->removeComposerItem( overviewMapCenter );
QVERIFY( testResult );
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 57 KiB