mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #3579 from nyalldawson/composer_dock
Port composer item configuration widgets to inline dock
This commit is contained in:
commit
a9e9a6e497
@ -49,9 +49,14 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
|
|||||||
//composer label
|
//composer label
|
||||||
ComposerLabelSetText,
|
ComposerLabelSetText,
|
||||||
ComposerLabelSetId,
|
ComposerLabelSetId,
|
||||||
|
ComposerLabelFontColor,
|
||||||
//composer map
|
//composer map
|
||||||
ComposerMapRotation,
|
ComposerMapRotation,
|
||||||
ComposerMapAnnotationDistance,
|
ComposerMapAnnotationDistance,
|
||||||
|
ComposerMapGridFramePenColor,
|
||||||
|
ComposerMapGridFrameFill1Color,
|
||||||
|
ComposerMapGridFrameFill2Color,
|
||||||
|
ComposerMapGridAnnotationFontColor,
|
||||||
//composer legend
|
//composer legend
|
||||||
ComposerLegendText,
|
ComposerLegendText,
|
||||||
LegendColumnCount,
|
LegendColumnCount,
|
||||||
@ -69,8 +74,12 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
|
|||||||
LegendBoxSpace,
|
LegendBoxSpace,
|
||||||
LegendColumnSpace,
|
LegendColumnSpace,
|
||||||
LegendRasterBorderWidth,
|
LegendRasterBorderWidth,
|
||||||
|
LegendFontColor,
|
||||||
|
LegendRasterBorderColor,
|
||||||
//composer picture
|
//composer picture
|
||||||
ComposerPictureRotation,
|
ComposerPictureRotation,
|
||||||
|
ComposerPictureFillColor,
|
||||||
|
ComposerPictureOutlineColor,
|
||||||
// composer scalebar
|
// composer scalebar
|
||||||
ScaleBarLineWidth,
|
ScaleBarLineWidth,
|
||||||
ScaleBarHeight,
|
ScaleBarHeight,
|
||||||
@ -81,6 +90,10 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
|
|||||||
ScaleBarMapUnitsSegment,
|
ScaleBarMapUnitsSegment,
|
||||||
ScaleBarLabelBarSize,
|
ScaleBarLabelBarSize,
|
||||||
ScaleBarBoxContentSpace,
|
ScaleBarBoxContentSpace,
|
||||||
|
ScaleBarFontColor,
|
||||||
|
ScaleBarFillColor,
|
||||||
|
ScaleBarFill2Color,
|
||||||
|
ScaleBarStrokeColor,
|
||||||
// composer table
|
// composer table
|
||||||
TableMaximumFeatures,
|
TableMaximumFeatures,
|
||||||
TableMargin,
|
TableMargin,
|
||||||
@ -90,9 +103,13 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
|
|||||||
ShapeOutlineWidth,
|
ShapeOutlineWidth,
|
||||||
//composer arrow
|
//composer arrow
|
||||||
ArrowOutlineWidth,
|
ArrowOutlineWidth,
|
||||||
|
ArrowHeadFillColor,
|
||||||
|
ArrowHeadOutlineColor,
|
||||||
ArrowHeadWidth,
|
ArrowHeadWidth,
|
||||||
//item
|
//item
|
||||||
ItemOutlineWidth,
|
ItemOutlineWidth,
|
||||||
|
ItemOutlineColor,
|
||||||
|
ItemBackgroundColor,
|
||||||
ItemMove,
|
ItemMove,
|
||||||
ItemRotation,
|
ItemRotation,
|
||||||
ItemTransparency,
|
ItemTransparency,
|
||||||
|
@ -49,7 +49,11 @@ class QgsComposerMultiFrameMergeCommand: QgsComposerMultiFrameCommand
|
|||||||
TableMaximumFeatures,
|
TableMaximumFeatures,
|
||||||
TableMargin,
|
TableMargin,
|
||||||
TableGridStrokeWidth,
|
TableGridStrokeWidth,
|
||||||
TableCellStyle
|
TableCellStyle,
|
||||||
|
TableHeaderFontColor,
|
||||||
|
TableContentFontColor,
|
||||||
|
TableGridColor,
|
||||||
|
TableBackgroundColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
|
QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
#include "qgscomposerimageexportoptionsdialog.h"
|
#include "qgscomposerimageexportoptionsdialog.h"
|
||||||
#include "ui_qgssvgexportoptions.h"
|
#include "ui_qgssvgexportoptions.h"
|
||||||
|
#include "qgspanelwidgetstack.h"
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@ -578,6 +579,8 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
|
|||||||
mItemDock = new QgsDockWidget( tr( "Item properties" ), this );
|
mItemDock = new QgsDockWidget( tr( "Item properties" ), this );
|
||||||
mItemDock->setObjectName( "ItemDock" );
|
mItemDock->setObjectName( "ItemDock" );
|
||||||
mItemDock->setMinimumWidth( minDockWidth );
|
mItemDock->setMinimumWidth( minDockWidth );
|
||||||
|
mItemPropertiesStack = new QgsPanelWidgetStack();
|
||||||
|
mItemDock->setWidget( mItemPropertiesStack );
|
||||||
mPanelMenu->addAction( mItemDock->toggleViewAction() );
|
mPanelMenu->addAction( mItemDock->toggleViewAction() );
|
||||||
mUndoDock = new QgsDockWidget( tr( "Command history" ), this );
|
mUndoDock = new QgsDockWidget( tr( "Command history" ), this );
|
||||||
mUndoDock->setObjectName( "CommandDock" );
|
mUndoDock->setObjectName( "CommandDock" );
|
||||||
@ -996,28 +999,27 @@ void QgsComposer::updateStatusAtlasMsg( const QString& message )
|
|||||||
|
|
||||||
void QgsComposer::showItemOptions( QgsComposerItem* item )
|
void QgsComposer::showItemOptions( QgsComposerItem* item )
|
||||||
{
|
{
|
||||||
QWidget* currentWidget = mItemDock->widget();
|
|
||||||
|
|
||||||
if ( !item )
|
if ( !item )
|
||||||
{
|
{
|
||||||
mItemDock->setWidget( nullptr );
|
mItemPropertiesStack->takeMainPanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QgsComposerItem*, QWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
|
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
|
||||||
if ( it == mItemWidgetMap.constEnd() )
|
if ( it == mItemWidgetMap.constEnd() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* newWidget = it.value();
|
QgsPanelWidget* newWidget = it.value();
|
||||||
|
if ( !newWidget || newWidget == mItemPropertiesStack->mainPanel() ) //bail out if new widget does not exist or is already there
|
||||||
if ( !newWidget || newWidget == currentWidget ) //bail out if new widget does not exist or is already there
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mItemDock->setWidget( newWidget );
|
( void ) mItemPropertiesStack->takeMainPanel();
|
||||||
|
newWidget->setDockMode( true );
|
||||||
|
mItemPropertiesStack->setMainPanel( newWidget );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposer::on_mActionOptions_triggered()
|
void QgsComposer::on_mActionOptions_triggered()
|
||||||
@ -3774,7 +3776,7 @@ void QgsComposer::addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame*
|
|||||||
|
|
||||||
void QgsComposer::deleteItem( QgsComposerItem* item )
|
void QgsComposer::deleteItem( QgsComposerItem* item )
|
||||||
{
|
{
|
||||||
QMap<QgsComposerItem*, QWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
|
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator it = mItemWidgetMap.constFind( item );
|
||||||
|
|
||||||
if ( it == mItemWidgetMap.constEnd() )
|
if ( it == mItemWidgetMap.constEnd() )
|
||||||
{
|
{
|
||||||
@ -3800,7 +3802,7 @@ void QgsComposer::setSelectionTool()
|
|||||||
|
|
||||||
bool QgsComposer::containsWmsLayer() const
|
bool QgsComposer::containsWmsLayer() const
|
||||||
{
|
{
|
||||||
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
|
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
|
||||||
QgsComposerItem* currentItem = nullptr;
|
QgsComposerItem* currentItem = nullptr;
|
||||||
QgsComposerMap* currentMap = nullptr;
|
QgsComposerMap* currentMap = nullptr;
|
||||||
|
|
||||||
@ -3822,7 +3824,7 @@ bool QgsComposer::containsWmsLayer() const
|
|||||||
bool QgsComposer::containsAdvancedEffects() const
|
bool QgsComposer::containsAdvancedEffects() const
|
||||||
{
|
{
|
||||||
// Check if composer contains any blend modes or flattened layers for transparency
|
// Check if composer contains any blend modes or flattened layers for transparency
|
||||||
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
|
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
|
||||||
QgsComposerItem* currentItem = nullptr;
|
QgsComposerItem* currentItem = nullptr;
|
||||||
QgsComposerMap* currentMap = nullptr;
|
QgsComposerMap* currentMap = nullptr;
|
||||||
|
|
||||||
@ -3893,7 +3895,7 @@ void QgsComposer::showAdvancedEffectsWarning()
|
|||||||
|
|
||||||
void QgsComposer::cleanupAfterTemplateRead()
|
void QgsComposer::cleanupAfterTemplateRead()
|
||||||
{
|
{
|
||||||
QMap<QgsComposerItem*, QWidget*>::const_iterator itemIt = mItemWidgetMap.constBegin();
|
QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator itemIt = mItemWidgetMap.constBegin();
|
||||||
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
|
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
|
||||||
{
|
{
|
||||||
//update all legends completely
|
//update all legends completely
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define QGSCOMPOSER_H
|
#define QGSCOMPOSER_H
|
||||||
#include "ui_qgscomposerbase.h"
|
#include "ui_qgscomposerbase.h"
|
||||||
|
|
||||||
|
#include "qgspanelwidget.h"
|
||||||
class QgisApp;
|
class QgisApp;
|
||||||
class QgsComposerArrow;
|
class QgsComposerArrow;
|
||||||
class QgsComposerPolygon;
|
class QgsComposerPolygon;
|
||||||
@ -44,6 +45,7 @@ class QgsDockWidget;
|
|||||||
class QgsMapLayer;
|
class QgsMapLayer;
|
||||||
class QgsFeature;
|
class QgsFeature;
|
||||||
class QgsVectorLayer;
|
class QgsVectorLayer;
|
||||||
|
class QgsPanelWidgetStack;
|
||||||
|
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
class QDomNode;
|
class QDomNode;
|
||||||
@ -568,7 +570,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
|||||||
QSizeGrip *mSizeGrip;
|
QSizeGrip *mSizeGrip;
|
||||||
|
|
||||||
//! To know which item to show if selection changes
|
//! To know which item to show if selection changes
|
||||||
QMap<QgsComposerItem*, QWidget*> mItemWidgetMap;
|
QMap<QgsComposerItem*, QgsPanelWidget*> mItemWidgetMap;
|
||||||
|
|
||||||
//! Window menu action to select this window
|
//! Window menu action to select this window
|
||||||
QAction *mWindowAction;
|
QAction *mWindowAction;
|
||||||
@ -597,6 +599,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
|||||||
QMap< QgsComposerMap*, int > mMapsToRestore;
|
QMap< QgsComposerMap*, int > mMapsToRestore;
|
||||||
|
|
||||||
QgsDockWidget* mItemDock;
|
QgsDockWidget* mItemDock;
|
||||||
|
QgsPanelWidgetStack* mItemPropertiesStack;
|
||||||
QgsDockWidget* mUndoDock;
|
QgsDockWidget* mUndoDock;
|
||||||
QgsDockWidget* mGeneralDock;
|
QgsDockWidget* mGeneralDock;
|
||||||
QgsDockWidget* mAtlasDock;
|
QgsDockWidget* mAtlasDock;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( nullptr, arrow ), mArrow( arrow )
|
QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( nullptr, arrow ), mArrow( arrow )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Arrow properties" ) );
|
||||||
mRadioButtonGroup = new QButtonGroup( this );
|
mRadioButtonGroup = new QButtonGroup( this );
|
||||||
mRadioButtonGroup->addButton( mDefaultMarkerRadioButton );
|
mRadioButtonGroup->addButton( mDefaultMarkerRadioButton );
|
||||||
mRadioButtonGroup->addButton( mNoMarkerRadioButton );
|
mRadioButtonGroup->addButton( mNoMarkerRadioButton );
|
||||||
@ -98,7 +99,7 @@ void QgsComposerArrowWidget::on_mArrowHeadFillColorButton_colorChanged( const QC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mArrow->beginCommand( tr( "Arrow head fill color" ) );
|
mArrow->beginCommand( tr( "Arrow head fill color" ), QgsComposerMergeCommand::ArrowHeadFillColor );
|
||||||
mArrow->setArrowHeadFillColor( newColor );
|
mArrow->setArrowHeadFillColor( newColor );
|
||||||
mArrow->update();
|
mArrow->update();
|
||||||
mArrow->endCommand();
|
mArrow->endCommand();
|
||||||
@ -111,7 +112,7 @@ void QgsComposerArrowWidget::on_mArrowHeadOutlineColorButton_colorChanged( const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mArrow->beginCommand( tr( "Arrow head outline color" ) );
|
mArrow->beginCommand( tr( "Arrow head outline color" ), QgsComposerMergeCommand::ArrowHeadOutlineColor );
|
||||||
mArrow->setArrowHeadOutlineColor( newColor );
|
mArrow->setArrowHeadOutlineColor( newColor );
|
||||||
mArrow->update();
|
mArrow->update();
|
||||||
mArrow->endCommand();
|
mArrow->endCommand();
|
||||||
|
@ -39,6 +39,7 @@ QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAtt
|
|||||||
, mFrame( frame )
|
, mFrame( frame )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Table properties" ) );
|
||||||
|
|
||||||
blockAllSignals( true );
|
blockAllSignals( true );
|
||||||
|
|
||||||
@ -268,7 +269,7 @@ void QgsComposerAttributeTableWidget::on_mHeaderFontColorButton_colorChanged( co
|
|||||||
QgsComposition* composition = mComposerTable->composition();
|
QgsComposition* composition = mComposerTable->composition();
|
||||||
if ( composition )
|
if ( composition )
|
||||||
{
|
{
|
||||||
composition->beginMultiFrameCommand( mComposerTable, tr( "Table header font color" ) );
|
composition->beginMultiFrameCommand( mComposerTable, tr( "Table header font color" ), QgsComposerMultiFrameMergeCommand::TableHeaderFontColor );
|
||||||
}
|
}
|
||||||
mComposerTable->setHeaderFontColor( newColor );
|
mComposerTable->setHeaderFontColor( newColor );
|
||||||
if ( composition )
|
if ( composition )
|
||||||
@ -309,7 +310,7 @@ void QgsComposerAttributeTableWidget::on_mContentFontColorButton_colorChanged( c
|
|||||||
QgsComposition* composition = mComposerTable->composition();
|
QgsComposition* composition = mComposerTable->composition();
|
||||||
if ( composition )
|
if ( composition )
|
||||||
{
|
{
|
||||||
composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font color" ) );
|
composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font color" ), QgsComposerMultiFrameMergeCommand::TableContentFontColor );
|
||||||
}
|
}
|
||||||
mComposerTable->setContentFontColor( newColor );
|
mComposerTable->setContentFontColor( newColor );
|
||||||
if ( composition )
|
if ( composition )
|
||||||
@ -347,7 +348,7 @@ void QgsComposerAttributeTableWidget::on_mGridColorButton_colorChanged( const QC
|
|||||||
QgsComposition* composition = mComposerTable->composition();
|
QgsComposition* composition = mComposerTable->composition();
|
||||||
if ( composition )
|
if ( composition )
|
||||||
{
|
{
|
||||||
composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid color" ) );
|
composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid color" ), QgsComposerMultiFrameMergeCommand::TableGridColor );
|
||||||
}
|
}
|
||||||
mComposerTable->setGridColor( newColor );
|
mComposerTable->setGridColor( newColor );
|
||||||
if ( composition )
|
if ( composition )
|
||||||
@ -385,7 +386,7 @@ void QgsComposerAttributeTableWidget::on_mBackgroundColorButton_colorChanged( co
|
|||||||
QgsComposition* composition = mComposerTable->composition();
|
QgsComposition* composition = mComposerTable->composition();
|
||||||
if ( composition )
|
if ( composition )
|
||||||
{
|
{
|
||||||
composition->beginMultiFrameCommand( mComposerTable, tr( "Table background color" ) );
|
composition->beginMultiFrameCommand( mComposerTable, tr( "Table background color" ), QgsComposerMultiFrameMergeCommand::TableBackgroundColor );
|
||||||
}
|
}
|
||||||
mComposerTable->setBackgroundColor( newColor );
|
mComposerTable->setBackgroundColor( newColor );
|
||||||
if ( composition )
|
if ( composition )
|
||||||
|
@ -31,6 +31,7 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposer
|
|||||||
, mFrame( frame )
|
, mFrame( frame )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "HTML properties" ) );
|
||||||
|
|
||||||
//setup html editor
|
//setup html editor
|
||||||
mHtmlEditor = new QgsCodeEditorHTML( this );
|
mHtmlEditor = new QgsCodeEditorHTML( this );
|
||||||
|
@ -30,18 +30,20 @@
|
|||||||
|
|
||||||
//QgsComposerItemBaseWidget
|
//QgsComposerItemBaseWidget
|
||||||
|
|
||||||
QgsComposerItemBaseWidget::QgsComposerItemBaseWidget( QWidget* parent, QgsComposerObject *composerObject ): QWidget( parent ), mComposerObject( composerObject )
|
QgsComposerConfigObject::QgsComposerConfigObject( QWidget* parent, QgsComposerObject *composerObject )
|
||||||
|
: QObject( parent )
|
||||||
|
, mComposerObject( composerObject )
|
||||||
{
|
{
|
||||||
connect( atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
|
connect( atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
|
||||||
this, SLOT( updateDataDefinedButtons() ) );
|
this, SLOT( updateDataDefinedButtons() ) );
|
||||||
connect( atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( updateDataDefinedButtons() ) );
|
connect( atlasComposition(), SIGNAL( toggled( bool ) ), this, SLOT( updateDataDefinedButtons() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsComposerItemBaseWidget::~QgsComposerItemBaseWidget()
|
QgsComposerConfigObject::~QgsComposerConfigObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerItemBaseWidget::updateDataDefinedProperty()
|
void QgsComposerConfigObject::updateDataDefinedProperty()
|
||||||
{
|
{
|
||||||
//match data defined button to item's data defined property
|
//match data defined button to item's data defined property
|
||||||
QgsDataDefinedButton* ddButton = dynamic_cast<QgsDataDefinedButton*>( sender() );
|
QgsDataDefinedButton* ddButton = dynamic_cast<QgsDataDefinedButton*>( sender() );
|
||||||
@ -64,7 +66,7 @@ void QgsComposerItemBaseWidget::updateDataDefinedProperty()
|
|||||||
mComposerObject->refreshDataDefinedProperty( property );
|
mComposerObject->refreshDataDefinedProperty( property );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerItemBaseWidget::updateDataDefinedButtons()
|
void QgsComposerConfigObject::updateDataDefinedButtons()
|
||||||
{
|
{
|
||||||
Q_FOREACH ( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
|
Q_FOREACH ( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
|
||||||
{
|
{
|
||||||
@ -72,7 +74,7 @@ void QgsComposerItemBaseWidget::updateDataDefinedButtons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerItemBaseWidget::setDataDefinedProperty( const QgsDataDefinedButton *ddBtn, QgsComposerObject::DataDefinedProperty p )
|
void QgsComposerConfigObject::setDataDefinedProperty( const QgsDataDefinedButton *ddBtn, QgsComposerObject::DataDefinedProperty p )
|
||||||
{
|
{
|
||||||
if ( !mComposerObject )
|
if ( !mComposerObject )
|
||||||
{
|
{
|
||||||
@ -83,7 +85,7 @@ void QgsComposerItemBaseWidget::setDataDefinedProperty( const QgsDataDefinedButt
|
|||||||
mComposerObject->setDataDefinedProperty( p, map.value( "active" ).toInt(), map.value( "useexpr" ).toInt(), map.value( "expression" ), map.value( "field" ) );
|
mComposerObject->setDataDefinedProperty( p, map.value( "active" ).toInt(), map.value( "useexpr" ).toInt(), map.value( "expression" ), map.value( "field" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerItemBaseWidget::registerDataDefinedButton( QgsDataDefinedButton* button, QgsComposerObject::DataDefinedProperty property,
|
void QgsComposerConfigObject::registerDataDefinedButton( QgsDataDefinedButton* button, QgsComposerObject::DataDefinedProperty property,
|
||||||
QgsDataDefinedButton::DataType type, const QString& description )
|
QgsDataDefinedButton::DataType type, const QString& description )
|
||||||
{
|
{
|
||||||
button->blockSignals( true );
|
button->blockSignals( true );
|
||||||
@ -98,7 +100,7 @@ void QgsComposerItemBaseWidget::registerDataDefinedButton( QgsDataDefinedButton*
|
|||||||
button->blockSignals( false );
|
button->blockSignals( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const
|
QgsAtlasComposition* QgsComposerConfigObject::atlasComposition() const
|
||||||
{
|
{
|
||||||
if ( !mComposerObject )
|
if ( !mComposerObject )
|
||||||
{
|
{
|
||||||
@ -115,7 +117,7 @@ QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const
|
|||||||
return &composition->atlasComposition();
|
return &composition->atlasComposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsVectorLayer* QgsComposerItemBaseWidget::atlasCoverageLayer() const
|
QgsVectorLayer* QgsComposerConfigObject::atlasCoverageLayer() const
|
||||||
{
|
{
|
||||||
QgsAtlasComposition* atlasMap = atlasComposition();
|
QgsAtlasComposition* atlasMap = atlasComposition();
|
||||||
|
|
||||||
@ -140,8 +142,9 @@ void QgsComposerItemWidget::updateVariables()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* item )
|
QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* item )
|
||||||
: QgsComposerItemBaseWidget( parent, item )
|
: QWidget( parent )
|
||||||
, mItem( item )
|
, mItem( item )
|
||||||
|
, mConfigObject( new QgsComposerConfigObject( this, item ) )
|
||||||
, mFreezeXPosSpin( false )
|
, mFreezeXPosSpin( false )
|
||||||
, mFreezeYPosSpin( false )
|
, mFreezeYPosSpin( false )
|
||||||
, mFreezeWidthSpin( false )
|
, mFreezeWidthSpin( false )
|
||||||
@ -184,18 +187,6 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem*
|
|||||||
connect( mItem->composition(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) );
|
connect( mItem->composition(), SIGNAL( variablesChanged() ), this, SLOT( updateVariables() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsComposerItemWidget::QgsComposerItemWidget()
|
|
||||||
: QgsComposerItemBaseWidget( nullptr, nullptr )
|
|
||||||
, mItem( nullptr )
|
|
||||||
, mFreezeXPosSpin( false )
|
|
||||||
, mFreezeYPosSpin( false )
|
|
||||||
, mFreezeWidthSpin( false )
|
|
||||||
, mFreezeHeightSpin( false )
|
|
||||||
, mFreezePageSpin( false )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsComposerItemWidget::~QgsComposerItemWidget()
|
QgsComposerItemWidget::~QgsComposerItemWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -219,7 +210,7 @@ void QgsComposerItemWidget::on_mFrameColorButton_colorChanged( const QColor& new
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mItem->beginCommand( tr( "Frame color changed" ) );
|
mItem->beginCommand( tr( "Frame color changed" ), QgsComposerMergeCommand::ItemOutlineColor );
|
||||||
mItem->setFrameOutlineColor( newFrameColor );
|
mItem->setFrameOutlineColor( newFrameColor );
|
||||||
mItem->update();
|
mItem->update();
|
||||||
mItem->endCommand();
|
mItem->endCommand();
|
||||||
@ -239,7 +230,7 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_colorChanged( const QColor
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mItem->beginCommand( tr( "Background color changed" ) );
|
mItem->beginCommand( tr( "Background color changed" ), QgsComposerMergeCommand::ItemBackgroundColor );
|
||||||
mItem->setBackgroundColor( newBackgroundColor );
|
mItem->setBackgroundColor( newBackgroundColor );
|
||||||
|
|
||||||
//if the item is a composer map, we need to regenerate the map image
|
//if the item is a composer map, we need to regenerate the map image
|
||||||
@ -552,22 +543,22 @@ void QgsComposerItemWidget::setValuesForGuiNonPositionElements()
|
|||||||
|
|
||||||
void QgsComposerItemWidget::populateDataDefinedButtons()
|
void QgsComposerItemWidget::populateDataDefinedButtons()
|
||||||
{
|
{
|
||||||
registerDataDefinedButton( mXPositionDDBtn, QgsComposerObject::PositionX,
|
mConfigObject->registerDataDefinedButton( mXPositionDDBtn, QgsComposerObject::PositionX,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
||||||
registerDataDefinedButton( mYPositionDDBtn, QgsComposerObject::PositionY,
|
mConfigObject->registerDataDefinedButton( mYPositionDDBtn, QgsComposerObject::PositionY,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
||||||
registerDataDefinedButton( mWidthDDBtn, QgsComposerObject::ItemWidth,
|
mConfigObject->registerDataDefinedButton( mWidthDDBtn, QgsComposerObject::ItemWidth,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
||||||
registerDataDefinedButton( mHeightDDBtn, QgsComposerObject::ItemHeight,
|
mConfigObject->registerDataDefinedButton( mHeightDDBtn, QgsComposerObject::ItemHeight,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
|
||||||
registerDataDefinedButton( mItemRotationDDBtn, QgsComposerObject::ItemRotation,
|
mConfigObject->registerDataDefinedButton( mItemRotationDDBtn, QgsComposerObject::ItemRotation,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::double180RotDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::double180RotDesc() );
|
||||||
registerDataDefinedButton( mTransparencyDDBtn, QgsComposerObject::Transparency,
|
mConfigObject->registerDataDefinedButton( mTransparencyDDBtn, QgsComposerObject::Transparency,
|
||||||
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::intTranspDesc() );
|
QgsDataDefinedButton::AnyType, QgsDataDefinedButton::intTranspDesc() );
|
||||||
registerDataDefinedButton( mBlendModeDDBtn, QgsComposerObject::BlendMode,
|
mConfigObject->registerDataDefinedButton( mBlendModeDDBtn, QgsComposerObject::BlendMode,
|
||||||
QgsDataDefinedButton::String, QgsDataDefinedButton::blendModesDesc() );
|
QgsDataDefinedButton::String, QgsDataDefinedButton::blendModesDesc() );
|
||||||
registerDataDefinedButton( mExcludePrintsDDBtn, QgsComposerObject::ExcludeFromExports,
|
mConfigObject->registerDataDefinedButton( mExcludePrintsDDBtn, QgsComposerObject::ExcludeFromExports,
|
||||||
QgsDataDefinedButton::String, QgsDataDefinedButton::boolDesc() );
|
QgsDataDefinedButton::String, QgsDataDefinedButton::boolDesc() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerItemWidget::setValuesForGuiElements()
|
void QgsComposerItemWidget::setValuesForGuiElements()
|
||||||
@ -786,3 +777,25 @@ void QgsComposerItemWidget::on_mExcludeFromPrintsCheckBox_toggled( bool checked
|
|||||||
mItem->endCommand();
|
mItem->endCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsComposerItemBaseWidget::QgsComposerItemBaseWidget( QWidget* parent, QgsComposerObject* composerObject )
|
||||||
|
: QgsPanelWidget( parent )
|
||||||
|
, mConfigObject( new QgsComposerConfigObject( this, composerObject ) )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsComposerItemBaseWidget::registerDataDefinedButton( QgsDataDefinedButton* button, QgsComposerObject::DataDefinedProperty property, QgsDataDefinedButton::DataType type, const QString& description )
|
||||||
|
{
|
||||||
|
mConfigObject->registerDataDefinedButton( button, property, type, description );
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsVectorLayer* QgsComposerItemBaseWidget::atlasCoverageLayer() const
|
||||||
|
{
|
||||||
|
return mConfigObject->atlasCoverageLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const
|
||||||
|
{
|
||||||
|
return mConfigObject->atlasComposition();
|
||||||
|
}
|
||||||
|
@ -20,29 +20,42 @@
|
|||||||
|
|
||||||
#include "ui_qgscomposeritemwidgetbase.h"
|
#include "ui_qgscomposeritemwidgetbase.h"
|
||||||
#include "qgscomposeritem.h"
|
#include "qgscomposeritem.h"
|
||||||
|
#include "qgspanelwidget.h"
|
||||||
|
|
||||||
class QgsComposerItem;
|
class QgsComposerItem;
|
||||||
class QgsAtlasComposition;
|
class QgsAtlasComposition;
|
||||||
class QgsDataDefinedButton;
|
class QgsDataDefinedButton;
|
||||||
|
|
||||||
/** A base class for property widgets for composer items. All composer item widgets should inherit from
|
|
||||||
* this base class.
|
// NOTE - the inheritance here is tricky, as we need to avoid the multiple inheritance
|
||||||
|
// diamond problem and the ideal base object (QgsComposerConfigObject) MUST be a QObject
|
||||||
|
// because of its slots.
|
||||||
|
|
||||||
|
// So here we go:
|
||||||
|
// QgsComposerItemWidget is just a QWidget which is embedded inside specific item property
|
||||||
|
// widgets and contains common settings like position and rotation of the items. While the
|
||||||
|
// actual individual item type widgets MUST be QgsPanelWidgets unfortunately QgsComposerItemWidget
|
||||||
|
// CANNOT be a QgsPanelWidget and must instead be a generic QWidget (otherwise a QgsPanelWidget
|
||||||
|
// contains a child QgsPanelWidget, which breaks lots of assumptions made in QgsPanelWidget
|
||||||
|
// and related classes).
|
||||||
|
// So QgsComposerItemWidget HAS a QgsComposerConfigObject to handle these common tasks.
|
||||||
|
// Specific item property widgets (eg QgsComposerMapWidget) should inherit from QgsComposerItemBaseWidget
|
||||||
|
// (which is a QgsPanelWidget) and also HAS a QgsComposerConfigObject, with protected methods
|
||||||
|
// which are just proxied through to the QgsComposerConfigObject.
|
||||||
|
// phew!
|
||||||
|
// long story short - don't change this without good reason. If you add a new item type, inherit
|
||||||
|
// from QgsComposerItemWidget and trust that everything else has been done for you.
|
||||||
|
|
||||||
|
/** An object for property widgets for composer items. All composer config type widgets should contain
|
||||||
|
* this object.
|
||||||
*/
|
*/
|
||||||
class QgsComposerItemBaseWidget: public QWidget
|
class QgsComposerConfigObject: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QgsComposerItemBaseWidget( QWidget* parent, QgsComposerObject* composerObject );
|
QgsComposerConfigObject( QWidget* parent, QgsComposerObject* composerObject );
|
||||||
~QgsComposerItemBaseWidget();
|
~QgsComposerConfigObject();
|
||||||
|
|
||||||
protected slots:
|
|
||||||
/** Must be called when a data defined button changes*/
|
|
||||||
void updateDataDefinedProperty();
|
|
||||||
|
|
||||||
//! Updates data defined buttons to reflect current state of atlas (eg coverage layer)
|
|
||||||
void updateDataDefinedButtons();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** Sets a data defined property for the item from its current data defined button settings*/
|
/** Sets a data defined property for the item from its current data defined button settings*/
|
||||||
void setDataDefinedProperty( const QgsDataDefinedButton *ddBtn, QgsComposerObject::DataDefinedProperty p );
|
void setDataDefinedProperty( const QgsDataDefinedButton *ddBtn, QgsComposerObject::DataDefinedProperty p );
|
||||||
|
|
||||||
@ -61,12 +74,54 @@ class QgsComposerItemBaseWidget: public QWidget
|
|||||||
/** Returns the atlas for the composition*/
|
/** Returns the atlas for the composition*/
|
||||||
QgsAtlasComposition *atlasComposition() const;
|
QgsAtlasComposition *atlasComposition() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/** Must be called when a data defined button changes*/
|
||||||
|
void updateDataDefinedProperty();
|
||||||
|
|
||||||
|
//! Updates data defined buttons to reflect current state of atlas (eg coverage layer)
|
||||||
|
void updateDataDefinedButtons();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
QgsComposerObject* mComposerObject;
|
QgsComposerObject* mComposerObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A base class for property widgets for composer items. All composer item widgets should inherit from
|
||||||
|
* this base class.
|
||||||
|
*/
|
||||||
|
class QgsComposerItemBaseWidget: public QgsPanelWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QgsComposerItemBaseWidget( QWidget* parent, QgsComposerObject* composerObject );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/** Registers a data defined button, setting up its initial value, connections and description.
|
||||||
|
* @param button button to register
|
||||||
|
* @param property correponding data defined property
|
||||||
|
* @param type valid data types for button
|
||||||
|
* @param description user visible description for data defined property
|
||||||
|
*/
|
||||||
|
void registerDataDefinedButton( QgsDataDefinedButton* button, QgsComposerObject::DataDefinedProperty property,
|
||||||
|
QgsDataDefinedButton::DataType type, const QString& description );
|
||||||
|
|
||||||
|
/** Returns the current atlas coverage layer (if set)*/
|
||||||
|
QgsVectorLayer* atlasCoverageLayer() const;
|
||||||
|
|
||||||
|
/** Returns the atlas for the composition*/
|
||||||
|
QgsAtlasComposition *atlasComposition() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QgsComposerConfigObject* mConfigObject;
|
||||||
|
};
|
||||||
|
|
||||||
/** A class to enter generic properties for composer items (e.g. background, outline, frame).
|
/** A class to enter generic properties for composer items (e.g. background, outline, frame).
|
||||||
This widget can be embedded into other item widgets*/
|
This widget can be embedded into other item widgets*/
|
||||||
class QgsComposerItemWidget: public QgsComposerItemBaseWidget, private Ui::QgsComposerItemWidgetBase
|
class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -132,9 +187,9 @@ class QgsComposerItemWidget: public QgsComposerItemBaseWidget, private Ui::QgsCo
|
|||||||
void populateDataDefinedButtons();
|
void populateDataDefinedButtons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsComposerItemWidget();
|
|
||||||
|
|
||||||
QgsComposerItem* mItem;
|
QgsComposerItem* mItem;
|
||||||
|
QgsComposerConfigObject* mConfigObject;
|
||||||
|
|
||||||
bool mFreezeXPosSpin;
|
bool mFreezeXPosSpin;
|
||||||
bool mFreezeYPosSpin;
|
bool mFreezeYPosSpin;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( nullptr, label ), mComposerLabel( label )
|
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( nullptr, label ), mComposerLabel( label )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Label properties" ) );
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
|
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
|
||||||
@ -124,7 +125,7 @@ void QgsComposerLabelWidget::on_mFontColorButton_colorChanged( const QColor &new
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerLabel->beginCommand( tr( "Label color changed" ) );
|
mComposerLabel->beginCommand( tr( "Label color changed" ), QgsComposerMergeCommand::ComposerLabelFontColor );
|
||||||
mComposerLabel->setFontColor( newLabelColor );
|
mComposerLabel->setFontColor( newLabelColor );
|
||||||
mComposerLabel->update();
|
mComposerLabel->update();
|
||||||
mComposerLabel->endCommand();
|
mComposerLabel->endCommand();
|
||||||
|
@ -47,6 +47,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend )
|
|||||||
, mLegend( legend )
|
, mLegend( legend )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Legend properties" ) );
|
||||||
|
|
||||||
// setup icons
|
// setup icons
|
||||||
mAddToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
|
mAddToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
|
||||||
@ -405,7 +406,7 @@ void QgsComposerLegendWidget::on_mFontColorButton_colorChanged( const QColor& ne
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mLegend->beginCommand( tr( "Legend font color changed" ) );
|
mLegend->beginCommand( tr( "Legend font color changed" ), QgsComposerMergeCommand::LegendFontColor );
|
||||||
mLegend->setFontColor( newFontColor );
|
mLegend->setFontColor( newFontColor );
|
||||||
mLegend->update();
|
mLegend->update();
|
||||||
mLegend->endCommand();
|
mLegend->endCommand();
|
||||||
@ -623,7 +624,7 @@ void QgsComposerLegendWidget::on_mRasterBorderColorButton_colorChanged( const QC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mLegend->beginCommand( tr( "Legend raster border color" ) );
|
mLegend->beginCommand( tr( "Legend raster border color" ), QgsComposerMergeCommand::LegendRasterBorderColor );
|
||||||
mLegend->setRasterBorderColor( newColor );
|
mLegend->setRasterBorderColor( newColor );
|
||||||
mLegend->update();
|
mLegend->update();
|
||||||
mLegend->endCommand();
|
mLegend->endCommand();
|
||||||
|
@ -48,6 +48,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap )
|
|||||||
, mComposerMap( composerMap )
|
, mComposerMap( composerMap )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Map properties" ) );
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
|
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
|
||||||
@ -1729,7 +1730,7 @@ void QgsComposerMapWidget::on_mGridFramePenColorButton_colorChanged( const QColo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerMap->beginCommand( tr( "Grid frame color changed" ) );
|
mComposerMap->beginCommand( tr( "Grid frame color changed" ), QgsComposerMergeCommand::ComposerMapGridFramePenColor );
|
||||||
grid->setFramePenColor( newColor );
|
grid->setFramePenColor( newColor );
|
||||||
mComposerMap->update();
|
mComposerMap->update();
|
||||||
mComposerMap->endCommand();
|
mComposerMap->endCommand();
|
||||||
@ -1743,7 +1744,7 @@ void QgsComposerMapWidget::on_mGridFrameFill1ColorButton_colorChanged( const QCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerMap->beginCommand( tr( "Grid frame first fill color changed" ) );
|
mComposerMap->beginCommand( tr( "Grid frame first fill color changed" ), QgsComposerMergeCommand::ComposerMapGridFrameFill1Color );
|
||||||
grid->setFrameFillColor1( newColor );
|
grid->setFrameFillColor1( newColor );
|
||||||
mComposerMap->update();
|
mComposerMap->update();
|
||||||
mComposerMap->endCommand();
|
mComposerMap->endCommand();
|
||||||
@ -1757,7 +1758,7 @@ void QgsComposerMapWidget::on_mGridFrameFill2ColorButton_colorChanged( const QCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerMap->beginCommand( tr( "Grid frame second fill color changed" ) );
|
mComposerMap->beginCommand( tr( "Grid frame second fill color changed" ), QgsComposerMergeCommand::ComposerMapGridFrameFill2Color );
|
||||||
grid->setFrameFillColor2( newColor );
|
grid->setFrameFillColor2( newColor );
|
||||||
mComposerMap->update();
|
mComposerMap->update();
|
||||||
mComposerMap->endCommand();
|
mComposerMap->endCommand();
|
||||||
@ -2076,7 +2077,7 @@ void QgsComposerMapWidget::on_mAnnotationFontColorButton_colorChanged( const QCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerMap->beginCommand( tr( "Annotation color changed" ) );
|
mComposerMap->beginCommand( tr( "Annotation color changed" ), QgsComposerMergeCommand::ComposerMapGridAnnotationFontColor );
|
||||||
grid->setAnnotationFontColor( color );
|
grid->setAnnotationFontColor( color );
|
||||||
mComposerMap->update();
|
mComposerMap->update();
|
||||||
mComposerMap->endCommand();
|
mComposerMap->endCommand();
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( nullptr, picture ), mPicture( picture ), mPreviewsLoaded( false )
|
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( nullptr, picture ), mPicture( picture ), mPreviewsLoaded( false )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Picture properties" ) );
|
||||||
|
|
||||||
mFillColorButton->setAllowAlpha( true );
|
mFillColorButton->setAllowAlpha( true );
|
||||||
mFillColorButton->setColorDialogTitle( tr( "Select fill color" ) );
|
mFillColorButton->setColorDialogTitle( tr( "Select fill color" ) );
|
||||||
@ -632,7 +633,7 @@ void QgsComposerPictureWidget::loadPicturePreviews( bool collapsed )
|
|||||||
|
|
||||||
void QgsComposerPictureWidget::on_mFillColorButton_colorChanged( const QColor& color )
|
void QgsComposerPictureWidget::on_mFillColorButton_colorChanged( const QColor& color )
|
||||||
{
|
{
|
||||||
mPicture->beginCommand( tr( "Picture fill color changed" ) );
|
mPicture->beginCommand( tr( "Picture fill color changed" ), QgsComposerMergeCommand::ComposerPictureFillColor );
|
||||||
mPicture->setSvgFillColor( color );
|
mPicture->setSvgFillColor( color );
|
||||||
mPicture->endCommand();
|
mPicture->endCommand();
|
||||||
mPicture->update();
|
mPicture->update();
|
||||||
@ -640,7 +641,7 @@ void QgsComposerPictureWidget::on_mFillColorButton_colorChanged( const QColor& c
|
|||||||
|
|
||||||
void QgsComposerPictureWidget::on_mOutlineColorButton_colorChanged( const QColor& color )
|
void QgsComposerPictureWidget::on_mOutlineColorButton_colorChanged( const QColor& color )
|
||||||
{
|
{
|
||||||
mPicture->beginCommand( tr( "Picture border color changed" ) );
|
mPicture->beginCommand( tr( "Picture border color changed" ), QgsComposerMergeCommand::ComposerPictureOutlineColor );
|
||||||
mPicture->setSvgBorderColor( color );
|
mPicture->setSvgBorderColor( color );
|
||||||
mPicture->endCommand();
|
mPicture->endCommand();
|
||||||
mPicture->update();
|
mPicture->update();
|
||||||
|
@ -26,6 +26,7 @@ QgsComposerPolygonWidget::QgsComposerPolygonWidget( QgsComposerPolygon* composer
|
|||||||
, mComposerPolygon( composerPolygon )
|
, mComposerPolygon( composerPolygon )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Polygon properties" ) );
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerPolygon );
|
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerPolygon );
|
||||||
|
@ -26,6 +26,7 @@ QgsComposerPolylineWidget::QgsComposerPolylineWidget( QgsComposerPolyline* compo
|
|||||||
, mComposerPolyline( composerPolyline )
|
, mComposerPolyline( composerPolyline )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Polyline properties" ) );
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerPolyline );
|
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerPolyline );
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( nullptr, scaleBar ), mComposerScaleBar( scaleBar )
|
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( nullptr, scaleBar ), mComposerScaleBar( scaleBar )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Scalebar properties" ) );
|
||||||
|
|
||||||
connectUpdateSignal();
|
connectUpdateSignal();
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
@ -261,7 +263,7 @@ void QgsComposerScaleBarWidget::on_mFontColorButton_colorChanged( const QColor&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerScaleBar->beginCommand( tr( "Scalebar font color changed" ) );
|
mComposerScaleBar->beginCommand( tr( "Scalebar font color changed" ), QgsComposerMergeCommand::ScaleBarFontColor );
|
||||||
disconnectUpdateSignal();
|
disconnectUpdateSignal();
|
||||||
mComposerScaleBar->setFontColor( newColor );
|
mComposerScaleBar->setFontColor( newColor );
|
||||||
mComposerScaleBar->update();
|
mComposerScaleBar->update();
|
||||||
@ -276,7 +278,7 @@ void QgsComposerScaleBarWidget::on_mFillColorButton_colorChanged( const QColor&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerScaleBar->beginCommand( tr( "Scalebar color changed" ) );
|
mComposerScaleBar->beginCommand( tr( "Scalebar color changed" ), QgsComposerMergeCommand::ScaleBarFillColor );
|
||||||
disconnectUpdateSignal();
|
disconnectUpdateSignal();
|
||||||
QBrush newBrush = mComposerScaleBar->brush();
|
QBrush newBrush = mComposerScaleBar->brush();
|
||||||
newBrush.setColor( newColor );
|
newBrush.setColor( newColor );
|
||||||
@ -293,7 +295,7 @@ void QgsComposerScaleBarWidget::on_mFillColor2Button_colorChanged( const QColor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerScaleBar->beginCommand( tr( "Scalebar secondary color changed" ) );
|
mComposerScaleBar->beginCommand( tr( "Scalebar secondary color changed" ), QgsComposerMergeCommand::ScaleBarFill2Color );
|
||||||
disconnectUpdateSignal();
|
disconnectUpdateSignal();
|
||||||
QBrush newBrush = mComposerScaleBar->brush2();
|
QBrush newBrush = mComposerScaleBar->brush2();
|
||||||
newBrush.setColor( newColor );
|
newBrush.setColor( newColor );
|
||||||
@ -310,7 +312,7 @@ void QgsComposerScaleBarWidget::on_mStrokeColorButton_colorChanged( const QColor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposerScaleBar->beginCommand( tr( "Scalebar line color changed" ) );
|
mComposerScaleBar->beginCommand( tr( "Scalebar line color changed" ), QgsComposerMergeCommand::ScaleBarStrokeColor );
|
||||||
disconnectUpdateSignal();
|
disconnectUpdateSignal();
|
||||||
QPen newPen = mComposerScaleBar->pen();
|
QPen newPen = mComposerScaleBar->pen();
|
||||||
newPen.setColor( newColor );
|
newPen.setColor( newColor );
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( nullptr, composerShape ), mComposerShape( composerShape )
|
QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( nullptr, composerShape ), mComposerShape( composerShape )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
setPanelTitle( tr( "Shape properties" ) );
|
||||||
|
|
||||||
//add widget for general composer item properties
|
//add widget for general composer item properties
|
||||||
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerShape );
|
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerShape );
|
||||||
@ -109,19 +110,18 @@ void QgsComposerShapeWidget::on_mShapeStyleButton_clicked()
|
|||||||
|
|
||||||
QgsFillSymbol* newSymbol = mComposerShape->shapeStyleSymbol()->clone();
|
QgsFillSymbol* newSymbol = mComposerShape->shapeStyleSymbol()->clone();
|
||||||
QgsExpressionContext context = mComposerShape->createExpressionContext();
|
QgsExpressionContext context = mComposerShape->createExpressionContext();
|
||||||
QgsSymbolSelectorDialog d( newSymbol, QgsStyle::defaultStyle(), coverageLayer, this );
|
|
||||||
|
|
||||||
|
|
||||||
|
QgsSymbolSelectorWidget* d = new QgsSymbolSelectorWidget( newSymbol, QgsStyle::defaultStyle(), coverageLayer, nullptr );
|
||||||
QgsSymbolWidgetContext symbolContext;
|
QgsSymbolWidgetContext symbolContext;
|
||||||
symbolContext.setExpressionContext( &context );
|
symbolContext.setExpressionContext( &context );
|
||||||
d.setContext( symbolContext );
|
d->setContext( symbolContext );
|
||||||
|
|
||||||
if ( d.exec() == QDialog::Accepted )
|
connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateSymbolFromWidget() ) );
|
||||||
{
|
connect( d, SIGNAL( panelAccepted( QgsPanelWidget* ) ), this, SLOT( cleanUpSymbolSelector( QgsPanelWidget* ) ) );
|
||||||
mComposerShape->beginCommand( tr( "Shape style changed" ) );
|
openPanel( d );
|
||||||
mComposerShape->setShapeStyleSymbol( newSymbol );
|
mComposerShape->beginCommand( tr( "Shape style changed" ) );
|
||||||
updateShapeStyle();
|
|
||||||
mComposerShape->endCommand();
|
|
||||||
}
|
|
||||||
delete newSymbol;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerShapeWidget::updateShapeStyle()
|
void QgsComposerShapeWidget::updateShapeStyle()
|
||||||
@ -182,5 +182,22 @@ void QgsComposerShapeWidget::toggleRadiusSpin( const QString& shapeText )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsComposerShapeWidget::updateSymbolFromWidget()
|
||||||
|
{
|
||||||
|
QgsSymbolSelectorWidget* w = qobject_cast<QgsSymbolSelectorWidget*>( sender() );
|
||||||
|
mComposerShape->setShapeStyleSymbol( dynamic_cast< QgsFillSymbol* >( w->symbol() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsComposerShapeWidget::cleanUpSymbolSelector( QgsPanelWidget* container )
|
||||||
|
{
|
||||||
|
QgsSymbolSelectorWidget* w = qobject_cast<QgsSymbolSelectorWidget*>( container );
|
||||||
|
if ( !w )
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete w->symbol();
|
||||||
|
updateShapeStyle();
|
||||||
|
mComposerShape->endCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ class QgsComposerShapeWidget: public QgsComposerItemBaseWidget, private Ui::QgsC
|
|||||||
|
|
||||||
/** Enables or disables the rounded radius spin box based on shape type*/
|
/** Enables or disables the rounded radius spin box based on shape type*/
|
||||||
void toggleRadiusSpin( const QString& shapeText );
|
void toggleRadiusSpin( const QString& shapeText );
|
||||||
|
void updateSymbolFromWidget();
|
||||||
|
void cleanUpSymbolSelector( QgsPanelWidget* container );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSCOMPOSERSHAPEWIDGET_H
|
#endif // QGSCOMPOSERSHAPEWIDGET_H
|
||||||
|
@ -87,9 +87,14 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
|||||||
//composer label
|
//composer label
|
||||||
ComposerLabelSetText,
|
ComposerLabelSetText,
|
||||||
ComposerLabelSetId,
|
ComposerLabelSetId,
|
||||||
|
ComposerLabelFontColor,
|
||||||
//composer map
|
//composer map
|
||||||
ComposerMapRotation,
|
ComposerMapRotation,
|
||||||
ComposerMapAnnotationDistance,
|
ComposerMapAnnotationDistance,
|
||||||
|
ComposerMapGridFramePenColor,
|
||||||
|
ComposerMapGridFrameFill1Color,
|
||||||
|
ComposerMapGridFrameFill2Color,
|
||||||
|
ComposerMapGridAnnotationFontColor,
|
||||||
//composer legend
|
//composer legend
|
||||||
ComposerLegendText,
|
ComposerLegendText,
|
||||||
LegendColumnCount,
|
LegendColumnCount,
|
||||||
@ -107,8 +112,12 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
|||||||
LegendBoxSpace,
|
LegendBoxSpace,
|
||||||
LegendColumnSpace,
|
LegendColumnSpace,
|
||||||
LegendRasterBorderWidth,
|
LegendRasterBorderWidth,
|
||||||
|
LegendFontColor,
|
||||||
|
LegendRasterBorderColor,
|
||||||
//composer picture
|
//composer picture
|
||||||
ComposerPictureRotation,
|
ComposerPictureRotation,
|
||||||
|
ComposerPictureFillColor,
|
||||||
|
ComposerPictureOutlineColor,
|
||||||
// composer scalebar
|
// composer scalebar
|
||||||
ScaleBarLineWidth,
|
ScaleBarLineWidth,
|
||||||
ScaleBarHeight,
|
ScaleBarHeight,
|
||||||
@ -119,6 +128,10 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
|||||||
ScaleBarMapUnitsSegment,
|
ScaleBarMapUnitsSegment,
|
||||||
ScaleBarLabelBarSize,
|
ScaleBarLabelBarSize,
|
||||||
ScaleBarBoxContentSpace,
|
ScaleBarBoxContentSpace,
|
||||||
|
ScaleBarFontColor,
|
||||||
|
ScaleBarFillColor,
|
||||||
|
ScaleBarFill2Color,
|
||||||
|
ScaleBarStrokeColor,
|
||||||
// composer table
|
// composer table
|
||||||
TableMaximumFeatures,
|
TableMaximumFeatures,
|
||||||
TableMargin,
|
TableMargin,
|
||||||
@ -128,9 +141,13 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
|||||||
ShapeOutlineWidth,
|
ShapeOutlineWidth,
|
||||||
//composer arrow
|
//composer arrow
|
||||||
ArrowOutlineWidth,
|
ArrowOutlineWidth,
|
||||||
|
ArrowHeadFillColor,
|
||||||
|
ArrowHeadOutlineColor,
|
||||||
ArrowHeadWidth,
|
ArrowHeadWidth,
|
||||||
//item
|
//item
|
||||||
ItemOutlineWidth,
|
ItemOutlineWidth,
|
||||||
|
ItemOutlineColor,
|
||||||
|
ItemBackgroundColor,
|
||||||
ItemMove,
|
ItemMove,
|
||||||
ItemRotation,
|
ItemRotation,
|
||||||
ItemTransparency,
|
ItemTransparency,
|
||||||
|
@ -78,7 +78,11 @@ class CORE_EXPORT QgsComposerMultiFrameMergeCommand: public QgsComposerMultiFram
|
|||||||
TableMaximumFeatures,
|
TableMaximumFeatures,
|
||||||
TableMargin,
|
TableMargin,
|
||||||
TableGridStrokeWidth,
|
TableGridStrokeWidth,
|
||||||
TableCellStyle
|
TableCellStyle,
|
||||||
|
TableHeaderFontColor,
|
||||||
|
TableContentFontColor,
|
||||||
|
TableGridColor,
|
||||||
|
TableBackgroundColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
|
QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user