Skip to content
Permalink
Browse files

Rename QgsComposerLegendStyle to QgsLegendStyle

  • Loading branch information
wonder-sk committed Dec 11, 2016
1 parent 3efc28d commit c783be1d044d3bc45df4a4ec648fe5782602afd2
@@ -73,6 +73,7 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
<tr><td>QgsCentroidFillSymbolLayerV2Widget<td>QgsCentroidFillSymbolLayerWidget
<tr><td>QgsCircularStringV2<td>QgsCircularString
<tr><td>QgsColorButtonV2<td>QgsColorButton
<tr><td>QgsComposerLegendStyle<td>QgsLegendStyle
<tr><td>QgsComposerSymbolV2Item<td>QgsComposerSymbolItem
<tr><td>QgsComposerTableAvailableSortProxyModelV2<td>QgsComposerTableAvailableSortProxyModel
<tr><td>QgsCompoundCurveV2<td>QgsCompoundCurve
@@ -27,7 +27,7 @@ class QgsComposerLegend : QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposerlegend.h>
#include <qgscomposerlegendstyle.h>
#include <qgslegendstyle.h>
%End

public:
@@ -107,18 +107,18 @@ class QgsComposerLegend : QgsComposerItem
void setTitleAlignment( Qt::AlignmentFlag alignment );

/** Returns reference to modifiable style */
QgsComposerLegendStyle & rstyle( QgsComposerLegendStyle::Style s );
QgsLegendStyle & rstyle( QgsLegendStyle::Style s );
/** Returns style */
QgsComposerLegendStyle style( QgsComposerLegendStyle::Style s ) const;
void setStyle( QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle& style );
QgsLegendStyle style( QgsLegendStyle::Style s ) const;
void setStyle( QgsLegendStyle::Style s, const QgsLegendStyle& style );

QFont styleFont( QgsComposerLegendStyle::Style s ) const;
QFont styleFont( QgsLegendStyle::Style s ) const;
/** Set style font */
void setStyleFont( QgsComposerLegendStyle::Style s, const QFont& f );
void setStyleFont( QgsLegendStyle::Style s, const QFont& f );

/** Set style margin*/
void setStyleMargin( QgsComposerLegendStyle::Style s, double margin );
void setStyleMargin( QgsComposerLegendStyle::Style s, QgsComposerLegendStyle::Side side, double margin );
void setStyleMargin( QgsLegendStyle::Style s, double margin );
void setStyleMargin( QgsLegendStyle::Style s, QgsLegendStyle::Side side, double margin );

double boxSpace() const;
void setBoxSpace( double s );
@@ -76,6 +76,7 @@
%Include qgslabelsearchtree.sip
%Include qgslegendrenderer.sip
%Include qgslegendsettings.sip
%Include qgslegendstyle.sip
%Include qgslogger.sip
%Include qgsmaphittest.sip
%Include qgsmaplayer.sip
@@ -191,7 +192,6 @@
%Include composer/qgscomposeritemgroup.sip
%Include composer/qgscomposerlabel.sip
%Include composer/qgscomposerlegend.sip
%Include composer/qgscomposerlegendstyle.sip
%Include composer/qgscomposermap.sip
%Include composer/qgscomposermapgrid.sip
%Include composer/qgscomposermapitem.sip
@@ -33,7 +33,7 @@ class QgsLegendRenderer
void drawLegend( QPainter* painter );


static void setNodeLegendStyle( QgsLayerTreeNode* node, QgsComposerLegendStyle::Style style );
static QgsComposerLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode* node, QgsLayerTreeModel* model );
static void setNodeLegendStyle( QgsLayerTreeNode* node, QgsLegendStyle::Style style );
static QgsLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode* node, QgsLayerTreeModel* model );

};
@@ -30,10 +30,10 @@ class QgsLegendSettings
void setTitleAlignment( Qt::AlignmentFlag alignment );

/** Returns reference to modifiable style */
QgsComposerLegendStyle & rstyle( QgsComposerLegendStyle::Style s );
QgsLegendStyle & rstyle( QgsLegendStyle::Style s );
/** Returns style */
QgsComposerLegendStyle style( QgsComposerLegendStyle::Style s ) const;
void setStyle( QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle& style );
QgsLegendStyle style( QgsLegendStyle::Style s ) const;
void setStyle( QgsLegendStyle::Style s, const QgsLegendStyle& style );

double boxSpace() const;
void setBoxSpace( double s );
@@ -1,7 +1,7 @@
class QgsComposerLegendStyle
class QgsLegendStyle
{
%TypeHeaderCode
#include <qgscomposerlegendstyle.h>
#include <qgslegendstyle.h>
%End
public:
enum Style
@@ -21,7 +21,7 @@ class QgsComposerLegendStyle
Left,
Right,
};
QgsComposerLegendStyle();
QgsLegendStyle();

