Skip to content
Permalink
Browse files

composer multicolumn legend: division to columns heuristic, optional …

…splitting layers into multiple columns, optional equal column width
  • Loading branch information
blazek committed Nov 21, 2012
1 parent b177abf commit 86c21184fbaf560801e03b0f107eb73c799681b1
@@ -62,7 +62,6 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): m
mWrapCharLineEdit->setText( legend->wrapChar() );

setGuiElements();
connect( mItemTreeView, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) );

connect( mItemTreeView->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ),
this, SLOT( selectedChanged( const QModelIndex &, const QModelIndex & ) ) );
@@ -88,6 +87,8 @@ void QgsComposerLegendWidget::setGuiElements()
blockAllSignals( true );
mTitleLineEdit->setText( mLegend->title() );
mColumnCountSpinBox->setValue( mLegend->columnCount() );
mSplitLayerCheckBox->setChecked( mLegend->splitLayer() );
mEqualColumnWidthCheckBox->setChecked( mLegend->equalColumnWidth() );
mSymbolWidthSpinBox->setValue( mLegend->symbolWidth() );
mSymbolHeightSpinBox->setValue( mLegend->symbolHeight() );
mGroupSpaceSpinBox->setValue( mLegend->groupSpace() );
@@ -147,6 +148,32 @@ void QgsComposerLegendWidget::on_mColumnCountSpinBox_valueChanged( int c )
mLegend->update();
mLegend->endCommand();
}
mSplitLayerCheckBox->setEnabled( c > 1 );
mEqualColumnWidthCheckBox->setEnabled( c > 1 );
}

void QgsComposerLegendWidget::on_mSplitLayerCheckBox_toggled( bool checked )
{
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend split layers" ), QgsComposerMergeCommand::LegendSplitLayer );
mLegend->setSplitLayer( checked );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
}
}

void QgsComposerLegendWidget::on_mEqualColumnWidthCheckBox_toggled( bool checked )
{
if ( mLegend )
{
mLegend->beginCommand( tr( "Legend equal column width" ), QgsComposerMergeCommand::LegendEqualColumnWidth );
mLegend->setEqualColumnWidth( checked );
mLegend->adjustBoxSize();
mLegend->update();
mLegend->endCommand();
}
}

void QgsComposerLegendWidget::on_mSymbolWidthSpinBox_valueChanged( double d )
@@ -731,6 +758,8 @@ void QgsComposerLegendWidget::blockAllSignals( bool b )
mCheckBoxAutoUpdate->blockSignals( b );
mMapComboBox->blockSignals( b );
mColumnCountSpinBox->blockSignals( b );
mSplitLayerCheckBox->blockSignals( b );
mEqualColumnWidthCheckBox->blockSignals( b );
mSymbolWidthSpinBox->blockSignals( b );
mSymbolHeightSpinBox->blockSignals( b );
mGroupSpaceSpinBox->blockSignals( b );
@@ -42,6 +42,8 @@ class QgsComposerLegendWidget: public QWidget, private Ui::QgsComposerLegendWidg
void on_mWrapCharLineEdit_textChanged( const QString& text );
void on_mTitleLineEdit_textChanged( const QString& text );
void on_mColumnCountSpinBox_valueChanged( int c );
void on_mSplitLayerCheckBox_toggled( bool checked );
void on_mEqualColumnWidthCheckBox_toggled( bool checked );
void on_mSymbolWidthSpinBox_valueChanged( double d );
void on_mSymbolHeightSpinBox_valueChanged( double d );
void on_mGroupSpaceSpinBox_valueChanged( double d );
@@ -81,6 +81,8 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
//composer legend
ComposerLegendText,
LegendColumnCount,
LegendSplitLayer,
LegendEqualColumnWidth,
LegendSymbolWidth,
LegendSymbolHeight,
LegendGroupSpace,

0 comments on commit 86c2118

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