void QgsLayoutScaleBarWidget::mUnitsComboBox_currentIndexChanged( int index ) { if ( !mScalebar ) { return; } QVariant unitData = mUnitsComboBox->itemData( index ); if ( unitData.type() == QVariant::Invalid ) { return; } disconnectUpdateSignal(); mScalebar->beginCommand( tr( "Set Scalebar Units" ) ); mScalebar->applyDefaultSize( static_cast< QgsUnitTypes::DistanceUnit >( unitData.toInt() ) ); mScalebar->update(); mUnitLabelLineEdit->setText( mScalebar->unitLabel() ); mSegmentSizeSpinBox->setValue( mScalebar->unitsPerSegment() ); mMapUnitsPerBarUnitSpinBox->setValue( mScalebar->mapUnitsPerScaleBarUnit() ); connectUpdateSignal(); mScalebar->endCommand(); }
void QgsComposerScaleBarWidget::segmentSizeRadioChanged( QAbstractButton *radio ) { bool fixedSizeMode = radio == mFixedSizeRadio; mMinWidthSpinBox->setEnabled( !fixedSizeMode ); mMaxWidthSpinBox->setEnabled( !fixedSizeMode ); mSegmentSizeSpinBox->setEnabled( fixedSizeMode ); if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar segment size mode" ), QgsComposerMergeCommand::ScaleBarSegmentSize ); disconnectUpdateSignal(); if ( mFixedSizeRadio->isChecked() ) { mComposerScaleBar->setSegmentSizeMode( QgsScaleBarSettings::SegmentSizeFixed ); mComposerScaleBar->setNumUnitsPerSegment( mSegmentSizeSpinBox->value() ); } else /*if(mFitWidthRadio->isChecked())*/ { mComposerScaleBar->setSegmentSizeMode( QgsScaleBarSettings::SegmentSizeFitWidth ); } mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::on_mFontButton_clicked() { if ( !mComposerScaleBar ) { return; } bool dialogAccepted; QFont oldFont = mComposerScaleBar->font(); #if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, this, QString(), QFontDialog::DontUseNativeDialog ); #else QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, this ); #endif if ( dialogAccepted ) { mComposerScaleBar->beginCommand( tr( "Scalebar font changed" ) ); disconnectUpdateSignal(); mComposerScaleBar->setFont( newFont ); connectUpdateSignal(); mComposerScaleBar->endCommand(); } mComposerScaleBar->update(); }
void QgsComposerScaleBarWidget::mUnitsComboBox_currentIndexChanged( int index ) { if ( !mComposerScaleBar ) { return; } QVariant unitData = mUnitsComboBox->itemData( index ); if ( unitData.type() == QVariant::Invalid ) { return; } disconnectUpdateSignal(); mComposerScaleBar->setUnits( ( QgsUnitTypes::DistanceUnit )unitData.toInt() ); switch ( mUnitsComboBox->currentIndex() ) { case 0: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to map units" ) ); mComposerScaleBar->applyDefaultSize( QgsUnitTypes::DistanceUnknownUnit ); break; } case 2: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to feet" ) ); mComposerScaleBar->applyDefaultSize( QgsUnitTypes::DistanceFeet ); break; } case 3: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to nautical miles" ) ); mComposerScaleBar->applyDefaultSize( QgsUnitTypes::DistanceNauticalMiles ); break; } case 1: default: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to meters" ) ); mComposerScaleBar->applyDefaultSize( QgsUnitTypes::DistanceMeters ); break; } } mComposerScaleBar->update(); mUnitLabelLineEdit->setText( mComposerScaleBar->unitLabeling() ); mSegmentSizeSpinBox->setValue( mComposerScaleBar->numUnitsPerSegment() ); mMapUnitsPerBarUnitSpinBox->setValue( mComposerScaleBar->numMapUnitsPerScaleBarUnit() ); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mAlignmentComboBox_currentIndexChanged( int index ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar alignment" ) ); disconnectUpdateSignal(); mComposerScaleBar->setAlignment( ( QgsScaleBarSettings::Alignment ) index ); connectUpdateSignal(); mComposerScaleBar->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 QgsComposerScaleBarWidget::mHeightSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar height changed" ), QgsComposerMergeCommand::ScaleBarHeight ); disconnectUpdateSignal(); mComposerScaleBar->setHeight( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mStrokeColorButton_colorChanged( const QColor &newColor ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar line color changed" ), QgsComposerMergeCommand::ScaleBarStrokeColor ); disconnectUpdateSignal(); mComposerScaleBar->setLineColor( newColor ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mFillColor2Button_colorChanged( const QColor &newColor ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar secondary color changed" ), QgsComposerMergeCommand::ScaleBarFill2Color ); disconnectUpdateSignal(); mComposerScaleBar->setFillColor2( newColor ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::fontChanged() { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar font changed" ) ); disconnectUpdateSignal(); mComposerScaleBar->setFont( mFontButton->currentFont() ); connectUpdateSignal(); mComposerScaleBar->endCommand(); mComposerScaleBar->update(); }
void QgsComposerScaleBarWidget::on_mFontColorButton_colorChanged( const QColor& newColor ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar font color changed" ) ); disconnectUpdateSignal(); mComposerScaleBar->setFontColor( newColor ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged( int i ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Number of scalebar segments changed" ), QgsComposerMergeCommand::ScaleBarNSegments ); disconnectUpdateSignal(); mComposerScaleBar->setNumSegments( i ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsLayoutScaleBarWidget::fontChanged() { if ( !mScalebar ) { return; } mScalebar->beginCommand( tr( "Set Scalebar Font" ) ); disconnectUpdateSignal(); mScalebar->setFont( mFontButton->currentFont() ); connectUpdateSignal(); mScalebar->endCommand(); mScalebar->update(); }
void QgsComposerScaleBarWidget::mSegmentSizeSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar segment size" ), QgsComposerMergeCommand::ScaleBarSegmentSize ); disconnectUpdateSignal(); mComposerScaleBar->setNumUnitsPerSegment( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar label bar space" ), QgsComposerMergeCommand::ScaleBarLabelBarSize ); disconnectUpdateSignal(); mComposerScaleBar->setLabelBarSpace( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mUnitLabelLineEdit_textChanged( const QString &text ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar unit text" ), QgsComposerMergeCommand::ScaleBarUnitText ); disconnectUpdateSignal(); mComposerScaleBar->setUnitLabeling( text ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->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::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::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::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::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 QgsComposerScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar map units per segment" ), QgsComposerMergeCommand::ScaleBarMapUnitsSegment ); disconnectUpdateSignal(); mComposerScaleBar->setNumMapUnitsPerScaleBarUnit( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mLineWidthSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar line width" ), QgsComposerMergeCommand::ScaleBarLineWidth ); disconnectUpdateSignal(); mComposerScaleBar->setLineWidth( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mBoxSizeSpinBox_valueChanged( double d ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar box content space" ), QgsComposerMergeCommand::ScaleBarBoxContentSpace ); disconnectUpdateSignal(); mComposerScaleBar->setBoxContentSpace( d ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->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(); }
void QgsComposerScaleBarWidget::mMaxWidthSpinBox_valueChanged( double ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar segment size mode" ), QgsComposerMergeCommand::ScaleBarSegmentSize ); disconnectUpdateSignal(); mComposerScaleBar->setMaxBarWidth( mMaxWidthSpinBox->value() ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::mSegmentsLeftSpinBox_valueChanged( int i ) { if ( !mComposerScaleBar ) { return; } mComposerScaleBar->beginCommand( tr( "Scalebar segments left" ), QgsComposerMergeCommand::ScaleBarSegmentsLeft ); disconnectUpdateSignal(); mComposerScaleBar->setNumSegmentsLeft( i ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::on_mUnitsComboBox_currentIndexChanged( int index ) { if ( !mComposerScaleBar ) { return; } QVariant unitData = mUnitsComboBox->itemData( index ); if ( unitData.type() == QVariant::Invalid ) { return; } disconnectUpdateSignal(); mComposerScaleBar->setUnits(( QgsComposerScaleBar::ScaleBarUnits )unitData.toInt() ); switch ( mUnitsComboBox->currentIndex() ) { case 0: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to map units" ) ); mComposerScaleBar->applyDefaultSize( QgsComposerScaleBar::MapUnits ); break; } case 2: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to feet" ) ); mComposerScaleBar->applyDefaultSize( QgsComposerScaleBar::Feet ); break; } case 3: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to nautical miles" ) ); mComposerScaleBar->applyDefaultSize( QgsComposerScaleBar::NauticalMiles ); break; } case 1: default: { mComposerScaleBar->beginCommand( tr( "Scalebar changed to meters" ) ); mComposerScaleBar->applyDefaultSize( QgsComposerScaleBar::Meters ); break; } } mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->endCommand(); }
void QgsComposerScaleBarWidget::composerMapChanged( QgsComposerItem *item ) { QgsComposerMap *composerMap = dynamic_cast< QgsComposerMap * >( item ); if ( !composerMap ) { return; } //set it to scale bar mComposerScaleBar->beginCommand( tr( "Scalebar map changed" ) ); disconnectUpdateSignal(); mComposerScaleBar->setComposerMap( composerMap ); mComposerScaleBar->update(); connectUpdateSignal(); mComposerScaleBar->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->setLinkedMap( map ); mScalebar->update(); connectUpdateSignal(); mScalebar->endCommand(); }