QFont font() const;
QFont & rfont();
@@ -136,12 +136,12 @@ void QgsComposerLegendWidget::setGuiElements()
mSymbolHeightSpinBox->setValue( mLegend->symbolHeight() );
mWmsLegendWidthSpinBox->setValue( mLegend->wmsLegendWidth() );
mWmsLegendHeightSpinBox->setValue( mLegend->wmsLegendHeight() );
mTitleSpaceBottomSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::Title ).margin( QgsComposerLegendStyle::Bottom ) );
mGroupSpaceSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::Group ).margin( QgsComposerLegendStyle::Top ) );
mLayerSpaceSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::Subgroup ).margin( QgsComposerLegendStyle::Top ) );
mTitleSpaceBottomSpinBox->setValue( mLegend->style( QgsLegendStyle::Title ).margin( QgsLegendStyle::Bottom ) );
mGroupSpaceSpinBox->setValue( mLegend->style( QgsLegendStyle::Group ).margin( QgsLegendStyle::Top ) );
mLayerSpaceSpinBox->setValue( mLegend->style( QgsLegendStyle::Subgroup ).margin( QgsLegendStyle::Top ) );
// We keep Symbol and SymbolLabel Top in sync for now
mSymbolSpaceSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::Symbol ).margin( QgsComposerLegendStyle::Top ) );
mIconLabelSpaceSpinBox->setValue( mLegend->style( QgsComposerLegendStyle::SymbolLabel ).margin( QgsComposerLegendStyle::Left ) );
mSymbolSpaceSpinBox->setValue( mLegend->style( QgsLegendStyle::Symbol ).margin( QgsLegendStyle::Top ) );
mIconLabelSpaceSpinBox->setValue( mLegend->style( QgsLegendStyle::SymbolLabel ).margin( QgsLegendStyle::Left ) );
mBoxSpaceSpinBox->setValue( mLegend->boxSpace() );
mColumnSpaceSpinBox->setValue( mLegend->columnSpace() );

@@ -288,7 +288,7 @@ void QgsComposerLegendWidget::on_mTitleSpaceBottomSpinBox_valueChanged( double d
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend title space bottom" ), QgsComposerMergeCommand::LegendTitleSpaceBottom );
mLegend->rstyle( QgsComposerLegendStyle::Title ).setMargin( QgsComposerLegendStyle::Bottom, d );
mLegend->rstyle( QgsLegendStyle::Title ).setMargin( QgsLegendStyle::Bottom, d );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -300,7 +300,7 @@ void QgsComposerLegendWidget::on_mGroupSpaceSpinBox_valueChanged( double d )
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend group space" ), QgsComposerMergeCommand::LegendGroupSpace );
mLegend->rstyle( QgsComposerLegendStyle::Group ).setMargin( QgsComposerLegendStyle::Top, d );
mLegend->rstyle( QgsLegendStyle::Group ).setMargin( QgsLegendStyle::Top, d );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -312,7 +312,7 @@ void QgsComposerLegendWidget::on_mLayerSpaceSpinBox_valueChanged( double d )
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend layer space" ), QgsComposerMergeCommand::LegendLayerSpace );
mLegend->rstyle( QgsComposerLegendStyle::Subgroup ).setMargin( QgsComposerLegendStyle::Top, d );
mLegend->rstyle( QgsLegendStyle::Subgroup ).setMargin( QgsLegendStyle::Top, d );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -325,8 +325,8 @@ void QgsComposerLegendWidget::on_mSymbolSpaceSpinBox_valueChanged( double d )
{
mLegend->beginCommand( tr( "Legend symbol space" ), QgsComposerMergeCommand::LegendSymbolSpace );
// We keep Symbol and SymbolLabel Top in sync for now
mLegend->rstyle( QgsComposerLegendStyle::Symbol ).setMargin( QgsComposerLegendStyle::Top, d );
mLegend->rstyle( QgsComposerLegendStyle::SymbolLabel ).setMargin( QgsComposerLegendStyle::Top, d );
mLegend->rstyle( QgsLegendStyle::Symbol ).setMargin( QgsLegendStyle::Top, d );
mLegend->rstyle( QgsLegendStyle::SymbolLabel ).setMargin( QgsLegendStyle::Top, d );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -338,7 +338,7 @@ void QgsComposerLegendWidget::on_mIconLabelSpaceSpinBox_valueChanged( double d )
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend icon label space" ), QgsComposerMergeCommand::LegendIconSymbolSpace );
mLegend->rstyle( QgsComposerLegendStyle::SymbolLabel ).setMargin( QgsComposerLegendStyle::Left, d );
mLegend->rstyle( QgsLegendStyle::SymbolLabel ).setMargin( QgsLegendStyle::Left, d );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -350,11 +350,11 @@ void QgsComposerLegendWidget::on_mTitleFontButton_clicked()
if ( mLegend )
{
bool ok;
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsComposerLegendStyle::Title ).font() );
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsLegendStyle::Title ).font() );
if ( ok )
{
mLegend->beginCommand( tr( "Title font changed" ) );
mLegend->setStyleFont( QgsComposerLegendStyle::Title, newFont );
mLegend->setStyleFont( QgsLegendStyle::Title, newFont );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -367,11 +367,11 @@ void QgsComposerLegendWidget::on_mGroupFontButton_clicked()
if ( mLegend )
{
bool ok;
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsComposerLegendStyle::Group ).font() );
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsLegendStyle::Group ).font() );
if ( ok )
{
mLegend->beginCommand( tr( "Legend group font changed" ) );
mLegend->setStyleFont( QgsComposerLegendStyle::Group, newFont );
mLegend->setStyleFont( QgsLegendStyle::Group, newFont );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -384,11 +384,11 @@ void QgsComposerLegendWidget::on_mLayerFontButton_clicked()
if ( mLegend )
{
bool ok;
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsComposerLegendStyle::Subgroup ).font() );
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsLegendStyle::Subgroup ).font() );
if ( ok )
{
mLegend->beginCommand( tr( "Legend layer font changed" ) );
mLegend->setStyleFont( QgsComposerLegendStyle::Subgroup, newFont );
mLegend->setStyleFont( QgsLegendStyle::Subgroup, newFont );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -401,11 +401,11 @@ void QgsComposerLegendWidget::on_mItemFontButton_clicked()
if ( mLegend )
{
bool ok;
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsComposerLegendStyle::SymbolLabel ).font() );
QFont newFont = QgisGui::getFont( ok, mLegend->style( QgsLegendStyle::SymbolLabel ).font() );
if ( ok )
{
mLegend->beginCommand( tr( "Legend item font changed" ) );
mLegend->setStyleFont( QgsComposerLegendStyle::SymbolLabel, newFont );
mLegend->setStyleFont( QgsLegendStyle::SymbolLabel, newFont );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
@@ -965,7 +965,7 @@ void QgsComposerLegendWidget::setCurrentNodeStyleFromAction()
if ( !a || !mItemTreeView->currentNode() )
return;

QgsLegendRenderer::setNodeLegendStyle( mItemTreeView->currentNode(), ( QgsComposerLegendStyle::Style ) a->data().toInt() );
QgsLegendRenderer::setNodeLegendStyle( mItemTreeView->currentNode(), ( QgsLegendStyle::Style ) a->data().toInt() );
mLegend->updateItem();
}

