Skip to content
Permalink
Browse files
Merge branch 'composer_grid_master'
  • Loading branch information
mhugent committed Jul 10, 2014
2 parents 9abeeb6 + 0525c01 commit 6097e58a7a29f9983b626bec2333e2baef92029e

Large diffs are not rendered by default.

@@ -56,21 +56,44 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void on_mYMinLineEdit_editingFinished();
void on_mYMaxLineEdit_editingFinished();

void on_mAtlasMarginRadio_toggled( bool checked );

void on_mAtlasCheckBox_toggled( bool checked );
void on_mAtlasMarginSpinBox_valueChanged( int value );
void on_mAtlasFixedScaleRadio_toggled( bool checked );
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );

void on_mAddGridPushButton_clicked();
void on_mRemoveGridPushButton_clicked();
void on_mGridUpButton_clicked();
void on_mGridDownButton_clicked();

QgsComposerMapGrid* currentGrid();
void on_mGridCheckBox_toggled( bool state );
void on_mGridListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous );
void on_mGridListWidget_itemChanged( QListWidgetItem* item );
void setGridItemsEnabled( bool enabled );
void setGridItems( const QgsComposerMapGrid* grid );
void blockGridItemsSignals( bool block );
void updateLineSymbolMarker( const QgsComposerMapGrid* grid );
void on_mGridLineStyleButton_clicked();
void on_mIntervalXSpinBox_editingFinished();
void on_mIntervalYSpinBox_editingFinished();
void on_mOffsetXSpinBox_editingFinished();
void on_mOffsetYSpinBox_editingFinished();
void on_mGridLineStyleButton_clicked();
void on_mOffsetXSpinBox_valueChanged( double value );
void on_mOffsetYSpinBox_valueChanged( double value );
void on_mCrossWidthSpinBox_valueChanged( double val );
void on_mFrameWidthSpinBox_valueChanged( double val );
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
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 );
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
void on_mCrossWidthSpinBox_valueChanged( double d );
void on_mMapGridCRSButton_clicked();
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );
void on_mGridBlendComboBox_currentIndexChanged( int index );
void on_mAnnotationFontButton_clicked();
void on_mAnnotationFontColorButton_colorChanged( const QColor& newFontColor );
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );

void on_mAnnotationFormatComboBox_currentIndexChanged( int index );

void on_mDrawAnnotationGroupBox_toggled( bool state );
//annotation position
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
@@ -83,22 +106,11 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( const QString& text );
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( const QString& text );

void on_mDrawAnnotationCheckableGroupBox_toggled( bool state );
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );

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 );

void on_mAtlasMarginRadio_toggled( bool checked );

void on_mAtlasCheckBox_toggled( bool checked );
void on_mAtlasMarginSpinBox_valueChanged( int value );
void on_mAtlasFixedScaleRadio_toggled( bool checked );
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
void on_mAnnotationFontButton_clicked();
void on_mAnnotationFontColorButton_colorChanged( const QColor &color );

protected:
void showEvent( QShowEvent * event );
@@ -149,9 +161,6 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
/**Updates the map combo box with the current composer map ids*/
void refreshMapComboBox();

/**Enables/disables grid frame related controls*/
void toggleFrameControls( bool frameEnabled );

/**Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
void toggleAtlasScalingOptionsByLayerType();

@@ -161,6 +170,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
/**Is there some predefined scales, globally or as project's options ?*/
bool hasPredefinedScales() const;

QListWidgetItem* addGridListItem( const QString& id, const QString& name );

void loadGridEntries();
};

#endif
@@ -168,6 +168,7 @@ SET(QGIS_CORE_SRCS
composer/qgscomposerlegenditem.cpp
composer/qgscomposerpicture.cpp
composer/qgscomposermap.cpp
composer/qgscomposermapgrid.cpp
composer/qgscomposertable.cpp
composer/qgscomposertablecolumn.cpp
composer/qgscomposerattributetable.cpp
@@ -863,12 +863,13 @@ void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )
mEffect->setEnabled( effectsEnabled );
}

void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c ) const
{
QFont textFont = scaledFontPixelSize( font );

p->save();
p->setFont( textFont );
p->setPen( c );
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
@@ -378,7 +378,7 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem

/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work around the Qt font bug)*/
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c = QColor( 0, 0, 0 ) ) const;

/**Like the above, but with a rectangle for multiline text
* @param p painter to use

1 comment on commit 6097e58

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn commented on 6097e58 Jul 12, 2014

@mhugent very, very nice job :) thanks.

I filed three issues on this:

The third issue is cosmetic in nature, so not as important as the first two. Hope that helps. Cheers, and thanks again.

Please sign in to comment.