Skip to content

Commit

Permalink
Merge branch 'composer_grid_master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 10, 2014
2 parents 9abeeb6 + 0525c01 commit 6097e58
Show file tree
Hide file tree
Showing 10 changed files with 3,340 additions and 1,934 deletions.
1,119 changes: 690 additions & 429 deletions src/app/composer/qgscomposermapwidget.cpp

Large diffs are not rendered by default.

66 changes: 39 additions & 27 deletions src/app/composer/qgscomposermapwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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();

Expand All @@ -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
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

1 comment on commit 6097e58

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 6097e58 Jul 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.