Skip to content

Commit 9263abe

Browse files
committedOct 11, 2016
[composer] Move all grid settings into seperate panel
Now grid settings are accessed by clicking "Modify grid" from the composer map properties panel. This opens a new stacked panel with all the grid settings. This helps make the composer map widget less confusing. Before it was absolutely jammed with controls, including lots of nested groups.
1 parent 0dc5e83 commit 9263abe

File tree

7 files changed

+2267
-1855
lines changed

7 files changed

+2267
-1855
lines changed
 

‎src/app/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ SET(QGIS_APP_SRCS
139139
composer/qgscomposerlabelwidget.cpp
140140
composer/qgscomposerpicturewidget.cpp
141141
composer/qgscomposermanager.cpp
142+
composer/qgscomposermapgridwidget.cpp
142143
composer/qgscomposermapwidget.cpp
143144
composer/qgscomposerscalebarwidget.cpp
144145
composer/qgscomposershapewidget.cpp
@@ -314,6 +315,7 @@ SET (QGIS_APP_MOC_HDRS
314315
composer/qgscomposerlegenditemdialog.h
315316
composer/qgscomposerlegendlayersdialog.h
316317
composer/qgscomposermanager.h
318+
composer/qgscomposermapgridwidget.h
317319
composer/qgscomposermapwidget.h
318320
composer/qgscomposerpicturewidget.h
319321
composer/qgscomposerscalebarwidget.h

‎src/app/composer/qgscomposermapgridwidget.cpp

Lines changed: 1223 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/***************************************************************************
2+
qgscomposermapgridwidget.h
3+
----------------------
4+
begin : October 2016
5+
copyright : (C) 2016 by Nyall Dawson
6+
email : nyall dot dawson at gmail dot com
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#ifndef QGSCOMPOSERMAPGRIDWIDGET_H
19+
#define QGSCOMPOSERMAPGRIDWIDGET_H
20+
21+
#include "ui_qgscomposermapgridwidgetbase.h"
22+
#include "qgscomposeritemwidget.h"
23+
#include "qgscomposermapgrid.h"
24+
25+
/** \ingroup app
26+
* Input widget for the configuration of QgsComposerMapGrids
27+
* */
28+
class QgsComposerMapGridWidget: public QgsComposerItemBaseWidget, private Ui::QgsComposerMapGridWidgetBase
29+
{
30+
Q_OBJECT
31+
32+
public:
33+
explicit QgsComposerMapGridWidget( QgsComposerMapGrid* mapGrid, QgsComposerMap* composerMap );
34+
virtual ~QgsComposerMapGridWidget();
35+
36+
public slots:
37+
38+
void setGridItems();
39+
void on_mGridLineStyleButton_clicked();
40+
void on_mGridMarkerStyleButton_clicked();
41+
void on_mIntervalXSpinBox_editingFinished();
42+
void on_mIntervalYSpinBox_editingFinished();
43+
void on_mOffsetXSpinBox_valueChanged( double value );
44+
void on_mOffsetYSpinBox_valueChanged( double value );
45+
void on_mCrossWidthSpinBox_valueChanged( double val );
46+
void on_mFrameWidthSpinBox_valueChanged( double val );
47+
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
48+
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
49+
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
50+
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
51+
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );
52+
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
53+
void on_mMapGridCRSButton_clicked();
54+
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );
55+
void on_mGridBlendComboBox_currentIndexChanged( int index );
56+
void on_mCheckGridLeftSide_toggled( bool checked );
57+
void on_mCheckGridRightSide_toggled( bool checked );
58+
void on_mCheckGridTopSide_toggled( bool checked );
59+
void on_mCheckGridBottomSide_toggled( bool checked );
60+
61+
//frame divisions display
62+
void on_mFrameDivisionsLeftComboBox_currentIndexChanged( int index );
63+
void on_mFrameDivisionsRightComboBox_currentIndexChanged( int index );
64+
void on_mFrameDivisionsTopComboBox_currentIndexChanged( int index );
65+
void on_mFrameDivisionsBottomComboBox_currentIndexChanged( int index );
66+
67+
void on_mDrawAnnotationGroupBox_toggled( bool state );
68+
void on_mAnnotationFormatButton_clicked();
69+
70+
//annotation display
71+
void on_mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString& text );
72+
void on_mAnnotationDisplayRightComboBox_currentIndexChanged( const QString& text );
73+
void on_mAnnotationDisplayTopComboBox_currentIndexChanged( const QString& text );
74+
void on_mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString& text );
75+
76+
//annotation position
77+
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
78+
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
79+
void on_mAnnotationPositionTopComboBox_currentIndexChanged( const QString& text );
80+
void on_mAnnotationPositionBottomComboBox_currentIndexChanged( const QString& text );
81+
82+
//annotation direction
83+
void on_mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index );
84+
void on_mAnnotationDirectionComboBoxRight_currentIndexChanged( int index );
85+
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( int index );
86+
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index );
87+
88+
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
89+
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );
90+
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
91+
void on_mAnnotationFontButton_clicked();
92+
void on_mAnnotationFontColorButton_colorChanged( const QColor &color );
93+
94+
protected:
95+
96+
/** Sets the current composer map values to the GUI elements*/
97+
virtual void updateGuiElements();
98+
99+
protected slots:
100+
/** Initializes data defined buttons to current atlas coverage layer*/
101+
void populateDataDefinedButtons();
102+
103+
private slots:
104+
105+
/** Sets the GUI elements to the values of mPicture*/
106+
void setGuiElementValues();
107+
108+
void updateGridLineStyleFromWidget();
109+
void cleanUpGridLineStyleSelector( QgsPanelWidget* container );
110+
void updateGridMarkerStyleFromWidget();
111+
void cleanUpGridMarkerStyleSelector( QgsPanelWidget* container );
112+
113+
private:
114+
QgsComposerMap* mComposerMap;
115+
QgsComposerMapGrid* mComposerMapGrid;
116+
117+
/** Blocks / unblocks the signals of all GUI elements*/
118+
void blockAllSignals( bool b );
119+
120+
void handleChangedFrameDisplay( QgsComposerMapGrid::BorderSide border, const QgsComposerMapGrid::DisplayMode mode );
121+
void handleChangedAnnotationDisplay( QgsComposerMapGrid::BorderSide border, const QString& text );
122+
void handleChangedAnnotationPosition( QgsComposerMapGrid::BorderSide border, const QString& text );
123+
void handleChangedAnnotationDirection( QgsComposerMapGrid::BorderSide border, QgsComposerMapGrid::AnnotationDirection direction );
124+
125+
void insertFrameDisplayEntries( QComboBox* c );
126+
void insertAnnotationDisplayEntries( QComboBox* c );
127+
void insertAnnotationPositionEntries( QComboBox* c );
128+
void insertAnnotationDirectionEntries( QComboBox* c );
129+
130+
void initFrameDisplayBox( QComboBox* c, QgsComposerMapGrid::DisplayMode display );
131+
void initAnnotationDisplayBox( QComboBox* c, QgsComposerMapGrid::DisplayMode display );
132+
void initAnnotationPositionBox( QComboBox* c, QgsComposerMapGrid::AnnotationPosition pos );
133+
void initAnnotationDirectionBox( QComboBox* c, QgsComposerMapGrid::AnnotationDirection dir );
134+
135+
void updateGridLineSymbolMarker();
136+
void updateGridMarkerSymbolMarker();
137+
138+
/** Enables/disables grid frame related controls*/
139+
void toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled );
140+
141+
/** Is there some predefined scales, globally or as project's options ?*/
142+
bool hasPredefinedScales() const;
143+
144+
};
145+
146+
#endif //QGSCOMPOSERMAPGRIDWIDGET_H

