Skip to content

Commit a9e9a6e

Browse files
authoredOct 6, 2016
Merge pull request #3579 from nyalldawson/composer_dock
Port composer item configuration widgets to inline dock
2 parents e5f7cdc + 521cc3b commit a9e9a6e

20 files changed

+239
-94
lines changed
 

‎python/core/composer/qgscomposeritemcommand.sip

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
4949
//composer label
5050
ComposerLabelSetText,
5151
ComposerLabelSetId,
52+
ComposerLabelFontColor,
5253
//composer map
5354
ComposerMapRotation,
5455
ComposerMapAnnotationDistance,
56+
ComposerMapGridFramePenColor,
57+
ComposerMapGridFrameFill1Color,
58+
ComposerMapGridFrameFill2Color,
59+
ComposerMapGridAnnotationFontColor,
5560
//composer legend
5661
ComposerLegendText,
5762
LegendColumnCount,
@@ -69,8 +74,12 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
6974
LegendBoxSpace,
7075
LegendColumnSpace,
7176
LegendRasterBorderWidth,
77+
LegendFontColor,
78+
LegendRasterBorderColor,
7279
//composer picture
7380
ComposerPictureRotation,
81+
ComposerPictureFillColor,
82+
ComposerPictureOutlineColor,
7483
// composer scalebar
7584
ScaleBarLineWidth,
7685
ScaleBarHeight,
@@ -81,6 +90,10 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
8190
ScaleBarMapUnitsSegment,
8291
ScaleBarLabelBarSize,
8392
ScaleBarBoxContentSpace,
93+
ScaleBarFontColor,
94+
ScaleBarFillColor,
95+
ScaleBarFill2Color,
96+
ScaleBarStrokeColor,
8497
// composer table
8598
TableMaximumFeatures,
8699
TableMargin,
@@ -90,9 +103,13 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
90103
ShapeOutlineWidth,
91104
//composer arrow
92105
ArrowOutlineWidth,
106+
ArrowHeadFillColor,
107+
ArrowHeadOutlineColor,
93108
ArrowHeadWidth,
94109
//item
95110
ItemOutlineWidth,
111+
ItemOutlineColor,
112+
ItemBackgroundColor,
96113
ItemMove,
97114
ItemRotation,
98115
ItemTransparency,

‎python/core/composer/qgscomposermultiframecommand.sip

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class QgsComposerMultiFrameMergeCommand: QgsComposerMultiFrameCommand
4949
TableMaximumFeatures,
5050
TableMargin,
5151
TableGridStrokeWidth,
52-
TableCellStyle
52+
TableCellStyle,
53+
TableHeaderFontColor,
54+
TableContentFontColor,
55+
TableGridColor,
56+
TableBackgroundColor,
5357
};
5458

5559
QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );

‎src/app/composer/qgscomposer.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include "qgsvectorlayer.h"
6868
#include "qgscomposerimageexportoptionsdialog.h"
6969
#include "ui_qgssvgexportoptions.h"
70+
#include "qgspanelwidgetstack.h"
7071

7172
#include <QCloseEvent>
7273
#include <QCheckBox>
@@ -578,6 +579,8 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
578579
mItemDock = new QgsDockWidget( tr( "Item properties" ), this );
579580
mItemDock->setObjectName( "ItemDock" );
580581
mItemDock->setMinimumWidth( minDockWidth );
582+
mItemPropertiesStack = new QgsPanelWidgetStack();
583+
mItemDock->setWidget( mItemPropertiesStack );
581584
mPanelMenu->addAction( mItemDock->toggleViewAction() );
582585
mUndoDock = new QgsDockWidget( tr( "Command history" ), this );
583586
mUndoDock->setObjectName( "CommandDock" );
@@ -996,28 +999,27 @@ void QgsComposer::updateStatusAtlasMsg( const QString& message )
996999

