Skip to content

Commit

Permalink
Rename QgsComposerLegendStyle to QgsLegendStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Dec 11, 2016
1 parent 3efc28d commit c783be1
Show file tree
Hide file tree
Showing 19 changed files with 157 additions and 156 deletions.
1 change: 1 addition & 0 deletions doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions python/core/composer/qgscomposerlegend.sip
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QgsComposerLegend : QgsComposerItem
{
%TypeHeaderCode
#include <qgscomposerlegend.h>
#include <qgscomposerlegendstyle.h>
#include <qgslegendstyle.h>
%End

public:
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgslegendrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

};
6 changes: 3 additions & 3 deletions python/core/qgslegendsettings.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class QgsComposerLegendStyle
class QgsLegendStyle
{
%TypeHeaderCode
#include <qgscomposerlegendstyle.h>
#include <qgslegendstyle.h>
%End
public:
enum Style
Expand All @@ -21,7 +21,7 @@ class QgsComposerLegendStyle
Left,
Right,
};
QgsComposerLegendStyle();
QgsLegendStyle();

QFont font() const;
QFont & rfont();
Expand Down
50 changes: 25 additions & 25 deletions src/app/composer/qgscomposerlegendwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ SET(QGIS_CORE_SRCS
qgslayerdefinition.cpp
qgslegendrenderer.cpp
qgslegendsettings.cpp
qgslegendstyle.cpp
qgslocalec.cpp
qgslogger.cpp
qgsmaphittest.cpp
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -669,6 +669,7 @@ SET(QGIS_CORE_HDRS
qgslabelsearchtree.h
qgslegendrenderer.h
qgslegendsettings.h
qgslegendstyle.h
qgslogger.h
qgsmaphittest.h
qgsmaplayerdependency.h
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit c783be1

Please sign in to comment.