Skip to content

Commit a09fbc0

Browse files
committed
Port possibility to have several grids / crs in composer map from QGIS Enterprise to master
1 parent e1385c1 commit a09fbc0

File tree

10 files changed

+2533
-801
lines changed

10 files changed

+2533
-801
lines changed

src/app/composer/qgscomposermapwidget.cpp

Lines changed: 613 additions & 452 deletions
Large diffs are not rendered by default.

src/app/composer/qgscomposermapwidget.h

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,39 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
5656
void on_mYMinLineEdit_editingFinished();
5757
void on_mYMaxLineEdit_editingFinished();
5858

59+
void on_mAtlasMarginRadio_toggled( bool checked );
60+
61+
void on_mAtlasCheckBox_toggled( bool checked );
62+
void on_mAtlasMarginSpinBox_valueChanged( int value );
63+
void on_mAtlasFixedScaleRadio_toggled( bool checked );
64+
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
65+
66+
void on_mAddGridPushButton_clicked();
67+
void on_mRemoveGridPushButton_clicked();
68+
void on_mGridUpButton_clicked();
69+
void on_mGridDownButton_clicked();
70+
71+
QgsComposerMapGrid* currentGrid();
5972
void on_mGridCheckBox_toggled( bool state );
73+
void on_mGridListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous );
74+
void on_mGridListWidget_itemChanged( QListWidgetItem* item );
75+
void setGridItemsEnabled( bool enabled );
76+
void setGridItems( const QgsComposerMapGrid* grid );
77+
void blockGridItemsSignals( bool block );
78+
void updateLineSymbolMarker( const QgsComposerMapGrid* grid );
79+
void on_mGridLineStyleButton_clicked();
6080
void on_mIntervalXSpinBox_editingFinished();
6181
void on_mIntervalYSpinBox_editingFinished();
62-
void on_mOffsetXSpinBox_editingFinished();
63-
void on_mOffsetYSpinBox_editingFinished();
64-
void on_mGridLineStyleButton_clicked();
82+
void on_mOffsetXSpinBox_valueChanged( double value );
83+
void on_mOffsetYSpinBox_valueChanged( double value );
84+
void on_mCrossWidthSpinBox_valueChanged( double val );
85+
void on_mFrameWidthSpinBox_valueChanged( double val );
86+
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
6587
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
66-
void on_mCrossWidthSpinBox_valueChanged( double d );
67-
void on_mGridBlendComboBox_currentIndexChanged( int index );
68-
void on_mAnnotationFontButton_clicked();
69-
void on_mAnnotationFontColorButton_colorChanged( const QColor& newFontColor );
70-
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
71-
72-
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
88+
void on_mMapGridCRSButton_clicked();
89+
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );
7390

91+
void on_mDrawAnnotationGroupBox_toggled( bool state );
7492
//annotation position
7593
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
7694
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
@@ -83,22 +101,11 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
83101
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( const QString& text );
84102
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( const QString& text );
85103

86-
void on_mDrawAnnotationCheckableGroupBox_toggled( bool state );
104+
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
87105
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );
88-
89-
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
90-
void on_mFrameWidthSpinBox_valueChanged( double d );
91-
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
92-
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
93-
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
94-
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );
95-
96-
void on_mAtlasMarginRadio_toggled( bool checked );
97-
98-
void on_mAtlasCheckBox_toggled( bool checked );
99-
void on_mAtlasMarginSpinBox_valueChanged( int value );
100-
void on_mAtlasFixedScaleRadio_toggled( bool checked );
101-
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
106+
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
107+
void on_mAnnotationFontButton_clicked();
108+
void on_mAnnotationFontColorButton_clicked();
102109

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

152-
/**Enables/disables grid frame related controls*/
153-
void toggleFrameControls( bool frameEnabled );
154-
155159
/**Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
156160
void toggleAtlasScalingOptionsByLayerType();
157161

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

168+
QListWidgetItem* addGridListItem( const QString& id, const QString& name );
169+
170+
void loadGridEntries();
164171
};
165172

166173
#endif

src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ SET(QGIS_CORE_SRCS
168168
composer/qgscomposerlegenditem.cpp
169169
composer/qgscomposerpicture.cpp
170170
composer/qgscomposermap.cpp
171+
composer/qgscomposermapgrid.cpp
171172
composer/qgscomposertable.cpp
172173
composer/qgscomposertablecolumn.cpp
173174
composer/qgscomposerattributetable.cpp

src/core/composer/qgscomposeritem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,13 @@ void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )
863863
mEffect->setEnabled( effectsEnabled );
864864
}
865865

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

870870
p->save();
871871
p->setFont( textFont );
872+
p->setPen( c );
872873
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
873874
p->scale( scaleFactor, scaleFactor );
874875
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );

src/core/composer/qgscomposeritem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
378378

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

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

0 commit comments

Comments
 (0)