@@ -1061,13 +1061,13 @@ QMenu* QgsComposerLegendMenuProvider::createContextMenu()
menu->addSeparator();
}

QgsComposerLegendStyle::Style currentStyle = QgsLegendRenderer::nodeLegendStyle( mView->currentNode(), mView->layerTreeModel() );
QgsLegendStyle::Style currentStyle = QgsLegendRenderer::nodeLegendStyle( mView->currentNode(), mView->layerTreeModel() );

QList<QgsComposerLegendStyle::Style> lst;
lst << QgsComposerLegendStyle::Hidden << QgsComposerLegendStyle::Group << QgsComposerLegendStyle::Subgroup;
Q_FOREACH ( QgsComposerLegendStyle::Style style, lst )
QList<QgsLegendStyle::Style> lst;
lst << QgsLegendStyle::Hidden << QgsLegendStyle::Group << QgsLegendStyle::Subgroup;
Q_FOREACH ( QgsLegendStyle::Style style, lst )
{
QAction* action = menu->addAction( QgsComposerLegendStyle::styleLabel( style ), mWidget, SLOT( setCurrentNodeStyleFromAction() ) );
QAction* action = menu->addAction( QgsLegendStyle::styleLabel( style ), mWidget, SLOT( setCurrentNodeStyleFromAction() ) );
action->setCheckable( true );
action->setChecked( currentStyle == style );
action->setData(( int ) style );
@@ -142,6 +142,7 @@ SET(QGIS_CORE_SRCS
qgslayerdefinition.cpp
qgslegendrenderer.cpp
qgslegendsettings.cpp
qgslegendstyle.cpp
qgslocalec.cpp
qgslogger.cpp
qgsmaphittest.cpp
@@ -256,7 +257,6 @@ SET(QGIS_CORE_SRCS
composer/qgscomposeritemgroup.cpp
composer/qgscomposerlabel.cpp
composer/qgscomposerlegend.cpp
composer/qgscomposerlegendstyle.cpp
composer/qgscomposermap.cpp
composer/qgscomposermapgrid.cpp
composer/qgscomposermapitem.cpp
@@ -669,6 +669,7 @@ SET(QGIS_CORE_HDRS
qgslabelsearchtree.h
qgslegendrenderer.h
qgslegendsettings.h
qgslegendstyle.h
qgslogger.h
qgsmaphittest.h
qgsmaplayerdependency.h
@@ -768,7 +769,6 @@ SET(QGIS_CORE_HDRS
composer/qgscomposerarrow.h
composer/qgscomposerframe.h
composer/qgscomposeritemcommand.h
composer/qgscomposerlegendstyle.h
composer/qgscomposermultiframecommand.h
composer/qgscomposertexttable.h
composer/qgsdoubleboxscalebarstyle.h

0 comments on commit c783be1

Please sign in to comment.
You can’t perform that action at this time.