‎src/app/composer/qgscomposermapwidget.cpp

Lines changed: 45 additions & 1053 deletions
Large diffs are not rendered by default.

‎src/app/composer/qgscomposermapwidget.h

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -71,66 +71,10 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
7171
void on_mGridDownButton_clicked();
7272

7373
QgsComposerMapGrid* currentGrid();
74-
void on_mGridCheckBox_toggled( bool state );
74+
void on_mDrawGridCheckBox_toggled( bool state );
7575
void on_mGridListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous );
7676
void on_mGridListWidget_itemChanged( QListWidgetItem* item );
77-
void setGridItemsEnabled( bool enabled );
78-
void setGridItems( const QgsComposerMapGrid* grid );
79-
void blockGridItemsSignals( bool block );
80-
void on_mGridLineStyleButton_clicked();
81-
void on_mGridMarkerStyleButton_clicked();
82-
void on_mIntervalXSpinBox_editingFinished();
83-
void on_mIntervalYSpinBox_editingFinished();
84-
void on_mOffsetXSpinBox_valueChanged( double value );
85-
void on_mOffsetYSpinBox_valueChanged( double value );
86-
void on_mCrossWidthSpinBox_valueChanged( double val );
87-
void on_mFrameWidthSpinBox_valueChanged( double val );
88-
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
89-
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
90-
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
91-
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
92-
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );
93-
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
94-
void on_mMapGridCRSButton_clicked();
95-
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );
96-
void on_mGridBlendComboBox_currentIndexChanged( int index );
97-
void on_mCheckGridLeftSide_toggled( bool checked );
98-
void on_mCheckGridRightSide_toggled( bool checked );
99-
void on_mCheckGridTopSide_toggled( bool checked );
100-
void on_mCheckGridBottomSide_toggled( bool checked );
101-
102-
//frame divisions display
103-
void on_mFrameDivisionsLeftComboBox_currentIndexChanged( int index );
104-
void on_mFrameDivisionsRightComboBox_currentIndexChanged( int index );
105-
void on_mFrameDivisionsTopComboBox_currentIndexChanged( int index );
106-
void on_mFrameDivisionsBottomComboBox_currentIndexChanged( int index );
107-
108-
void on_mDrawAnnotationGroupBox_toggled( bool state );
109-
void on_mAnnotationFormatButton_clicked();
110-
111-
//annotation display
112-
void on_mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString& text );
113-
void on_mAnnotationDisplayRightComboBox_currentIndexChanged( const QString& text );
114-
void on_mAnnotationDisplayTopComboBox_currentIndexChanged( const QString& text );
115-
void on_mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString& text );
116-
117-
//annotation position
118-
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
119-
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
120-
void on_mAnnotationPositionTopComboBox_currentIndexChanged( const QString& text );
121-
void on_mAnnotationPositionBottomComboBox_currentIndexChanged( const QString& text );
122-
123-
//annotation direction
124-
void on_mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index );
125-
void on_mAnnotationDirectionComboBoxRight_currentIndexChanged( int index );
126-
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( int index );
127-
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index );
128-
129-
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
130-
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );
131-
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
132-
void on_mAnnotationFontButton_clicked();
133-
void on_mAnnotationFontColorButton_colorChanged( const QColor &color );
77+
void on_mGridPropertiesButton_clicked();
13478

