QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): mLegend( legend ) { setupUi( this ); // setup icons mAddToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) ); mEditPushButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) ); mRemoveToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) ); mMoveUpToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) ); mMoveDownToolButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) ); mCountToolButton->setIcon( QIcon( QgsApplication::iconPath( "mActionSum.png" ) ) ); //add widget for item properties QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, legend ); toolBox->addItem( itemPropertiesWidget, tr( "General Options" ) ); if ( legend ) { mItemTreeView->setModel( legend->model() ); } mItemTreeView->setDragEnabled( true ); mItemTreeView->setAcceptDrops( true ); mItemTreeView->setDropIndicatorShown( true ); mItemTreeView->setDragDropMode( QAbstractItemView::InternalMove ); 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 & ) ) ); }
void QgsComposerScaleBarWidget::disconnectUpdateSignal() { if ( mComposerScaleBar ) { QObject::disconnect( mComposerScaleBar, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) ); } }
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QWidget(), mComposerScaleBar( scaleBar ) { setupUi( this ); connectUpdateSignal(); //add widget for general composer item properties QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, scaleBar ); mainLayout->addWidget( itemPropertiesWidget ); 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" ), 0 ); mUnitsComboBox->insertItem( 1, tr( "Meters" ), 1 ); mUnitsComboBox->insertItem( 2, tr( "Feet" ), 2 ); mUnitsComboBox->insertItem( 3, tr( "Nautical Miles" ), 3 ); blockMemberSignals( false ); setGuiElements(); //set the GUI elements to the state of scaleBar }
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( 0, scaleBar ), mComposerScaleBar( scaleBar ) { setupUi( this ); connectUpdateSignal(); //add widget for general composer item properties QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, scaleBar ); mainLayout->addWidget( itemPropertiesWidget ); mSegmentSizeRadioGroup.addButton( mFixedSizeRadio ); mSegmentSizeRadioGroup.addButton( mFitWidthRadio ); connect( &mSegmentSizeRadioGroup, SIGNAL( buttonClicked( QAbstractButton* ) ), this, SLOT( segmentSizeRadioChanged( QAbstractButton* ) ) ); 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" ), 0 ); mUnitsComboBox->insertItem( 1, tr( "Meters" ), 1 ); mUnitsComboBox->insertItem( 2, tr( "Feet" ), 2 ); mUnitsComboBox->insertItem( 3, tr( "Nautical Miles" ), 3 ); mFillColorButton->setColorDialogTitle( tr( "Select fill color" ) ); mFillColorButton->setAllowAlpha( true ); mFillColorButton->setContext( "composer" ); mFillColorButton->setNoColorString( tr( "Transparent fill" ) ); mFillColorButton->setShowNoColor( true ); mFillColor2Button->setColorDialogTitle( tr( "Select alternate fill color" ) ); mFillColor2Button->setAllowAlpha( true ); mFillColor2Button->setContext( "composer" ); mFillColor2Button->setNoColorString( tr( "Transparent fill" ) ); mFillColor2Button->setShowNoColor( true ); mFontColorButton->setColorDialogTitle( tr( "Select font color" ) ); mFontColorButton->setAllowAlpha( true ); mFontColorButton->setContext( "composer" ); mStrokeColorButton->setColorDialogTitle( tr( "Select stroke color" ) ); mStrokeColorButton->setAllowAlpha( true ); mStrokeColorButton->setContext( "composer" ); mStrokeColorButton->setNoColorString( tr( "Transparent stroke" ) ); mStrokeColorButton->setShowNoColor( true ); blockMemberSignals( false ); setGuiElements(); //set the GUI elements to the state of scaleBar }
QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): mLegend( legend ) { setupUi( this ); //add widget for item properties QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, legend ); gridLayout->addWidget( itemPropertiesWidget, 2, 0, 1, 1 ); if ( legend ) { mItemTreeView->setModel( legend->model() ); } setGuiElements(); }
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; }
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar *scaleBar ): QgsComposerItemBaseWidget( nullptr, scaleBar ), mComposerScaleBar( scaleBar ) { setupUi( this ); connect( mHeightSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mHeightSpinBox_valueChanged ); connect( mLineWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mLineWidthSpinBox_valueChanged ); connect( mSegmentSizeSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mSegmentSizeSpinBox_valueChanged ); connect( mSegmentsLeftSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mSegmentsLeftSpinBox_valueChanged ); connect( mNumberOfSegmentsSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mNumberOfSegmentsSpinBox_valueChanged ); connect( mUnitLabelLineEdit, &QLineEdit::textChanged, this, &QgsComposerScaleBarWidget::mUnitLabelLineEdit_textChanged ); connect( mMapUnitsPerBarUnitSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mMapUnitsPerBarUnitSpinBox_valueChanged ); connect( mFontColorButton, &QgsColorButton::colorChanged, this, &QgsComposerScaleBarWidget::mFontColorButton_colorChanged ); connect( mFillColorButton, &QgsColorButton::colorChanged, this, &QgsComposerScaleBarWidget::mFillColorButton_colorChanged ); connect( mFillColor2Button, &QgsColorButton::colorChanged, this, &QgsComposerScaleBarWidget::mFillColor2Button_colorChanged ); connect( mStrokeColorButton, &QgsColorButton::colorChanged, this, &QgsComposerScaleBarWidget::mStrokeColorButton_colorChanged ); connect( mStyleComboBox, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::currentIndexChanged ), this, &QgsComposerScaleBarWidget::mStyleComboBox_currentIndexChanged ); connect( mLabelBarSpaceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mLabelBarSpaceSpinBox_valueChanged ); connect( mBoxSizeSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mBoxSizeSpinBox_valueChanged ); connect( mAlignmentComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsComposerScaleBarWidget::mAlignmentComboBox_currentIndexChanged ); connect( mUnitsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsComposerScaleBarWidget::mUnitsComboBox_currentIndexChanged ); connect( mLineJoinStyleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsComposerScaleBarWidget::mLineJoinStyleCombo_currentIndexChanged ); connect( mLineCapStyleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsComposerScaleBarWidget::mLineCapStyleCombo_currentIndexChanged ); connect( mMinWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mMinWidthSpinBox_valueChanged ); connect( mMaxWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsComposerScaleBarWidget::mMaxWidthSpinBox_valueChanged ); setPanelTitle( tr( "Scalebar properties" ) ); mFontButton->setMode( QgsFontButton::ModeQFont ); connectUpdateSignal(); //add widget for general composer item properties QgsComposerItemWidget *itemPropertiesWidget = new QgsComposerItemWidget( this, scaleBar ); mainLayout->addWidget( itemPropertiesWidget ); mSegmentSizeRadioGroup.addButton( mFixedSizeRadio ); mSegmentSizeRadioGroup.addButton( mFitWidthRadio ); connect( &mSegmentSizeRadioGroup, static_cast < void ( QButtonGroup::* )( QAbstractButton * ) > ( &QButtonGroup::buttonClicked ), this, &QgsComposerScaleBarWidget::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 ); QgsComposition *scaleBarComposition = mComposerScaleBar->composition(); if ( scaleBarComposition ) { mMapItemComboBox->setComposition( scaleBarComposition ); mMapItemComboBox->setItemType( QgsComposerItem::ComposerMap ); } connect( mMapItemComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsComposerScaleBarWidget::composerMapChanged ); registerDataDefinedButton( mFillColorDDBtn, QgsComposerObject::ScalebarFillColor ); registerDataDefinedButton( mFillColor2DDBtn, QgsComposerObject::ScalebarFillColor2 ); registerDataDefinedButton( mLineColorDDBtn, QgsComposerObject::ScalebarLineColor ); registerDataDefinedButton( mLineWidthDDBtn, QgsComposerObject::ScalebarLineWidth ); blockMemberSignals( false ); setGuiElements(); //set the GUI elements to the state of scaleBar connect( mFontButton, &QgsFontButton::changed, this, &QgsComposerScaleBarWidget::fontChanged ); }