Port more scalebar functionality

This commit is contained in:
Nyall Dawson 2017-11-20 16:45:52 +10:00
parent 7e7770b6e2
commit 5b1c6901a5
11 changed files with 1680 additions and 114 deletions

View File

@ -105,6 +105,20 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
UndoLegendGroupFont,
UndoLegendLayerFont,
UndoLegendItemFont,
UndoScaleBarLineWidth,
UndoScaleBarSegmentSize,
UndoScaleBarSegmentsLeft,
UndoScaleBarSegments,
UndoScaleBarHeight,
UndoScaleBarFontColor,
UndoScaleBarFillColor,
UndoScaleBarFillColor2,
UndoScaleBarStrokeColor,
UndoScaleBarUnitText,
UndoScaleBarMapUnitsSegment,
UndoScaleBarLabelBarSize,
UndoScaleBarBoxContentSpace,
UndoCustomCommand,
};

View File

@ -24,7 +24,6 @@ class QgsLayoutItemScaleBar: QgsLayoutItem
%Docstring
Constructor for QgsLayoutItemScaleBar, with the specified parent ``layout``.
%End
~QgsLayoutItemScaleBar();
virtual int type() const;
@ -38,6 +37,8 @@ class QgsLayoutItemScaleBar: QgsLayoutItem
The caller takes responsibility for deleting the returned object.
:rtype: QgsLayoutItemScaleBar
%End
virtual QgsLayoutSize minimumSize() const;
int numberOfSegments() const;
%Docstring
@ -413,15 +414,11 @@ class QgsLayoutItemScaleBar: QgsLayoutItem
:rtype: str
%End
void adjustBoxSize();
%Docstring
Sets the scale bar box size to a size suitable for the scalebar content.
%End
void update();
%Docstring
Adjusts the scale bar box size and updates the item.
%End
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );

View File

