QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslayoutpicturewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutpicturewidget.cpp
3  --------------------------
4  begin : October 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgslayoutpicturewidget.h"
19 #include "qgsapplication.h"
20 #include "qgslayoutitemmap.h"
21 #include "qgslayoutitempicture.h"
22 #include "qgslayout.h"
24 #include "qgssvgcache.h"
25 #include "qgssettings.h"
26 #include "qgssvgselectorwidget.h"
28 
29 #include <QDoubleValidator>
30 #include <QFileDialog>
31 #include <QFileInfo>
32 #include <QImageReader>
33 #include <QMessageBox>
34 #include <QPainter>
35 #include <QProgressDialog>
36 #include <QSvgRenderer>
37 
39  : QgsLayoutItemBaseWidget( nullptr, picture )
40  , mPicture( picture )
41 {
42  setupUi( this );
43 
44  mSvgSelectorWidget->setAllowParameters( true );
45  mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible( true );
46  mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral( "/UI/lastSVGMarkerDir" ) );
47  mSvgSelectorWidget->initParametersModel( layoutObject(), coverageLayer() );
48 
49  mResizeModeComboBox->addItem( tr( "Zoom" ), QgsLayoutItemPicture::Zoom );
50  mResizeModeComboBox->addItem( tr( "Stretch" ), QgsLayoutItemPicture::Stretch );
51  mResizeModeComboBox->addItem( tr( "Clip" ), QgsLayoutItemPicture::Clip );
52  mResizeModeComboBox->addItem( tr( "Zoom and Resize Frame" ), QgsLayoutItemPicture::ZoomResizeFrame );
53  mResizeModeComboBox->addItem( tr( "Resize Frame to Image Size" ), QgsLayoutItemPicture::FrameToImageSize );
54 
55  mAnchorPointComboBox->addItem( tr( "Top Left" ), QgsLayoutItem::UpperLeft );
56  mAnchorPointComboBox->addItem( tr( "Top Center" ), QgsLayoutItem::UpperMiddle );
57  mAnchorPointComboBox->addItem( tr( "Top Right" ), QgsLayoutItem::UpperRight );
58  mAnchorPointComboBox->addItem( tr( "Middle Left" ), QgsLayoutItem::MiddleLeft );
59  mAnchorPointComboBox->addItem( tr( "Middle" ), QgsLayoutItem::Middle );
60  mAnchorPointComboBox->addItem( tr( "Middle Right" ), QgsLayoutItem::MiddleRight );
61  mAnchorPointComboBox->addItem( tr( "Bottom Left" ), QgsLayoutItem::LowerLeft );
62  mAnchorPointComboBox->addItem( tr( "Bottom Center" ), QgsLayoutItem::LowerMiddle );
63  mAnchorPointComboBox->addItem( tr( "Bottom Right" ), QgsLayoutItem::LowerRight );
64 
65  connect( mPictureRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPictureWidget::mPictureRotationSpinBox_valueChanged );
66  connect( mRotationFromComposerMapCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutPictureWidget::mRotationFromComposerMapCheckBox_stateChanged );
67  connect( mResizeModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutPictureWidget::mResizeModeComboBox_currentIndexChanged );
68  connect( mAnchorPointComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutPictureWidget::mAnchorPointComboBox_currentIndexChanged );
69  connect( mFillColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutPictureWidget::mFillColorButton_colorChanged );
70  connect( mStrokeColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutPictureWidget::mStrokeColorButton_colorChanged );
71  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPictureWidget::mStrokeWidthSpinBox_valueChanged );
72  connect( mPictureRotationOffsetSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPictureWidget::mPictureRotationOffsetSpinBox_valueChanged );
73  connect( mNorthTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutPictureWidget::mNorthTypeComboBox_currentIndexChanged );
74  connect( mSvgSelectorWidget, &QgsSvgSelectorWidget::svgSelected, this, &QgsLayoutPictureWidget::sourceChanged );
75 
76  connect( mSvgSelectorWidget, &QgsSvgSelectorWidget::svgParametersChanged, this, &QgsLayoutPictureWidget::setSvgDynamicParameters );
77  connect( mRadioSVG, &QRadioButton::toggled, this, &QgsLayoutPictureWidget::modeChanged );
78  connect( mRadioRaster, &QRadioButton::toggled, this, &QgsLayoutPictureWidget::modeChanged );
79 
80  mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral( "/UI/lastComposerPictureDir" ) );
81 
82  setPanelTitle( tr( "Picture Properties" ) );
83 
84  mFillColorButton->setAllowOpacity( true );
85  mFillColorButton->setColorDialogTitle( tr( "Select Fill Color" ) );
86  mFillColorButton->setContext( QStringLiteral( "composer" ) );
87  mStrokeColorButton->setAllowOpacity( true );
88  mStrokeColorButton->setColorDialogTitle( tr( "Select Stroke Color" ) );
89  mStrokeColorButton->setContext( QStringLiteral( "composer" ) );
90 
91  mFillColorDDBtn->registerLinkedWidget( mFillColorButton );
92  mStrokeColorDDBtn->registerLinkedWidget( mStrokeColorButton );
93 
94  mNorthTypeComboBox->blockSignals( true );
95  mNorthTypeComboBox->addItem( tr( "Grid North" ), QgsLayoutItemPicture::GridNorth );
96  mNorthTypeComboBox->addItem( tr( "True North" ), QgsLayoutItemPicture::TrueNorth );
97  mNorthTypeComboBox->blockSignals( false );
98  mPictureRotationOffsetSpinBox->setClearValue( 0.0 );
99  mPictureRotationSpinBox->setClearValue( 0.0 );
100 
101  //add widget for general composer item properties
102  mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, picture );
103  mainLayout->addWidget( mItemPropertiesWidget );
104 
105  if ( mPicture->layout() )
106  {
107  mComposerMapComboBox->setCurrentLayout( mPicture->layout() );
108  mComposerMapComboBox->setItemType( QgsLayoutItemRegistry::LayoutMap );
109  connect( mComposerMapComboBox, &QgsLayoutItemComboBox::itemChanged, this, &QgsLayoutPictureWidget::mapChanged );
110  }
111 
112  setGuiElementValues();
113 
114  connect( mPicture, &QgsLayoutObject::changed, this, &QgsLayoutPictureWidget::setGuiElementValues );
115  connect( mPicture, &QgsLayoutItemPicture::pictureRotationChanged, this, &QgsLayoutPictureWidget::setPicRotationSpinValue );
116 
117  //connections for data defined buttons
118  registerDataDefinedButton( mSvgSelectorWidget->propertyOverrideToolButton(), QgsLayoutObject::PictureSource );
122 }
123 
125 {
126  if ( mItemPropertiesWidget )
127  mItemPropertiesWidget->setMasterLayout( masterLayout );
128 }
129 
130 void QgsLayoutPictureWidget::mPictureRotationSpinBox_valueChanged( double d )
131 {
132  if ( mPicture )
133  {
134  mPicture->beginCommand( tr( "Change Picture Rotation" ), QgsLayoutItem::UndoPictureRotation );
135  mPicture->setPictureRotation( d );
136  mPicture->endCommand();
137  }
138 }
139 
140 void QgsLayoutPictureWidget::mResizeModeComboBox_currentIndexChanged( int )
141 {
142  if ( !mPicture )
143  {
144  return;
145  }
146 
147  mPicture->beginCommand( tr( "Change Resize Mode" ) );
148  mPicture->setResizeMode( static_cast< QgsLayoutItemPicture::ResizeMode >( mResizeModeComboBox->currentData().toInt() ) );
149  mPicture->endCommand();
150 
151  //disable picture rotation for non-zoom modes
152  mRotationGroupBox->setEnabled( mPicture->resizeMode() == QgsLayoutItemPicture::Zoom ||
153  mPicture->resizeMode() == QgsLayoutItemPicture::ZoomResizeFrame );
154 
155  //disable anchor point control for certain zoom modes
156  if ( mPicture->resizeMode() == QgsLayoutItemPicture::Zoom ||
157  mPicture->resizeMode() == QgsLayoutItemPicture::Clip )
158  {
159  mAnchorPointComboBox->setEnabled( true );
160  }
161  else
162  {
163  mAnchorPointComboBox->setEnabled( false );
164  }
165 }
166 
167 void QgsLayoutPictureWidget::mAnchorPointComboBox_currentIndexChanged( int )
168 {
169  if ( !mPicture )
170  {
171  return;
172  }
173 
174  mPicture->beginCommand( tr( "Change Placement" ) );
175  mPicture->setPictureAnchor( static_cast< QgsLayoutItem::ReferencePoint >( mAnchorPointComboBox->currentData().toInt() ) );
176  mPicture->endCommand();
177 }
178 
180 {
182  return false;
183 
184  if ( mPicture )
185  {
186  disconnect( mPicture, &QgsLayoutObject::changed, this, &QgsLayoutPictureWidget::setGuiElementValues );
187  disconnect( mPicture, &QgsLayoutItemPicture::pictureRotationChanged, this, &QgsLayoutPictureWidget::setPicRotationSpinValue );
188  }
189 
190  mPicture = qobject_cast< QgsLayoutItemPicture * >( item );
191  mItemPropertiesWidget->setItem( mPicture );
192 
193  if ( mPicture )
194  {
195  connect( mPicture, &QgsLayoutObject::changed, this, &QgsLayoutPictureWidget::setGuiElementValues );
196  connect( mPicture, &QgsLayoutItemPicture::pictureRotationChanged, this, &QgsLayoutPictureWidget::setPicRotationSpinValue );
197  }
198 
199  setGuiElementValues();
200 
201  return true;
202 }
203 
204 void QgsLayoutPictureWidget::mRotationFromComposerMapCheckBox_stateChanged( int state )
205 {
206  if ( !mPicture )
207  {
208  return;
209  }
210 
211  mPicture->beginCommand( tr( "Toggle Rotation Sync" ) );
212  if ( state == Qt::Unchecked )
213  {
214  mPicture->setLinkedMap( nullptr );
215  mPictureRotationSpinBox->setEnabled( true );
216  mComposerMapComboBox->setEnabled( false );
217  mNorthTypeComboBox->setEnabled( false );
218  mPictureRotationOffsetSpinBox->setEnabled( false );
219  mPicture->setPictureRotation( mPictureRotationSpinBox->value() );
220  }
221  else
222  {
223  QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap * >( mComposerMapComboBox->currentItem() );
224  mPicture->setLinkedMap( map );
225  mPictureRotationSpinBox->setEnabled( false );
226  mNorthTypeComboBox->setEnabled( true );
227  mPictureRotationOffsetSpinBox->setEnabled( true );
228  mComposerMapComboBox->setEnabled( true );
229  }
230  mPicture->endCommand();
231 }
232 
233 void QgsLayoutPictureWidget::mapChanged( QgsLayoutItem *item )
234 {
235  if ( !mPicture )
236  {
237  return;
238  }
239 
240  //get composition
241  const QgsLayout *layout = mPicture->layout();
242  if ( !layout )
243  {
244  return;
245  }
246 
247  QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap *>( item );
248  if ( !map )
249  {
250  return;
251  }
252 
253  mPicture->beginCommand( tr( "Change Rotation Map" ) );
254  mPicture->setLinkedMap( map );
255  mPicture->update();
256  mPicture->endCommand();
257 }
258 
259 void QgsLayoutPictureWidget::setPicRotationSpinValue( double r )
260 {
261  mPictureRotationSpinBox->blockSignals( true );
262  mPictureRotationSpinBox->setValue( r );
263  mPictureRotationSpinBox->blockSignals( false );
264 }
265 
266 void QgsLayoutPictureWidget::setGuiElementValues()
267 {
268  //set initial gui values
269  if ( mPicture )
270  {
271  mPictureRotationSpinBox->blockSignals( true );
272  mComposerMapComboBox->blockSignals( true );
273  mRotationFromComposerMapCheckBox->blockSignals( true );
274  mNorthTypeComboBox->blockSignals( true );
275  mPictureRotationOffsetSpinBox->blockSignals( true );
276  mResizeModeComboBox->blockSignals( true );
277  mAnchorPointComboBox->blockSignals( true );
278  mFillColorButton->blockSignals( true );
279  mStrokeColorButton->blockSignals( true );
280  mStrokeWidthSpinBox->blockSignals( true );
281 
282  mPictureRotationSpinBox->setValue( mPicture->pictureRotation() );
283 
284  mComposerMapComboBox->setItem( mPicture->linkedMap() );
285 
286  if ( mPicture->linkedMap() )
287  {
288  mRotationFromComposerMapCheckBox->setCheckState( Qt::Checked );
289  mPictureRotationSpinBox->setEnabled( false );
290  mComposerMapComboBox->setEnabled( true );
291  mNorthTypeComboBox->setEnabled( true );
292  mPictureRotationOffsetSpinBox->setEnabled( true );
293  }
294  else
295  {
296  mRotationFromComposerMapCheckBox->setCheckState( Qt::Unchecked );
297  mPictureRotationSpinBox->setEnabled( true );
298  mComposerMapComboBox->setEnabled( false );
299  mNorthTypeComboBox->setEnabled( false );
300  mPictureRotationOffsetSpinBox->setEnabled( false );
301  }
302  mNorthTypeComboBox->setCurrentIndex( mNorthTypeComboBox->findData( mPicture->northMode() ) );
303  mPictureRotationOffsetSpinBox->setValue( mPicture->northOffset() );
304 
305  mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mPicture->resizeMode() ) );
306  //disable picture rotation for non-zoom modes
307  mRotationGroupBox->setEnabled( mPicture->resizeMode() == QgsLayoutItemPicture::Zoom ||
308  mPicture->resizeMode() == QgsLayoutItemPicture::ZoomResizeFrame );
309 
310  mAnchorPointComboBox->setCurrentIndex( mAnchorPointComboBox->findData( mPicture->pictureAnchor() ) );
311  //disable anchor point control for certain zoom modes
312  if ( mPicture->resizeMode() == QgsLayoutItemPicture::Zoom ||
313  mPicture->resizeMode() == QgsLayoutItemPicture::Clip )
314  {
315  mAnchorPointComboBox->setEnabled( true );
316  }
317  else
318  {
319  mAnchorPointComboBox->setEnabled( false );
320  }
321 
322  switch ( mPicture->mode() )
323  {
326  mRadioSVG->setChecked( true );
327  break;
329  mRadioRaster->setChecked( true );
330  break;
331  }
332 
333  mSvgSelectorWidget->setSvgPath( mPicture->picturePath() );
334  mSvgSelectorWidget->setSvgParameters( mPicture->svgDynamicParameters() );
335 
336  updateSvgParamGui( false );
337  mFillColorButton->setColor( mPicture->svgFillColor() );
338  mStrokeColorButton->setColor( mPicture->svgStrokeColor() );
339  mStrokeWidthSpinBox->setValue( mPicture->svgStrokeWidth() );
340 
341  mRotationFromComposerMapCheckBox->blockSignals( false );
342  mPictureRotationSpinBox->blockSignals( false );
343  mComposerMapComboBox->blockSignals( false );
344  mNorthTypeComboBox->blockSignals( false );
345  mPictureRotationOffsetSpinBox->blockSignals( false );
346  mResizeModeComboBox->blockSignals( false );
347  mAnchorPointComboBox->blockSignals( false );
348  mFillColorButton->blockSignals( false );
349  mStrokeColorButton->blockSignals( false );
350  mStrokeWidthSpinBox->blockSignals( false );
351 
353  }
354 }
355 
356 void QgsLayoutPictureWidget::updateSvgParamGui( bool resetValues )
357 {
358  if ( !mPicture )
359  return;
360 
361  const QString picturePath = mPicture->picturePath();
362 
363  //activate gui for svg parameters only if supported by the svg file
364  bool hasFillParam, hasFillOpacityParam, hasStrokeParam, hasStrokeWidthParam, hasStrokeOpacityParam;
365  QColor defaultFill, defaultStroke;
366  double defaultStrokeWidth, defaultFillOpacity, defaultStrokeOpacity;
367  bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultStrokeColor, hasDefaultStrokeWidth, hasDefaultStrokeOpacity;
368  QgsApplication::svgCache()->containsParams( picturePath, hasFillParam, hasDefaultFillColor, defaultFill,
369  hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
370  hasStrokeParam, hasDefaultStrokeColor, defaultStroke,
371  hasStrokeWidthParam, hasDefaultStrokeWidth, defaultStrokeWidth,
372  hasStrokeOpacityParam, hasDefaultStrokeOpacity, defaultStrokeOpacity );
373 
374  if ( resetValues )
375  {
376  QColor fill = mFillColorButton->color();
377  const double newOpacity = hasFillOpacityParam ? fill.alphaF() : 1.0;
378  if ( hasDefaultFillColor )
379  {
380  fill = defaultFill;
381  }
382  fill.setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
383  mFillColorButton->setColor( fill );
384  }
385  mFillColorButton->setEnabled( hasFillParam );
386  mFillColorDDBtn->setEnabled( hasFillParam );
387  mFillColorButton->setAllowOpacity( hasFillOpacityParam );
388  if ( resetValues )
389  {
390  QColor stroke = mStrokeColorButton->color();
391  const double newOpacity = hasStrokeOpacityParam ? stroke.alphaF() : 1.0;
392  if ( hasDefaultStrokeColor )
393  {
394  stroke = defaultStroke;
395  }
396  stroke.setAlphaF( hasDefaultStrokeOpacity ? defaultStrokeOpacity : newOpacity );
397  mStrokeColorButton->setColor( stroke );
398  }
399  mStrokeColorButton->setEnabled( hasStrokeParam );
400  mStrokeColorDDBtn->setEnabled( hasStrokeParam );
401  mStrokeColorButton->setAllowOpacity( hasStrokeOpacityParam );
402  if ( hasDefaultStrokeWidth && resetValues )
403  {
404  mStrokeWidthSpinBox->setValue( defaultStrokeWidth );
405  }
406  mStrokeWidthSpinBox->setEnabled( hasStrokeWidthParam );
407  mStrokeWidthDDBtn->setEnabled( hasStrokeWidthParam );
408 }
409 
410 void QgsLayoutPictureWidget::mFillColorButton_colorChanged( const QColor &color )
411 {
412  mPicture->beginCommand( tr( "Change Picture Fill Color" ), QgsLayoutItem::UndoPictureFillColor );
413  mPicture->setSvgFillColor( color );
414  mPicture->endCommand();
415  mPicture->update();
416 }
417 
418 void QgsLayoutPictureWidget::mStrokeColorButton_colorChanged( const QColor &color )
419 {
420  mPicture->beginCommand( tr( "Change Picture Stroke Color" ), QgsLayoutItem::UndoPictureStrokeColor );
421  mPicture->setSvgStrokeColor( color );
422  mPicture->endCommand();
423  mPicture->update();
424 }
425 
426 void QgsLayoutPictureWidget::mStrokeWidthSpinBox_valueChanged( double d )
427 {
428  mPicture->beginCommand( tr( "Change Picture Stroke Width" ), QgsLayoutItem::UndoPictureStrokeWidth );
429  mPicture->setSvgStrokeWidth( d );
430  mPicture->endCommand();
431  mPicture->update();
432 }
433 
434 void QgsLayoutPictureWidget::mPictureRotationOffsetSpinBox_valueChanged( double d )
435 {
436  mPicture->beginCommand( tr( "Change Picture North Offset" ), QgsLayoutItem::UndoPictureNorthOffset );
437  mPicture->setNorthOffset( d );
438  mPicture->endCommand();
439  mPicture->update();
440 }
441 
442 void QgsLayoutPictureWidget::mNorthTypeComboBox_currentIndexChanged( int index )
443 {
444  mPicture->beginCommand( tr( "Change Picture North Mode" ) );
445  mPicture->setNorthMode( static_cast< QgsLayoutItemPicture::NorthMode >( mNorthTypeComboBox->itemData( index ).toInt() ) );
446  mPicture->endCommand();
447  mPicture->update();
448 }
449 
450 void QgsLayoutPictureWidget::modeChanged( bool checked )
451 {
452  if ( !checked )
453  return;
454 
455  const bool svg = mRadioSVG->isChecked();
457 
458  if ( svg )
459  mSvgSelectorWidget->sourceLineEdit()->setMode( QgsPictureSourceLineEditBase::Svg );
460  else
461  mSvgSelectorWidget->sourceLineEdit()->setMode( QgsPictureSourceLineEditBase::Image );
462 
463  mSvgSelectorWidget->setBrowserVisible( svg );
464  mSvgSelectorWidget->setAllowParameters( svg );
465  mSVGParamsGroupBox->setVisible( svg );
466 
467  if ( mPicture && mPicture->mode() != newFormat )
468  {
469  mPicture->beginCommand( tr( "Change Picture Type" ) );
470  mPicture->setMode( newFormat );
471  mPicture->endCommand();
472  }
473 }
474 
475 void QgsLayoutPictureWidget::sourceChanged( const QString &source )
476 {
477  if ( mPicture )
478  {
479  mPicture->beginCommand( tr( "Change Picture" ) );
480  mPicture->setPicturePath( source, mRadioSVG->isChecked() ? QgsLayoutItemPicture::FormatSVG : QgsLayoutItemPicture::FormatRaster );
481  mPicture->update();
482  mPicture->endCommand();
483  updateSvgParamGui();
484  }
485 }
486 
487 void QgsLayoutPictureWidget::setSvgDynamicParameters( const QMap<QString, QgsProperty> &parameters )
488 {
489  mPicture->beginCommand( tr( "Set SVG parameters" ) );
490  mPicture->setSvgDynamicParameters( parameters );
491  mPicture->update();
492  mPicture->endCommand();
493 }
494 
496 {
497  updateDataDefinedButton( mSvgSelectorWidget->propertyOverrideToolButton() );
498  updateDataDefinedButton( mFillColorDDBtn );
499  updateDataDefinedButton( mStrokeColorDDBtn );
500  updateDataDefinedButton( mStrokeWidthDDBtn );
501 }
502 
QgsLayoutItemBaseWidget::updateDataDefinedButton
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Updates a previously registered data defined button to reflect the item's current properties.
Definition: qgslayoutitemwidget.cpp:251
QgsLayoutItemPicture::FrameToImageSize
@ FrameToImageSize
Sets size of frame to match original size of image without scaling.
Definition: qgslayoutitempicture.h:49
qgssvgcache.h
QgsLayoutItemPicture::pictureRotationChanged
void pictureRotationChanged(double newRotation)
Emitted on picture rotation change.
QgsLayoutPictureWidget::setNewItem
bool setNewItem(QgsLayoutItem *item) override
Attempts to update the widget to show the properties for the specified item.
Definition: qgslayoutpicturewidget.cpp:179
QgsLayoutItem::UndoPictureStrokeColor
@ UndoPictureStrokeColor
Picture stroke color.
Definition: qgslayoutitem.h:244
QgsLayoutItem::Middle
@ Middle
Center of item.
Definition: qgslayoutitem.h:207
QgsLayoutItem::MiddleRight
@ MiddleRight
Middle right of item.
Definition: qgslayoutitem.h:208
QgsSvgSelectorWidget::svgParametersChanged
void svgParametersChanged(const QMap< QString, QgsProperty > &parameters)
Emitted when the parameters have changed.
QgsLayoutItem::UndoPictureStrokeWidth
@ UndoPictureStrokeWidth
Picture stroke width.
Definition: qgslayoutitem.h:245
QgsLayoutItem::MiddleLeft
@ MiddleLeft
Middle left of item.
Definition: qgslayoutitem.h:206
QgsLayoutItemBaseWidget::registerDataDefinedButton
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty property)
Registers a data defined button, setting up its initial value, connections and description.
Definition: qgslayoutitemwidget.cpp:246
QgsLayoutItemPicture::NorthMode
NorthMode
Method for syncing rotation to a map's North direction.
Definition: qgslayoutitempicture.h:63
QgsLayoutItemPicture::GridNorth
@ GridNorth
Align to grid north.
Definition: qgslayoutitempicture.h:65
QgsLayoutItem::UndoPictureNorthOffset
@ UndoPictureNorthOffset
Picture north offset.
Definition: qgslayoutitem.h:246
QgsLayoutPictureWidget::setMasterLayout
void setMasterLayout(QgsMasterLayoutInterface *masterLayout) override
Sets the master layout associated with the item.
Definition: qgslayoutpicturewidget.cpp:124
qgslayoutpicturewidget.h
QgsLayoutPictureWidget::populateDataDefinedButtons
void populateDataDefinedButtons()
Initializes data defined buttons to current atlas coverage layer.
Definition: qgslayoutpicturewidget.cpp:495
QgsLayoutObject::changed
void changed()
Emitted when the object's properties change.
QgsLayoutObject::PictureSvgStrokeColor
@ PictureSvgStrokeColor
SVG stroke color.
Definition: qgslayoutobject.h:188
QgsLayoutItem::ReferencePoint
ReferencePoint
Fixed position reference point.
Definition: qgslayoutitem.h:201
QgsLayoutItemPropertiesWidget
A widget for controlling the common properties of layout items (e.g. position and size,...
Definition: qgslayoutitemwidget.h:217
QgsSvgCache::containsParams
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasStrokeParam, QColor &defaultStrokeColor, bool &hasStrokeWidthParam, double &defaultStrokeWidth, bool blocking=false) const
Tests if an SVG file contains parameters for fill, stroke color, stroke width.
Definition: qgssvgcache.cpp:228
QgsLayoutObject::PictureSvgStrokeWidth
@ PictureSvgStrokeWidth
SVG stroke width.
Definition: qgslayoutobject.h:189
QgsLayoutItemBaseWidget::coverageLayer
QgsVectorLayer * coverageLayer() const
Returns the current layout context coverage layer (if set).
Definition: qgslayoutitemwidget.cpp:256
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
QgsLayoutItemPropertiesWidget::setMasterLayout
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
Definition: qgslayoutitemwidget.cpp:420
QgsLayoutItem::type
int type() const override
Returns a unique graphics item type identifier.
Definition: qgslayoutitem.cpp:124
qgsapplication.h
QgsLayoutItemPicture::Stretch
@ Stretch
Stretches image to fit frame, ignores aspect ratio.
Definition: qgslayoutitempicture.h:46
QgsPictureSourceLineEditBase::Svg
@ Svg
SVG image.
Definition: qgsfilecontentsourcelineedit.h:200
QgsPictureSourceLineEditBase::Image
@ Image
Raster image.
Definition: qgsfilecontentsourcelineedit.h:201
QgsLayoutItemPicture::ZoomResizeFrame
@ ZoomResizeFrame
Enlarges image to fit frame, then resizes frame to fit resultant image.
Definition: qgslayoutitempicture.h:48
QgsLayoutItemPicture::Format
Format
Format of source image.
Definition: qgslayoutitempicture.h:55
QgsLayoutItemPicture::FormatUnknown
@ FormatUnknown
Invalid or unknown image type.
Definition: qgslayoutitempicture.h:59
QgsLayoutItemPicture::Clip
@ Clip
Draws image at original size and clips any portion which falls outside frame.
Definition: qgslayoutitempicture.h:47
QgsLayoutItemPicture::ResizeMode
ResizeMode
Controls how pictures are scaled within the item's frame.
Definition: qgslayoutitempicture.h:43
QgsLayoutItem
Base class for graphical items within a QgsLayout.
Definition: qgslayoutitem.h:112
QgsLayoutPictureWidget::QgsLayoutPictureWidget
QgsLayoutPictureWidget(QgsLayoutItemPicture *picture)
constructor
Definition: qgslayoutpicturewidget.cpp:38
QgsLayoutItemPicture::FormatSVG
@ FormatSVG
SVG image.
Definition: qgslayoutitempicture.h:57
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
qgslayout.h
QgsApplication::svgCache
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
Definition: qgsapplication.cpp:2360
QgsLayoutItemBaseWidget
A base class for property widgets for layout items. All layout item widgets should inherit from this ...
Definition: qgslayoutitemwidget.h:122
QgsLayoutItem::LowerRight
@ LowerRight
Lower right corner of item.
Definition: qgslayoutitem.h:211
QgsLayoutItem::LowerLeft
@ LowerLeft
Lower left corner of item.
Definition: qgslayoutitem.h:209
QgsLayoutItemPicture
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
Definition: qgslayoutitempicture.h:35
qgsfilecontentsourcelineedit.h
QgsLayoutItemMap
Layout graphical items for displaying a map.
Definition: qgslayoutitemmap.h:317
QgsLayoutItemPicture::Zoom
@ Zoom
Enlarges image to fit frame while maintaining aspect ratio of picture.
Definition: qgslayoutitempicture.h:45
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
QgsSvgSelectorWidget::svgSelected
void svgSelected(const QString &path)
QgsLayoutItem::UndoPictureRotation
@ UndoPictureRotation
Picture rotation.
Definition: qgslayoutitem.h:242
QgsLayoutItemRegistry::LayoutPicture
@ LayoutPicture
Picture item.
Definition: qgslayoutitemregistry.h:348
qgssettings.h
QgsLayoutItem::UpperRight
@ UpperRight
Upper right corner of item.
Definition: qgslayoutitem.h:205
QgsLayoutItemRegistry::LayoutMap
@ LayoutMap
Map item.
Definition: qgslayoutitemregistry.h:347
qgslayoutitempicture.h
QgsLayoutItemComboBox::itemChanged
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
QgsLayoutItem::UpperMiddle
@ UpperMiddle
Upper center of item.
Definition: qgslayoutitem.h:204
QgsLayoutItemPicture::TrueNorth
@ TrueNorth
Align to true north.
Definition: qgslayoutitempicture.h:66
QgsMasterLayoutInterface
Interface for master layout type objects, such as print layouts and reports.
Definition: qgsmasterlayoutinterface.h:42
QgsLayoutItemPicture::FormatRaster
@ FormatRaster
Raster image.
Definition: qgslayoutitempicture.h:58
QgsLayoutItemPropertiesWidget::setItem
void setItem(QgsLayoutItem *item)
Sets the layout item.
Definition: qgslayoutitemwidget.cpp:401
qgssvgselectorwidget.h
QgsLayoutItem::UpperLeft
@ UpperLeft
Upper left corner of item.
Definition: qgslayoutitem.h:203
QgsLayoutItemBaseWidget::layoutObject
QgsLayoutObject * layoutObject()
Returns the layout object associated with this widget.
Definition: qgslayoutitemwidget.cpp:196
QgsLayoutObject::PictureSvgBackgroundColor
@ PictureSvgBackgroundColor
SVG background color.
Definition: qgslayoutobject.h:187
QgsLayoutObject::PictureSource
@ PictureSource
Picture source url.
Definition: qgslayoutobject.h:186
qgslayoutitemmap.h
QgsLayoutItem::LowerMiddle
@ LowerMiddle
Lower center of item.
Definition: qgslayoutitem.h:210
qgsexpressionbuilderdialog.h
QgsLayoutItem::UndoPictureFillColor
@ UndoPictureFillColor
Picture fill color.
Definition: qgslayoutitem.h:243