13579
//overviews
13680
void on_mAddOverviewPushButton_clicked();
@@ -174,10 +118,6 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
174118

175119
void onPresetsChanged();
176120

177-
void updateGridLineStyleFromWidget();
178-
void cleanUpGridLineStyleSelector( QgsPanelWidget* container );
179-
void updateGridMarkerStyleFromWidget();
180-
void cleanUpGridMarkerStyleSelector( QgsPanelWidget* container );
181121
void updateOverviewFrameStyleFromWidget();
182122
void cleanUpOverviewFrameStyleSelector( QgsPanelWidget* container );
183123

@@ -205,12 +145,6 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
205145
void initAnnotationPositionBox( QComboBox* c, QgsComposerMapGrid::AnnotationPosition pos );
206146
void initAnnotationDirectionBox( QComboBox* c, QgsComposerMapGrid::AnnotationDirection dir );
207147

208-
void updateGridLineSymbolMarker( const QgsComposerMapGrid* grid );
209-
void updateGridMarkerSymbolMarker( const QgsComposerMapGrid* grid );
210-
211-
/** Enables/disables grid frame related controls*/
212-
void toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled );
213-
214148
/** Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
215149
void toggleAtlasScalingOptionsByLayerType();
216150

‎src/ui/composer/qgscomposermapgridwidgetbase.ui

Lines changed: 816 additions & 0 deletions
Large diffs are not rendered by default.

‎src/ui/composer/qgscomposermapwidgetbase.ui

Lines changed: 33 additions & 734 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.