@ -193,6 +193,7 @@ SET(QGIS_APP_SRCS
layout/qgslayoutpolygonwidget.cpp
layout/qgslayoutpolylinewidget.cpp
layout/qgslayoutpropertieswidget.cpp
layout/qgslayoutscalebarwidget.cpp
layout/qgslayoutshapewidget.cpp
locator/qgsinbuiltlocatorfilters.cpp
@ -402,6 +403,7 @@ SET (QGIS_APP_MOC_HDRS
layout/qgslayoutpolygonwidget.h
layout/qgslayoutpolylinewidget.h
layout/qgslayoutpropertieswidget.h
layout/qgslayoutscalebarwidget.h
layout/qgslayoutshapewidget.h
locator/qgsinbuiltlocatorfilters.h

View File

@ -37,6 +37,7 @@
#include "qgslayoutframe.h"
#include "qgslayoutitemhtml.h"
#include "qgslayouthtmlwidget.h"
#include "qgslayoutscalebarwidget.h"
#include "qgisapp.h"
#include "qgsmapcanvas.h"
@ -143,10 +144,10 @@ void QgsLayoutAppUtils::registerGuiForKnownItemTypes()
// scalebar item
auto scalebarItemMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata >( QgsLayoutItemRegistry::LayoutScaleBar, QObject::tr( "Scale Bar" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddScalebar.svg" ) ),
auto scalebarItemMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata >( QgsLayoutItemRegistry::LayoutScaleBar, QObject::tr( "Scale Bar" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionScaleBar.svg" ) ),
[ = ]( QgsLayoutItem * item )->QgsLayoutItemBaseWidget *
{
return nullptr;//new QgsLayoutLegendWidget( qobject_cast< QgsLayoutItemLegend * >( item ) );
return new QgsLayoutScaleBarWidget( qobject_cast< QgsLayoutItemScaleBar * >( item ) );
}, createRubberBand );
scalebarItemMetadata->setItemAddedToLayoutFunction( [ = ]( QgsLayoutItem * item )
{

View File

@ -0,0 +1,731 @@
/***************************************************************************
qgslayoutscalebarwidget.cpp
-----------------------------
begin : 11 June 2008
copyright : (C) 2008 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgslayoutscalebarwidget.h"
#include "qgslayoutitemmap.h"
#include "qgslayoutitemscalebar.h"
#include "qgslayout.h"
#include "qgsguiutils.h"
#include <QColorDialog>
#include <QFontDialog>
#include <QWidget>
QgsLayoutScaleBarWidget::QgsLayoutScaleBarWidget( QgsLayoutItemScaleBar *scaleBar )
: QgsLayoutItemBaseWidget( nullptr, scaleBar )
, mScalebar( scaleBar )
{
setupUi( this );
connect( mHeightSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mHeightSpinBox_valueChanged );
connect( mLineWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mLineWidthSpinBox_valueChanged );
connect( mSegmentSizeSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mSegmentSizeSpinBox_valueChanged );
connect( mSegmentsLeftSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mSegmentsLeftSpinBox_valueChanged );
connect( mNumberOfSegmentsSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged );
connect( mUnitLabelLineEdit, &QLineEdit::textChanged, this, &QgsLayoutScaleBarWidget::mUnitLabelLineEdit_textChanged );
connect( mMapUnitsPerBarUnitSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged );
connect( mFontColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutScaleBarWidget::mFontColorButton_colorChanged );
connect( mFillColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutScaleBarWidget::mFillColorButton_colorChanged );
connect( mFillColor2Button, &QgsColorButton::colorChanged, this, &QgsLayoutScaleBarWidget::mFillColor2Button_colorChanged );
connect( mStrokeColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutScaleBarWidget::mStrokeColorButton_colorChanged );
connect( mStyleComboBox, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutScaleBarWidget::mStyleComboBox_currentIndexChanged );
connect( mLabelBarSpaceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged );
connect( mBoxSizeSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mBoxSizeSpinBox_valueChanged );
connect( mAlignmentComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutScaleBarWidget::mAlignmentComboBox_currentIndexChanged );
connect( mUnitsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged );
connect( mLineJoinStyleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutScaleBarWidget::mLineJoinStyleCombo_currentIndexChanged );
connect( mLineCapStyleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutScaleBarWidget::mLineCapStyleCombo_currentIndexChanged );
connect( mMinWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mMinWidthSpinBox_valueChanged );
connect( mMaxWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutScaleBarWidget::mMaxWidthSpinBox_valueChanged );
setPanelTitle( tr( "Scalebar properties" ) );
mFontButton->setMode( QgsFontButton::ModeQFont );
connectUpdateSignal();
//add widget for general composer item properties
mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, scaleBar );
mainLayout->addWidget( mItemPropertiesWidget );
mSegmentSizeRadioGroup.addButton( mFixedSizeRadio );
mSegmentSizeRadioGroup.addButton( mFitWidthRadio );
connect( &mSegmentSizeRadioGroup, static_cast < void ( QButtonGroup::* )( QAbstractButton * ) > ( &QButtonGroup::buttonClicked ), this, &QgsLayoutScaleBarWidget::segmentSizeRadioChanged );
blockMemberSignals( true );
//style combo box
mStyleComboBox->insertItem( 0, tr( "Single Box" ) );
mStyleComboBox->insertItem( 1, tr( "Double Box" ) );
mStyleComboBox->insertItem( 2, tr( "Line Ticks Middle" ) );
mStyleComboBox->insertItem( 3, tr( "Line Ticks Down" ) );
mStyleComboBox->insertItem( 4, tr( "Line Ticks Up" ) );
mStyleComboBox->insertItem( 5, tr( "Numeric" ) );
//alignment combo box
mAlignmentComboBox->insertItem( 0, tr( "Left" ) );
mAlignmentComboBox->insertItem( 1, tr( "Middle" ) );
mAlignmentComboBox->insertItem( 2, tr( "Right" ) );
//units combo box
mUnitsComboBox->insertItem( 0, tr( "Map units" ), QgsUnitTypes::DistanceUnknownUnit );
mUnitsComboBox->insertItem( 1, tr( "Meters" ), QgsUnitTypes::DistanceMeters );
mUnitsComboBox->insertItem( 2, tr( "Feet" ), QgsUnitTypes::DistanceFeet );
mUnitsComboBox->insertItem( 3, tr( "Nautical Miles" ), QgsUnitTypes::DistanceNauticalMiles );
mFillColorButton->setColorDialogTitle( tr( "Select Fill Color" ) );
mFillColorButton->setAllowOpacity( true );
mFillColorButton->setContext( QStringLiteral( "composer" ) );
mFillColorButton->setNoColorString( tr( "Transparent Fill" ) );
mFillColorButton->setShowNoColor( true );
mFillColor2Button->setColorDialogTitle( tr( "Select Alternate Fill Color" ) );
mFillColor2Button->setAllowOpacity( true );
mFillColor2Button->setContext( QStringLiteral( "composer" ) );
mFillColor2Button->setNoColorString( tr( "Transparent fill" ) );
mFillColor2Button->setShowNoColor( true );
mFontColorButton->setColorDialogTitle( tr( "Select Font Color" ) );
mFontColorButton->setAllowOpacity( true );
mFontColorButton->setContext( QStringLiteral( "composer" ) );
mStrokeColorButton->setColorDialogTitle( tr( "Select Line Color" ) );
mStrokeColorButton->setAllowOpacity( true );
mStrokeColorButton->setContext( QStringLiteral( "composer" ) );
mStrokeColorButton->setNoColorString( tr( "Transparent line" ) );
mStrokeColorButton->setShowNoColor( true );
if ( mScalebar )
{
mFillColorDDBtn->registerExpressionContextGenerator( mScalebar );
mFillColor2DDBtn->registerExpressionContextGenerator( mScalebar );
mLineColorDDBtn->registerExpressionContextGenerator( mScalebar );
mLineWidthDDBtn->registerExpressionContextGenerator( mScalebar );
QgsLayout *scaleBarLayout = mScalebar->layout();
if ( scaleBarLayout )
{
mMapItemComboBox->setCurrentLayout( scaleBarLayout );
mMapItemComboBox->setItemType( QgsLayoutItemRegistry::LayoutMap );
}
}
connect( mMapItemComboBox, &QgsLayoutItemComboBox::itemChanged, this, &QgsLayoutScaleBarWidget::mapChanged );
registerDataDefinedButton( mFillColorDDBtn, QgsLayoutObject::ScalebarFillColor );
registerDataDefinedButton( mFillColor2DDBtn, QgsLayoutObject::ScalebarFillColor2 );
registerDataDefinedButton( mLineColorDDBtn, QgsLayoutObject::ScalebarLineColor );
registerDataDefinedButton( mLineWidthDDBtn, QgsLayoutObject::ScalebarLineWidth );
blockMemberSignals( false );
setGuiElements(); //set the GUI elements to the state of scaleBar
connect( mFontButton, &QgsFontButton::changed, this, &QgsLayoutScaleBarWidget::fontChanged );
}
bool QgsLayoutScaleBarWidget::setNewItem( QgsLayoutItem *item )
{
if ( item->type() != QgsLayoutItemRegistry::LayoutScaleBar )
return false;
disconnectUpdateSignal();
mScalebar = qobject_cast< QgsLayoutItemScaleBar * >( item );
mItemPropertiesWidget->setItem( mScalebar );
if ( mScalebar )
{
connectUpdateSignal();
mFillColorDDBtn->registerExpressionContextGenerator( mScalebar );
mFillColor2DDBtn->registerExpressionContextGenerator( mScalebar );
mLineColorDDBtn->registerExpressionContextGenerator( mScalebar );
mLineWidthDDBtn->registerExpressionContextGenerator( mScalebar );
}
setGuiElements();
return true;
}
void QgsLayoutScaleBarWidget::setGuiElements()
{
if ( !mScalebar )
{
return;
}
blockMemberSignals( true );
mNumberOfSegmentsSpinBox->setValue( mScalebar->numberOfSegments() );
mSegmentsLeftSpinBox->setValue( mScalebar->numberOfSegmentsLeft() );
mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
mLineWidthSpinBox->setValue( mScalebar->lineWidth() );
mHeightSpinBox->setValue( mScalebar->height() );
mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
mLabelBarSpaceSpinBox->setValue( mScalebar->labelBarSpace() );
mBoxSizeSpinBox->setValue( mScalebar->boxContentSpace() );
mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
mLineJoinStyleCombo->setPenJoinStyle( mScalebar->lineJoinStyle() );
mLineCapStyleCombo->setPenCapStyle( mScalebar->lineCapStyle() );
mFontColorButton->setColor( mScalebar->fontColor() );
mFillColorButton->setColor( mScalebar->fillColor() );
mFillColor2Button->setColor( mScalebar->fillColor2() );
mStrokeColorButton->setColor( mScalebar->lineColor() );
mFontButton->setCurrentFont( mScalebar->font() );
//map combo box
mMapItemComboBox->setItem( mScalebar->map() );
//style...
QString style = mScalebar->style();
mStyleComboBox->setCurrentIndex( mStyleComboBox->findText( tr( style.toLocal8Bit().data() ) ) );
toggleStyleSpecificControls( style );
//alignment
mAlignmentComboBox->setCurrentIndex( ( int )( mScalebar->alignment() ) );
//units
mUnitsComboBox->setCurrentIndex( mUnitsComboBox->findData( ( int )mScalebar->units() ) );
if ( mScalebar->segmentSizeMode() == QgsScaleBarSettings::SegmentSizeFixed )
{
mFixedSizeRadio->setChecked( true );
mSegmentSizeSpinBox->setEnabled( true );
mMinWidthSpinBox->setEnabled( false );
mMaxWidthSpinBox->setEnabled( false );
}
else /*if(mComposerScaleBar->segmentSizeMode() == QgsComposerScaleBar::SegmentSizeFitWidth)*/
{
mFitWidthRadio->setChecked( true );
mSegmentSizeSpinBox->setEnabled( false );
mMinWidthSpinBox->setEnabled( true );
mMaxWidthSpinBox->setEnabled( true );
}
mMinWidthSpinBox->setValue( mScalebar->minimumBarWidth() );
mMaxWidthSpinBox->setValue( mScalebar->maximumBarWidth() );
updateDataDefinedButton( mFillColorDDBtn );
updateDataDefinedButton( mFillColor2DDBtn );
updateDataDefinedButton( mLineColorDDBtn );
updateDataDefinedButton( mLineWidthDDBtn );
blockMemberSignals( false );
}
//slots
void QgsLayoutScaleBarWidget::mLineWidthSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Line Width" ), QgsLayoutItem::UndoScaleBarLineWidth );
disconnectUpdateSignal();
mScalebar->setLineWidth( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mSegmentSizeSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Segment Size" ), QgsLayoutItem::UndoScaleBarSegmentSize );
disconnectUpdateSignal();
mScalebar->setUnitsPerSegment( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mSegmentsLeftSpinBox_valueChanged( int i )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Segments" ), QgsLayoutItem::UndoScaleBarSegmentsLeft );
disconnectUpdateSignal();
mScalebar->setNumberOfSegmentsLeft( i );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged( int i )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Segments" ), QgsLayoutItem::UndoScaleBarSegments );
disconnectUpdateSignal();
mScalebar->setNumberOfSegments( i );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mHeightSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Height" ), QgsLayoutItem::UndoScaleBarHeight );
disconnectUpdateSignal();
mScalebar->setHeight( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::fontChanged()
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Font" ) );
disconnectUpdateSignal();
mScalebar->setFont( mFontButton->currentFont() );
connectUpdateSignal();
mScalebar->endCommand();
mScalebar->update();
}
void QgsLayoutScaleBarWidget::mFontColorButton_colorChanged( const QColor &newColor )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Font Color" ), QgsLayoutItem::UndoScaleBarFontColor );
disconnectUpdateSignal();
mScalebar->setFontColor( newColor );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mFillColorButton_colorChanged( const QColor &newColor )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Fill Color" ), QgsLayoutItem::UndoScaleBarFillColor );
disconnectUpdateSignal();
mScalebar->setFillColor( newColor );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mFillColor2Button_colorChanged( const QColor &newColor )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Fill Color" ), QgsLayoutItem::UndoScaleBarFillColor2 );
disconnectUpdateSignal();
mScalebar->setFillColor2( newColor );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mStrokeColorButton_colorChanged( const QColor &newColor )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Stroke Color" ), QgsLayoutItem::UndoScaleBarStrokeColor );
disconnectUpdateSignal();
mScalebar->setLineColor( newColor );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mUnitLabelLineEdit_textChanged( const QString &text )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Unit Text" ), QgsLayoutItem::UndoScaleBarUnitText );
disconnectUpdateSignal();
mScalebar->setUnitLabel( text );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Map Units per Segment" ), QgsLayoutItem::UndoScaleBarMapUnitsSegment );
disconnectUpdateSignal();
mScalebar->setMapUnitsPerScaleBarUnit( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mStyleComboBox_currentIndexChanged( const QString &text )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Style" ) );
disconnectUpdateSignal();
QString untranslatedStyleName;
if ( text == tr( "Single Box" ) )
{
untranslatedStyleName = QStringLiteral( "Single Box" );
}
else if ( text == tr( "Double Box" ) )
{
untranslatedStyleName = QStringLiteral( "Double Box" );
}
else if ( text == tr( "Line Ticks Middle" ) )
{
untranslatedStyleName = QStringLiteral( "Line Ticks Middle" );
}
else if ( text == tr( "Line Ticks Middle" ) )
{
untranslatedStyleName = QStringLiteral( "Line Ticks Middle" );
}
else if ( text == tr( "Line Ticks Down" ) )
{
untranslatedStyleName = QStringLiteral( "Line Ticks Down" );
}
else if ( text == tr( "Line Ticks Up" ) )
{
untranslatedStyleName = QStringLiteral( "Line Ticks Up" );
}
else if ( text == tr( "Numeric" ) )
{
untranslatedStyleName = QStringLiteral( "Numeric" );
}
//disable or enable controls which apply to specific scale bar styles
toggleStyleSpecificControls( untranslatedStyleName );
mScalebar->setStyle( untranslatedStyleName );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::toggleStyleSpecificControls( const QString &style )
{
if ( style == QLatin1String( "Numeric" ) )
{
//Disable controls which don't apply to numeric scale bars
mGroupBoxUnits->setEnabled( false );
mGroupBoxUnits->setCollapsed( true );
mGroupBoxSegments->setEnabled( false );
mGroupBoxSegments->setCollapsed( true );
mLabelBarSpaceSpinBox->setEnabled( false );
mLineWidthSpinBox->setEnabled( false );
mFillColorButton->setEnabled( false );
mFillColor2Button->setEnabled( false );
mStrokeColorButton->setEnabled( false );
mLineJoinStyleCombo->setEnabled( false );
mLineCapStyleCombo->setEnabled( false );
}
else
{
//Enable controls
mGroupBoxUnits->setEnabled( true );
mGroupBoxSegments->setEnabled( true );
mLabelBarSpaceSpinBox->setEnabled( true );
mLineWidthSpinBox->setEnabled( true );
mFillColorButton->setEnabled( true );
mFillColor2Button->setEnabled( true );
mStrokeColorButton->setEnabled( true );
if ( style == QLatin1String( "Single Box" ) || style == QLatin1String( "Double Box" ) )
{
mLineJoinStyleCombo->setEnabled( true );
mLineCapStyleCombo->setEnabled( false );
}
else
{
mLineJoinStyleCombo->setEnabled( false );
mLineCapStyleCombo->setEnabled( true );
}
}
}
void QgsLayoutScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Label Space" ), QgsLayoutItem::UndoScaleBarLabelBarSize );
disconnectUpdateSignal();
mScalebar->setLabelBarSpace( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mBoxSizeSpinBox_valueChanged( double d )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Box Space" ), QgsLayoutItem::UndoScaleBarBoxContentSpace );
disconnectUpdateSignal();
mScalebar->setBoxContentSpace( d );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mAlignmentComboBox_currentIndexChanged( int index )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Alignment" ) );
disconnectUpdateSignal();
mScalebar->setAlignment( ( QgsScaleBarSettings::Alignment ) index );
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged( int index )
{
if ( !mScalebar )
{
return;
}
QVariant unitData = mUnitsComboBox->itemData( index );
if ( unitData.type() == QVariant::Invalid )
{
return;
}
disconnectUpdateSignal();
mScalebar->setUnits( ( QgsUnitTypes::DistanceUnit )unitData.toInt() );
switch ( mUnitsComboBox->currentIndex() )
{
case 0:
{
mScalebar->beginCommand( tr( "Set Scalebar Units" ) );
mScalebar->applyDefaultSize( QgsUnitTypes::DistanceUnknownUnit );
break;
}
case 2:
{
mScalebar->beginCommand( tr( "Set Scalebar Units" ) );
mScalebar->applyDefaultSize( QgsUnitTypes::DistanceFeet );
break;
}
case 3:
{
mScalebar->beginCommand( tr( "Set Scalebar Units" ) );
mScalebar->applyDefaultSize( QgsUnitTypes::DistanceNauticalMiles );
break;
}
case 1:
default:
{
mScalebar->beginCommand( tr( "Set Scalebar Units" ) );
mScalebar->applyDefaultSize( QgsUnitTypes::DistanceMeters );
break;
}
}
mScalebar->update();
mUnitLabelLineEdit->setText( mScalebar->unitLabel() );
mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() );
mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() );
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::blockMemberSignals( bool block )
{
mSegmentSizeSpinBox->blockSignals( block );
mNumberOfSegmentsSpinBox->blockSignals( block );
mSegmentsLeftSpinBox->blockSignals( block );
mStyleComboBox->blockSignals( block );
mUnitLabelLineEdit->blockSignals( block );
mMapUnitsPerBarUnitSpinBox->blockSignals( block );
mHeightSpinBox->blockSignals( block );
mLineWidthSpinBox->blockSignals( block );
mLabelBarSpaceSpinBox->blockSignals( block );
mBoxSizeSpinBox->blockSignals( block );
mAlignmentComboBox->blockSignals( block );
mUnitsComboBox->blockSignals( block );
mLineJoinStyleCombo->blockSignals( block );
mLineCapStyleCombo->blockSignals( block );
mFontColorButton->blockSignals( block );
mFillColorButton->blockSignals( block );
mFillColor2Button->blockSignals( block );
mStrokeColorButton->blockSignals( block );
mSegmentSizeRadioGroup.blockSignals( block );
mMapItemComboBox->blockSignals( block );
mFontButton->blockSignals( block );
mMinWidthSpinBox->blockSignals( block );
mMaxWidthSpinBox->blockSignals( block );
}
void QgsLayoutScaleBarWidget::connectUpdateSignal()
{
if ( mScalebar )
{
connect( mScalebar, &QgsLayoutObject::changed, this, &QgsLayoutScaleBarWidget::setGuiElements );
}
}
void QgsLayoutScaleBarWidget::disconnectUpdateSignal()
{
if ( mScalebar )
{
disconnect( mScalebar, &QgsLayoutObject::changed, this, &QgsLayoutScaleBarWidget::setGuiElements );
}
}
void QgsLayoutScaleBarWidget::mLineJoinStyleCombo_currentIndexChanged( int index )
{
Q_UNUSED( index );
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Join Style" ) );
mScalebar->setLineJoinStyle( mLineJoinStyleCombo->penJoinStyle() );
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mLineCapStyleCombo_currentIndexChanged( int index )
{
Q_UNUSED( index );
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Cap Style" ) );
mScalebar->setLineCapStyle( mLineCapStyleCombo->penCapStyle() );
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::segmentSizeRadioChanged( QAbstractButton *radio )
{
bool fixedSizeMode = radio == mFixedSizeRadio;
mMinWidthSpinBox->setEnabled( !fixedSizeMode );
mMaxWidthSpinBox->setEnabled( !fixedSizeMode );
mSegmentSizeSpinBox->setEnabled( fixedSizeMode );
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Size Mode" ), QgsLayoutItem::UndoScaleBarSegmentSize );
disconnectUpdateSignal();
if ( mFixedSizeRadio->isChecked() )
{
mScalebar->setSegmentSizeMode( QgsScaleBarSettings::SegmentSizeFixed );
mScalebar->setUnitsPerSegment( mSegmentSizeSpinBox->value() );
}
else /*if(mFitWidthRadio->isChecked())*/
{
mScalebar->setSegmentSizeMode( QgsScaleBarSettings::SegmentSizeFitWidth );
}
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mapChanged( QgsLayoutItem *item )
{
QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap * >( item );
if ( !map )
{
return;
}
//set it to scale bar
mScalebar->beginCommand( tr( "Set Scalebar Map" ) );
disconnectUpdateSignal();
mScalebar->setMap( map );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mMinWidthSpinBox_valueChanged( double )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Size Mode" ), QgsLayoutItem::UndoScaleBarSegmentSize );
disconnectUpdateSignal();
mScalebar->setMinimumBarWidth( mMinWidthSpinBox->value() );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}
void QgsLayoutScaleBarWidget::mMaxWidthSpinBox_valueChanged( double )
{
if ( !mScalebar )
{
return;
}
mScalebar->beginCommand( tr( "Set Scalebar Size Mode" ), QgsLayoutItem::UndoScaleBarSegmentSize );
disconnectUpdateSignal();
mScalebar->setMaximumBarWidth( mMaxWidthSpinBox->value() );
mScalebar->update();
connectUpdateSignal();
mScalebar->endCommand();
}

View File

@ -0,0 +1,85 @@
/***************************************************************************
qgslayoutscalebarwidget.h
---------------------------
begin : 11 June 2008
copyright : (C) 2008 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSLAYOUTSCALEBARWIDGET_H
#define QGSLAYOUTSCALEBARWIDGET_H
#include "ui_qgslayoutscalebarwidgetbase.h"
#include "qgslayoutitemwidget.h"
class QgsLayoutItemScaleBar;
/**
* \ingroup app
* A widget to define the properties of a QgsLayoutItemScaleBar.
*/
class QgsLayoutScaleBarWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutScaleBarWidgetBase
{
Q_OBJECT
public:
explicit QgsLayoutScaleBarWidget( QgsLayoutItemScaleBar *scaleBar );
protected:
bool setNewItem( QgsLayoutItem *item ) override;
public slots:
void mHeightSpinBox_valueChanged( double d );
void mLineWidthSpinBox_valueChanged( double d );
void mSegmentSizeSpinBox_valueChanged( double d );
void mSegmentsLeftSpinBox_valueChanged( int i );
void mNumberOfSegmentsSpinBox_valueChanged( int i );
void mUnitLabelLineEdit_textChanged( const QString &text );
void mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
void mFontColorButton_colorChanged( const QColor &newColor );
void mFillColorButton_colorChanged( const QColor &newColor );
void mFillColor2Button_colorChanged( const QColor &newColor );
void mStrokeColorButton_colorChanged( const QColor &newColor );
void mStyleComboBox_currentIndexChanged( const QString &text );
void mLabelBarSpaceSpinBox_valueChanged( double d );
void mBoxSizeSpinBox_valueChanged( double d );
void mAlignmentComboBox_currentIndexChanged( int index );
void mUnitsComboBox_currentIndexChanged( int index );
void mLineJoinStyleCombo_currentIndexChanged( int index );
void mLineCapStyleCombo_currentIndexChanged( int index );
void mMinWidthSpinBox_valueChanged( double d );
void mMaxWidthSpinBox_valueChanged( double d );
private slots:
void setGuiElements();
void segmentSizeRadioChanged( QAbstractButton *radio );
void mapChanged( QgsLayoutItem *item );
void fontChanged();
private:
QgsLayoutItemScaleBar *mScalebar = nullptr;
QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
QButtonGroup mSegmentSizeRadioGroup;
//! Enables/disables the signals of the input gui elements
void blockMemberSignals( bool enable );
//! Enables/disables controls based on scale bar style
void toggleStyleSpecificControls( const QString &style );
void connectUpdateSignal();
void disconnectUpdateSignal();
};
#endif //QGSLAYOUTSCALEBARWIDGET_H

View File

@ -138,6 +138,20 @@ class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectIt
UndoLegendGroupFont, //!< Legend group font
UndoLegendLayerFont, //!< Legend layer font
UndoLegendItemFont, //!< Legend item font
UndoScaleBarLineWidth, //!< Scalebar line width
UndoScaleBarSegmentSize, //!< Scalebar segment size
UndoScaleBarSegmentsLeft, //!< Scalebar segments left
UndoScaleBarSegments, //!< Scalebar number of segments
UndoScaleBarHeight, //!< Scalebar height
UndoScaleBarFontColor, //!< Scalebar font color
UndoScaleBarFillColor, //!< Scalebar fill color
UndoScaleBarFillColor2, //!< Scalebar secondary fill color
UndoScaleBarStrokeColor, //!< Scalebar stroke color
UndoScaleBarUnitText, //!< Scalebar unit text
UndoScaleBarMapUnitsSegment, //!< Scalebar map units per segment
UndoScaleBarLabelBarSize, //!< Scalebar label bar size
UndoScaleBarBoxContentSpace, //!< Scalebar box context space
UndoCustomCommand, //!< Base id for plugin based item undo commands
};

View File

@ -60,7 +60,7 @@ bool QgsLayoutItemRegistry::populate()
addLayoutItemType( new QgsLayoutItemMetadata( LayoutPicture, QStringLiteral( "Picture" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddImage.svg" ) ), QgsLayoutItemPicture::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutLabel, QStringLiteral( "Label" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionLabel.svg" ) ), QgsLayoutItemLabel::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutLegend, QStringLiteral( "Legend" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLegend.svg" ) ), QgsLayoutItemLegend::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutScaleBar, QStringLiteral( "Scale Bar" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddScalebar.svg" ) ), QgsLayoutItemScaleBar::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutScaleBar, QStringLiteral( "Scale Bar" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionScaleBar.svg" ) ), QgsLayoutItemScaleBar::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutShape, QStringLiteral( "Shape" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicRectangle.svg" ) ), []( QgsLayout * layout )
{
QgsLayoutItemShape *shape = new QgsLayoutItemShape( layout );

View File

@ -42,17 +42,11 @@
QgsLayoutItemScaleBar::QgsLayoutItemScaleBar( QgsLayout *layout )
: QgsLayoutItem( layout )
, mSegmentMillimeters( 0.0 )
{
applyDefaultSettings();
applyDefaultSize();
}
QgsLayoutItemScaleBar::~QgsLayoutItemScaleBar()
{
delete mStyle;
}
int QgsLayoutItemScaleBar::type() const
{
return QgsLayoutItemRegistry::LayoutScaleBar;
@ -68,6 +62,11 @@ QgsLayoutItemScaleBar *QgsLayoutItemScaleBar::create( QgsLayout *layout )
return new QgsLayoutItemScaleBar( layout );
}
QgsLayoutSize QgsLayoutItemScaleBar::minimumSize() const
{
return QgsLayoutSize( mStyle->calculateBoxSize( mSettings, createScaleContext() ), QgsUnitTypes::LayoutMillimeters );
}
void QgsLayoutItemScaleBar::draw( QgsRenderContext &context, const QStyleOptionGraphicsItem * )
{
if ( !mStyle )
@ -87,6 +86,7 @@ void QgsLayoutItemScaleBar::setNumberOfSegments( int nSegments )
mSettings.setNumberOfSegments( nSegments );
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -102,6 +102,7 @@ void QgsLayoutItemScaleBar::setUnitsPerSegment( double units )
refreshSegmentMillimeters();
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -117,6 +118,7 @@ void QgsLayoutItemScaleBar::setSegmentSizeMode( QgsScaleBarSettings::SegmentSize
refreshSegmentMillimeters();
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -132,6 +134,7 @@ void QgsLayoutItemScaleBar::setMinimumBarWidth( double minWidth )
refreshSegmentMillimeters();
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -147,6 +150,7 @@ void QgsLayoutItemScaleBar::setMaximumBarWidth( double maxWidth )
refreshSegmentMillimeters();
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -161,6 +165,7 @@ void QgsLayoutItemScaleBar::setNumberOfSegmentsLeft( int nSegmentsLeft )
mSettings.setNumberOfSegmentsLeft( nSegmentsLeft );
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -175,6 +180,7 @@ void QgsLayoutItemScaleBar::setBoxContentSpace( double space )
mSettings.setBoxContentSpace( space );
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
refreshItemSize();
emit changed();
}
@ -247,6 +253,7 @@ void QgsLayoutItemScaleBar::refreshDataDefinedProperty( const QgsLayoutObject::D
}
if ( forceUpdate )
{
refreshItemSize();
update();
}
@ -353,7 +360,7 @@ QgsScaleBarRenderer::ScaleBarContext QgsLayoutItemScaleBar::createScaleContext()
void QgsLayoutItemScaleBar::setAlignment( QgsScaleBarSettings::Alignment a )
{
mSettings.setAlignment( a );
update();
refreshItemSize();
emit changed();
}
@ -361,6 +368,7 @@ void QgsLayoutItemScaleBar::setUnits( QgsUnitTypes::DistanceUnit u )
{
mSettings.setUnits( u );
refreshSegmentMillimeters();
refreshItemSize();
emit changed();
}
@ -391,8 +399,7 @@ void QgsLayoutItemScaleBar::setLineCapStyle( Qt::PenCapStyle style )
void QgsLayoutItemScaleBar::applyDefaultSettings()
{
//style
delete mStyle;
mStyle = new QgsSingleBoxScaleBarRenderer();
mStyle = qgis::make_unique< QgsSingleBoxScaleBarRenderer >();
//default to no background
setBackgroundEnabled( false );
@ -409,6 +416,7 @@ void QgsLayoutItemScaleBar::applyDefaultSettings()
mSettings.setFont( f );
mSettings.setUnits( QgsUnitTypes::DistanceUnknownUnit );
refreshItemSize();
emit changed();
}
@ -483,76 +491,16 @@ void QgsLayoutItemScaleBar::applyDefaultSize( QgsUnitTypes::DistanceUnit units )
}
refreshSegmentMillimeters();
adjustBoxSize();
refreshItemSize();
emit changed();
}
void QgsLayoutItemScaleBar::adjustBoxSize()
{
if ( !mStyle )
{
return;
}
QRectF box = QRectF( pos(), mStyle->calculateBoxSize( mSettings, createScaleContext() ) );
if ( rect().height() > box.height() )
{
//keep user specified item height if higher than minimum scale bar height
box.setHeight( rect().height() );
}
#if 0 //TODO
//update rect for data defined size and position
QRectF newRect = evalItemRect( box, true );
//scale bars have a minimum size, respect that regardless of data defined settings
if ( newRect.width() < box.width() )
{
newRect.setWidth( box.width() );
}
if ( newRect.height() < box.height() )
{
newRect.setHeight( box.height() );
}
QgsLayoutItem::setSceneRect( newRect );
#endif
}
#if 0 //TODO
void QgsLayoutItemScaleBar::setSceneRect( const QRectF &rectangle )
{
QRectF box = QRectF( pos(), mStyle->calculateBoxSize( mSettings, createScaleContext() ) );
if ( rectangle.height() > box.height() )
{
//keep user specified item height if higher than minimum scale bar height
box.setHeight( rectangle.height() );
}
box.moveTopLeft( rectangle.topLeft() );
//update rect for data defined size and position
QRectF newRect = evalItemRect( rectangle );
//scale bars have a minimum size, respect that regardless of data defined settings
if ( newRect.width() < box.width() )
{
newRect.setWidth( box.width() );
}
if ( newRect.height() < box.height() )
{
newRect.setHeight( box.height() );
}
QgsComposerItem::setSceneRect( newRect );
}
#endif
void QgsLayoutItemScaleBar::update()
{
//Don't adjust box size for numeric scale bars:
if ( mStyle && mStyle->name() != QLatin1String( "Numeric" ) )
{
adjustBoxSize();
refreshItemSize();
}
QgsLayoutItem::update();
}
@ -563,31 +511,31 @@ void QgsLayoutItemScaleBar::updateSegmentSize()
{
return;
}
double width = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
double widthMM = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
refreshSegmentMillimeters();
double widthAfter = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( width, widthAfter );
double widthAfterMM = mStyle->calculateBoxSize( mSettings, createScaleContext() ).width();
correctXPositionAlignment( widthMM, widthAfterMM );
QgsLayoutSize currentSize = sizeWithUnits();
currentSize.setWidth( mLayout->context().measurementConverter().convert( QgsLayoutMeasurement( widthAfterMM, QgsUnitTypes::LayoutMillimeters ), currentSize.units() ).length() );
attemptResize( currentSize );
update();
emit changed();
}
void QgsLayoutItemScaleBar::setStyle( const QString &styleName )
{
delete mStyle;
mStyle = nullptr;
//switch depending on style name
if ( styleName == QLatin1String( "Single Box" ) )
{
mStyle = new QgsSingleBoxScaleBarRenderer();
mStyle = qgis::make_unique< QgsSingleBoxScaleBarRenderer >();
}
else if ( styleName == QLatin1String( "Double Box" ) )
{
mStyle = new QgsDoubleBoxScaleBarRenderer();
mStyle = qgis::make_unique< QgsDoubleBoxScaleBarRenderer >();
}
else if ( styleName == QLatin1String( "Line Ticks Middle" ) || styleName == QLatin1String( "Line Ticks Down" ) || styleName == QLatin1String( "Line Ticks Up" ) )
{
QgsTicksScaleBarRenderer *tickStyle = new QgsTicksScaleBarRenderer();
std::unique_ptr< QgsTicksScaleBarRenderer > tickStyle = qgis::make_unique< QgsTicksScaleBarRenderer >();
if ( styleName == QLatin1String( "Line Ticks Middle" ) )
{
tickStyle->setTickPosition( QgsTicksScaleBarRenderer::TicksMiddle );
@ -600,12 +548,13 @@ void QgsLayoutItemScaleBar::setStyle( const QString &styleName )
{
tickStyle->setTickPosition( QgsTicksScaleBarRenderer::TicksUp );
}
mStyle = tickStyle;
mStyle = std::move( tickStyle );
}
else if ( styleName == QLatin1String( "Numeric" ) )
{
mStyle = new QgsNumericScaleBarRenderer();
mStyle = qgis::make_unique< QgsNumericScaleBarRenderer >();
}
refreshItemSize();
emit changed();
}
@ -629,7 +578,7 @@ QFont QgsLayoutItemScaleBar::font() const
void QgsLayoutItemScaleBar::setFont( const QFont &font )
{
mSettings.setFont( font );
update();
refreshItemSize();
emit changed();
}
@ -705,7 +654,7 @@ bool QgsLayoutItemScaleBar::writePropertiesToElement( QDomElement &composerScale
return true;
}
bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &, const QgsReadWriteContext &context )
bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &, const QgsReadWriteContext & )
{
mSettings.setHeight( itemElem.attribute( QStringLiteral( "height" ), QStringLiteral( "5.0" ) ).toDouble() );
mSettings.setLabelBarSpace( itemElem.attribute( QStringLiteral( "labelBarSpace" ), QStringLiteral( "3.0" ) ).toDouble() );
@ -831,10 +780,8 @@ bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemEl
}
//style
delete mStyle;
mStyle = nullptr;
QString styleString = itemElem.attribute( QStringLiteral( "style" ), QLatin1String( "" ) );
setStyle( tr( styleString.toLocal8Bit().data() ) );
setStyle( styleString.toLocal8Bit().data() );
if ( itemElem.attribute( QStringLiteral( "unitType" ) ).isEmpty() )
{
@ -897,23 +844,28 @@ bool QgsLayoutItemScaleBar::readPropertiesFromElement( const QDomElement &itemEl
return true;
}
void QgsLayoutItemScaleBar::correctXPositionAlignment( double width, double widthAfter )
void QgsLayoutItemScaleBar::correctXPositionAlignment( double widthMM, double widthAfterMM )
{
//Don't adjust position for numeric scale bars:
if ( mStyle->name() == QLatin1String( "Numeric" ) )
{
return;
}
#if 0 //TODO
QgsLayoutPoint currentPos = positionWithUnits();
double deltaMM = 0.0;
if ( mSettings.alignment() == QgsScaleBarSettings::AlignMiddle )
{
move( -( widthAfter - width ) / 2.0, 0 );
deltaMM = -( widthAfterMM - widthMM ) / 2.0;
}
else if ( mSettings.alignment() == QgsScaleBarSettings::AlignRight )
{
move( -( widthAfter - width ), 0 );
deltaMM = -( widthAfterMM - widthMM );
}
#endif
double delta = mLayout->context().measurementConverter().convert( QgsLayoutMeasurement( deltaMM, QgsUnitTypes::LayoutMillimeters ), currentPos.units() ).length();
currentPos.setX( currentPos.x() + delta );
attemptMove( currentPos );
}

View File

@ -42,7 +42,6 @@ class CORE_EXPORT QgsLayoutItemScaleBar: public QgsLayoutItem
* Constructor for QgsLayoutItemScaleBar, with the specified parent \a layout.
*/
QgsLayoutItemScaleBar( QgsLayout *layout );
~QgsLayoutItemScaleBar();
int type() const override;
QString stringType() const override;
@ -53,6 +52,7 @@ class CORE_EXPORT QgsLayoutItemScaleBar: public QgsLayoutItem
* The caller takes responsibility for deleting the returned object.
*/
static QgsLayoutItemScaleBar *create( QgsLayout *layout ) SIP_FACTORY;
QgsLayoutSize minimumSize() const override;
/**
* Returns the number of segments included in the scalebar.
@ -402,19 +402,11 @@ class CORE_EXPORT QgsLayoutItemScaleBar: public QgsLayoutItem
*/
QString style() const;
/**
* Sets the scale bar box size to a size suitable for the scalebar content.
*/
void adjustBoxSize();
/**
* Adjusts the scale bar box size and updates the item.
*/
void update();
#if 0 //TODO
//overridden to apply minimum size
void setSceneRect( const QRectF &rectangle ) override;
#endif
void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ) override;
protected:
@ -436,13 +428,13 @@ class CORE_EXPORT QgsLayoutItemScaleBar: public QgsLayoutItem
QgsScaleBarSettings mSettings;
//! Scalebar style
QgsScaleBarRenderer *mStyle = nullptr;
std::unique_ptr< QgsScaleBarRenderer > mStyle;
//! Width of a segment (in mm)
double mSegmentMillimeters;
double mSegmentMillimeters = 0.0;
//! Moves scalebar position to the left / right depending on alignment and change in item width
void correctXPositionAlignment( double width, double widthAfter );
void correctXPositionAlignment( double widthMM, double widthAfterMM );
//! Calculates with of a segment in mm and stores it in mSegmentMillimeters
void refreshSegmentMillimeters();

View File

@ -0,0 +1,778 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsLayoutScaleBarWidgetBase</class>
<widget class="QWidget" name="QgsLayoutScaleBarWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>456</width>
<height>662</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Scalebar Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);</string>
</property>
<property name="text">
<string>Scalebar</string>
</property>
</widget>
</item>
<item>
<widget class="QgsScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>1004</height>
</rect>
</property>
<layout class="QVBoxLayout" name="mainLayout">
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Main properties</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
<item row="0" column="1" colspan="2">
<widget class="QgsLayoutItemComboBox" name="mMapItemComboBox"/>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="mStyleComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mStyleLabel">
<property name="text">
<string>St&amp;yle</string>
</property>
<property name="buddy">
<cstring>mStyleComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mMapLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Map</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mMapItemComboBox</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mGroupBoxUnits">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Units</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0">
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Scalebar units</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mUnitLabelLabel">
<property name="text">
<string>&amp;Label for units</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mUnitLabelLineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsDoubleSpinBox" name="mMapUnitsPerBarUnitSpinBox">
<property name="toolTip">
<string>Specifies how many scalebar units per labeled unit. For example, if your scalebar units are set to &quot;meters&quot;, a multiplier of 1000 will result in the scalebar labels in kilometers.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>9999999999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="mUnitLabelLineEdit">
<property name="toolTip">
<string>Text used for labeling the scalebar units, e.g., &quot;m&quot; or &quot;km&quot;. This should be matched to reflect the multiplier above. </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mUnitsComboBox">
<property name="toolTip">
<string>Specifies the underlying units used for scalebar calculations, e.g., &quot;meters&quot; or &quot;feet&quot;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mMapUnitsPerBarUnitLabel">
<property name="text">
<string>Label unit multiplier</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mMapUnitsPerBarUnitSpinBox</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mGroupBoxSegments">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Segments</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0,0">
<item row="0" column="0">
<widget class="QLabel" name="mSegmentLabel">
<property name="text">
<string>Segments</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QgsDoubleSpinBox" name="mSegmentSizeSpinBox">
<property name="toolTip">
<string>Number of scalebar units per scalebar segment</string>
</property>
<property name="suffix">
<string> units</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>9999999999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QgsSpinBox" name="mNumberOfSegmentsSpinBox">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>right </string>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QgsSpinBox" name="mSegmentsLeftSpinBox">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>left </string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="mFixedSizeRadio">
<property name="text">
<string>Fi&amp;xed width</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QRadioButton" name="mFitWidthRadio">
<property name="text">
<string>Fit segment width</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QgsDoubleSpinBox" name="mHeightSpinBox">
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>999.990000000000009</double>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsDoubleSpinBox" name="mMinWidthSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>999.990000000000009</double>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QgsDoubleSpinBox" name="mMaxWidthSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>999.990000000000009</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox_5">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Display</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1,0">
<item row="2" column="1">
<widget class="QgsDoubleSpinBox" name="mLineWidthSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> mm</string>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.200000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Box margin</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="mAlignmentLabel">
<property name="text">
<string>Alignment</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Labels margin</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Cap style</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Join style</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QgsPropertyOverrideButton" name="mLineWidthDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mLabelBarSpaceSpinBox">
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mBoxSizeSpinBox">
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QgsPenJoinStyleComboBox" name="mLineJoinStyleCombo"/>
</item>
<item row="4" column="1" colspan="2">
<widget class="QgsPenCapStyleComboBox" name="mLineCapStyleCombo"/>
</item>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="mAlignmentComboBox"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox_4">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Fonts and colors</string>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,0">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QgsColorButton" name="mFontColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Font color</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QgsColorButton" name="mStrokeColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QgsPropertyOverrideButton" name="mLineColorDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Secondary fill color</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Fill color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QgsColorButton" name="mFillColor2Button">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QgsPropertyOverrideButton" name="mFillColor2DDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Line color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QgsColorButton" name="mFillColorButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QgsPropertyOverrideButton" name="mFillColorDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QgsFontButton" name="mFontButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsScrollArea</class>
<extends>QScrollArea</extends>
<header>qgsscrollarea.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsFontButton</class>
<extends>QToolButton</extends>
<header>qgsfontbutton.h</header>
</customwidget>
<customwidget>
<class>QgsSpinBox</class>
<extends>QSpinBox</extends>
<header>qgsspinbox.h</header>
</customwidget>
<customwidget>
<class>QgsLayoutItemComboBox</class>
<extends>QComboBox</extends>
<header>qgslayoutitemcombobox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
<customwidget>
<class>QgsPenJoinStyleComboBox</class>
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
<customwidget>
<class>QgsPenCapStyleComboBox</class>
<extends>QComboBox</extends>
<header>qgspenstylecombobox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>scrollArea</tabstop>
<tabstop>groupBox</tabstop>
<tabstop>mMapItemComboBox</tabstop>
<tabstop>mStyleComboBox</tabstop>
<tabstop>mGroupBoxUnits</tabstop>
<tabstop>mUnitsComboBox</tabstop>
<tabstop>mMapUnitsPerBarUnitSpinBox</tabstop>
<tabstop>mUnitLabelLineEdit</tabstop>
<tabstop>mGroupBoxSegments</tabstop>
<tabstop>mSegmentsLeftSpinBox</tabstop>
<tabstop>mNumberOfSegmentsSpinBox</tabstop>
<tabstop>mFixedSizeRadio</tabstop>
<tabstop>mSegmentSizeSpinBox</tabstop>
<tabstop>mFitWidthRadio</tabstop>
<tabstop>mMinWidthSpinBox</tabstop>
<tabstop>mMaxWidthSpinBox</tabstop>
<tabstop>mHeightSpinBox</tabstop>
<tabstop>groupBox_5</tabstop>
<tabstop>mBoxSizeSpinBox</tabstop>
<tabstop>mLabelBarSpaceSpinBox</tabstop>
<tabstop>mLineWidthSpinBox</tabstop>
<tabstop>mLineWidthDDBtn</tabstop>
<tabstop>mLineJoinStyleCombo</tabstop>
<tabstop>mLineCapStyleCombo</tabstop>
<tabstop>mAlignmentComboBox</tabstop>
<tabstop>groupBox_4</tabstop>
<tabstop>mFontButton</tabstop>
<tabstop>mFontColorButton</tabstop>
<tabstop>mFillColorButton</tabstop>
<tabstop>mFillColorDDBtn</tabstop>
<tabstop>mFillColor2Button</tabstop>
<tabstop>mFillColor2DDBtn</tabstop>
<tabstop>mStrokeColorButton</tabstop>
<tabstop>mLineColorDDBtn</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>