9971000
void QgsComposer::showItemOptions( QgsComposerItem* item )
9981001
{
999-
QWidget* currentWidget = mItemDock->widget();
1000-
10011002
if ( !item )
10021003
{
1003-
mItemDock->setWidget( nullptr );
1004+
mItemPropertiesStack->takeMainPanel();
10041005
return;
10051006
}
10061007

1007-
QMap<QgsComposerItem*, QWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
1008+
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
10081009
if ( it == mItemWidgetMap.constEnd() )
10091010
{
10101011
return;
10111012
}
10121013

1013-
QWidget* newWidget = it.value();
1014-
1015-
if ( !newWidget || newWidget == currentWidget ) //bail out if new widget does not exist or is already there
1014+
QgsPanelWidget* newWidget = it.value();
1015+
if ( !newWidget || newWidget == mItemPropertiesStack->mainPanel() ) //bail out if new widget does not exist or is already there
10161016
{
10171017
return;
10181018
}
10191019

1020-
mItemDock->setWidget( newWidget );
1020+
( void ) mItemPropertiesStack->takeMainPanel();
1021+
newWidget->setDockMode( true );
1022+
mItemPropertiesStack->setMainPanel( newWidget );
10211023
}
10221024

10231025
void QgsComposer::on_mActionOptions_triggered()
@@ -3774,7 +3776,7 @@ void QgsComposer::addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame*
37743776

37753777
void QgsComposer::deleteItem( QgsComposerItem* item )
37763778
{
3777-
QMap<QgsComposerItem*, QWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
3779+
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
37783780

37793781
if ( it == mItemWidgetMap.constEnd() )
37803782
{
@@ -3800,7 +3802,7 @@ void QgsComposer::setSelectionTool()
38003802

38013803
bool QgsComposer::containsWmsLayer() const
38023804
{
3803-
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
3805+
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
38043806
QgsComposerItem* currentItem = nullptr;
38053807
QgsComposerMap* currentMap = nullptr;
38063808

@@ -3822,7 +3824,7 @@ bool QgsComposer::containsWmsLayer() const
38223824
bool QgsComposer::containsAdvancedEffects() const
38233825
{
38243826
// Check if composer contains any blend modes or flattened layers for transparency
3825-
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
3827+
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
38263828
QgsComposerItem* currentItem = nullptr;
38273829
QgsComposerMap* currentMap = nullptr;
38283830

@@ -3893,7 +3895,7 @@ void QgsComposer::showAdvancedEffectsWarning()
38933895

38943896
void QgsComposer::cleanupAfterTemplateRead()
38953897
{
3896-
QMap<QgsComposerItem*, QWidget*>::const_iterator itemIt = mItemWidgetMap.constBegin();
3898+
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator itemIt = mItemWidgetMap.constBegin();
38973899
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
38983900
{
38993901
//update all legends completely

‎src/app/composer/qgscomposer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define QGSCOMPOSER_H
1919
#include "ui_qgscomposerbase.h"
2020

21+
#include "qgspanelwidget.h"
2122
class QgisApp;
2223
class QgsComposerArrow;
2324
class QgsComposerPolygon;
@@ -44,6 +45,7 @@ class QgsDockWidget;
4445
class QgsMapLayer;
4546
class QgsFeature;
4647
class QgsVectorLayer;
48+
class QgsPanelWidgetStack;
4749

4850
class QGridLayout;
4951
class QDomNode;
@@ -568,7 +570,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
568570
QSizeGrip *mSizeGrip;
569571

570572
//! To know which item to show if selection changes
571-
QMap<QgsComposerItem*, QWidget*> mItemWidgetMap;
573+
QMap<QgsComposerItem*, QgsPanelWidget*> mItemWidgetMap;
572574

573575
//! Window menu action to select this window
574576
QAction *mWindowAction;
@@ -597,6 +599,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
597599
QMap< QgsComposerMap*, int > mMapsToRestore;
598600

599601
QgsDockWidget* mItemDock;
602+
QgsPanelWidgetStack* mItemPropertiesStack;
600603
QgsDockWidget* mUndoDock;
601604
QgsDockWidget* mGeneralDock;
602605
QgsDockWidget* mAtlasDock;

‎src/app/composer/qgscomposerarrowwidget.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( nullptr, arrow ), mArrow( arrow )
2929
{
3030
setupUi( this );
31+
setPanelTitle( tr( "Arrow properties" ) );
3132
mRadioButtonGroup = new QButtonGroup( this );
3233
mRadioButtonGroup->addButton( mDefaultMarkerRadioButton );
3334
mRadioButtonGroup->addButton( mNoMarkerRadioButton );
@@ -98,7 +99,7 @@ void QgsComposerArrowWidget::on_mArrowHeadFillColorButton_colorChanged( const QC
9899
return;
99100
}
100101

101-
mArrow->beginCommand( tr( "Arrow head fill color" ) );
102+
mArrow->beginCommand( tr( "Arrow head fill color" ), QgsComposerMergeCommand::ArrowHeadFillColor );
102103
mArrow->setArrowHeadFillColor( newColor );
103104
mArrow->update();
104105
mArrow->endCommand();
@@ -111,7 +112,7 @@ void QgsComposerArrowWidget::on_mArrowHeadOutlineColorButton_colorChanged( const
111112
return;
112113
}
113114

114-
mArrow->beginCommand( tr( "Arrow head outline color" ) );
115+
mArrow->beginCommand( tr( "Arrow head outline color" ), QgsComposerMergeCommand::ArrowHeadOutlineColor );
115116
mArrow->setArrowHeadOutlineColor( newColor );
116117
mArrow->update();
117118
mArrow->endCommand();

‎src/app/composer/qgscomposerattributetablewidget.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAtt
3939
, mFrame( frame )
4040
{
4141
setupUi( this );
42+
setPanelTitle( tr( "Table properties" ) );
4243

4344
blockAllSignals( true );
4445

@@ -268,7 +269,7 @@ void QgsComposerAttributeTableWidget::on_mHeaderFontColorButton_colorChanged( co
268269
QgsComposition* composition = mComposerTable->composition();
269270
if ( composition )
270271
{
271-
composition->beginMultiFrameCommand( mComposerTable, tr( "Table header font color" ) );
272+
composition->beginMultiFrameCommand( mComposerTable, tr( "Table header font color" ), QgsComposerMultiFrameMergeCommand::TableHeaderFontColor );
272273
}
273274
mComposerTable->setHeaderFontColor( newColor );
274275
if ( composition )
@@ -309,7 +310,7 @@ void QgsComposerAttributeTableWidget::on_mContentFontColorButton_colorChanged( c
309310
QgsComposition* composition = mComposerTable->composition();
310311
if ( composition )
311312
{
312-
composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font color" ) );
313+
composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font color" ), QgsComposerMultiFrameMergeCommand::TableContentFontColor );
313314
}
314315
mComposerTable->setContentFontColor( newColor );
315316
if ( composition )
@@ -347,7 +348,7 @@ void QgsComposerAttributeTableWidget::on_mGridColorButton_colorChanged( const QC
347348
QgsComposition* composition = mComposerTable->composition();
348349
if ( composition )
349350
{
350-
composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid color" ) );
351+
composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid color" ), QgsComposerMultiFrameMergeCommand::TableGridColor );
351352
}
352353
mComposerTable->setGridColor( newColor );
353354
if ( composition )
@@ -385,7 +386,7 @@ void QgsComposerAttributeTableWidget::on_mBackgroundColorButton_colorChanged( co
385386
QgsComposition* composition = mComposerTable->composition();
386387
if ( composition )
387388
{
388-
composition->beginMultiFrameCommand( mComposerTable, tr( "Table background color" ) );
389+
composition->beginMultiFrameCommand( mComposerTable, tr( "Table background color" ), QgsComposerMultiFrameMergeCommand::TableBackgroundColor );
389390
}
390391
mComposerTable->setBackgroundColor( newColor );
391392
if ( composition )

‎src/app/composer/qgscomposerhtmlwidget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposer
3131
, mFrame( frame )
3232
{
3333
setupUi( this );
34+
setPanelTitle( tr( "HTML properties" ) );
3435

3536
//setup html editor
3637
mHtmlEditor = new QgsCodeEditorHTML( this );

0 commit comments

Comments
 (0)
Please sign in to comment.