33#include <QButtonGroup>
36#include "moc_qgslayoutitemwidget.cpp"
38using namespace Qt::StringLiterals;
46 , mLayoutObject( layoutObject )
48 if ( mLayoutObject->layout() )
50 connect( &mLayoutObject->layout()->reportContext(), &QgsLayoutReportContext::layerChanged, this, [this] { updateDataDefinedButtons(); } );
58void QgsLayoutConfigObject::updateDataDefinedProperty()
61 QgsPropertyOverrideButton *ddButton = qobject_cast<QgsPropertyOverrideButton *>( sender() );
78 auto undoLayoutObject =
dynamic_cast<QgsLayoutUndoObjectInterface *
>( mLayoutObject.data() );
79 if ( undoLayoutObject )
80 mLayoutObject->layout()->undoStack()->beginCommand( undoLayoutObject, tr(
"Change Data Defined Property" ) );
83 if ( propertyAssociatesWithMultiFrame )
85 if ( QgsLayoutFrame *frame =
dynamic_cast<QgsLayoutFrame *
>( mLayoutObject.data() ) )
87 if ( QgsLayoutMultiFrame *multiFrame = frame->multiFrame() )
89 multiFrame->dataDefinedProperties().setProperty( key, ddButton->
toProperty() );
90 multiFrame->refresh();
93 else if ( QgsLayoutMultiFrame *multiFrame =
dynamic_cast<QgsLayoutMultiFrame *
>( mLayoutObject.data() ) )
95 multiFrame->dataDefinedProperties().setProperty( key, ddButton->
toProperty() );
96 multiFrame->refresh();
99 else if ( mLayoutObject )
101 mLayoutObject->dataDefinedProperties().setProperty( key, ddButton->
toProperty() );
102 mLayoutObject->refresh();
105 if ( undoLayoutObject )
106 mLayoutObject->layout()->undoStack()->endCommand();
109void QgsLayoutConfigObject::updateDataDefinedButtons()
111 const QList<QgsPropertyOverrideButton *> buttons = findChildren<QgsPropertyOverrideButton *>();
112 for ( QgsPropertyOverrideButton *button : buttons )
120 button->blockSignals(
true );
124 button->blockSignals(
false );
139 if ( propertyAssociatesWithMultiFrame )
145 whileBlocking( button )->setToProperty( multiFrame->dataDefinedProperties().property( key ) );
150 whileBlocking( button )->setToProperty( multiFrame->dataDefinedProperties().property( key ) );
153 else if ( mLayoutObject )
155 whileBlocking( button )->setToProperty( mLayoutObject->dataDefinedProperties().property( key ) );
165 if ( !mLayoutObject )
170 QgsPrintLayout *printLayout = qobject_cast<QgsPrintLayout *>( mLayoutObject->layout() );
177 return printLayout->
atlas();
182 mLayoutObject = object;
187 if ( !mLayoutObject )
190 QgsLayout *layout = mLayoutObject->layout();
222 oldConfigObject->deleteLater();
229 mConfigObject->deleteLater();
230 mConfigObject = oldConfigObject;
240 const auto symbolButtonWidgets = findChildren<QgsSymbolButton *>();
243 symbolWidget->setMessageBar( iface->
messageBar() );
245 const auto fontButtonWidgets = findChildren<QgsFontButton *>();
248 fontButton->setMessageBar( iface->
messageBar() );
257 mConfigObject->initializeDataDefinedButton( button, property );
262 mConfigObject->updateDataDefinedButton( button );
267 return mConfigObject->coverageLayer();
277 return mConfigObject->layoutAtlas();
290 mBlockVariableUpdates =
true;
292 mVariableEditor->setContext( &context );
297 const int multiFrameScopeIndex = context.
indexOfScope( tr(
"Multiframe Item" ) );
298 const int itemScopeIndex = context.
indexOfScope( tr(
"Layout Item" ) );
299 if ( multiFrameScopeIndex >= 0 )
300 mVariableEditor->setEditableScopeIndex( multiFrameScopeIndex );
301 else if ( itemScopeIndex >= 0 )
302 mVariableEditor->setEditableScopeIndex( itemScopeIndex );
303 mBlockVariableUpdates =
false;
312 mVariableEditor->setMinimumHeight( mVariableEditor->fontMetrics().height() * 15 );
314 mItemRotationSpinBox->setClearValue( 0 );
315 mStrokeUnitsComboBox->linkToWidget( mStrokeWidthSpinBox );
320 exportGroupLineEdit->setPlaceholderText( tr(
"Not set" ) );
321 mExportGroupNameCombo->setLineEdit( exportGroupLineEdit );
323 mPosUnitsComboBox->linkToWidget( mXPosSpin );
324 mPosUnitsComboBox->linkToWidget( mYPosSpin );
325 mSizeUnitsComboBox->linkToWidget( mWidthSpin );
326 mSizeUnitsComboBox->linkToWidget( mHeightSpin );
331 mPosLockAspectRatio->setWidthSpinBox( mXPosSpin );
332 mPosLockAspectRatio->setHeightSpinBox( mYPosSpin );
333 mSizeLockAspectRatio->setWidthSpinBox( mWidthSpin );
334 mSizeLockAspectRatio->setHeightSpinBox( mHeightSpin );
336 mItemFrameColorDDBtn->registerLinkedWidget( mFrameColorButton );
337 mItemBackgroundColorDDBtn->registerLinkedWidget( mBackgroundColorButton );
340 connect( mBackgroundColorButton, &
QgsColorButton::colorChanged,
this, &QgsLayoutItemPropertiesWidget::mBackgroundColorButton_colorChanged );
341 connect( mStrokeWidthSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mStrokeWidthSpinBox_valueChanged );
343 connect( mFrameGroupBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutItemPropertiesWidget::mFrameGroupBox_toggled );
344 connect( mFrameJoinStyleCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutItemPropertiesWidget::mFrameJoinStyleCombo_currentIndexChanged );
345 connect( mBackgroundGroupBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutItemPropertiesWidget::mBackgroundGroupBox_toggled );
346 connect( mItemIdLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutItemPropertiesWidget::mItemIdLineEdit_editingFinished );
347 connect( mExportGroupNameCombo, &QComboBox::currentTextChanged,
this, &QgsLayoutItemPropertiesWidget::exportGroupNameEditingFinished );
348 connect( mPageSpinBox,
static_cast<void ( QSpinBox::* )(
int )
>( &QSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mPageSpinBox_valueChanged );
349 connect( mXPosSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mXPosSpin_valueChanged );
350 connect( mYPosSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mYPosSpin_valueChanged );
352 connect( mWidthSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mWidthSpin_valueChanged );
353 connect( mHeightSpin,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mHeightSpin_valueChanged );
355 connect( mUpperLeftRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mUpperLeftCheckBox_stateChanged );
356 connect( mUpperMiddleRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mUpperMiddleCheckBox_stateChanged );
357 connect( mUpperRightRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mUpperRightCheckBox_stateChanged );
358 connect( mMiddleLeftRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mMiddleLeftCheckBox_stateChanged );
359 connect( mMiddleRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mMiddleCheckBox_stateChanged );
360 connect( mMiddleRightRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mMiddleRightCheckBox_stateChanged );
361 connect( mLowerLeftRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mLowerLeftCheckBox_stateChanged );
362 connect( mLowerMiddleRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mLowerMiddleCheckBox_stateChanged );
363 connect( mLowerRightRadioButton, &QRadioButton::toggled,
this, &QgsLayoutItemPropertiesWidget::mLowerRightCheckBox_stateChanged );
364 connect( mBlendModeCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutItemPropertiesWidget::mBlendModeCombo_currentIndexChanged );
365 connect( mItemRotationSpinBox,
static_cast<void ( QDoubleSpinBox::* )(
double )
>( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutItemPropertiesWidget::mItemRotationSpinBox_valueChanged );
366 connect( mExcludeFromPrintsCheckBox, &QCheckBox::toggled,
this, &QgsLayoutItemPropertiesWidget::mExcludeFromPrintsCheckBox_toggled );
369 QButtonGroup *buttonGroup =
new QButtonGroup(
this );
370 buttonGroup->addButton( mUpperLeftRadioButton );
371 buttonGroup->addButton( mUpperMiddleRadioButton );
372 buttonGroup->addButton( mUpperRightRadioButton );
373 buttonGroup->addButton( mMiddleLeftRadioButton );
374 buttonGroup->addButton( mMiddleRadioButton );
375 buttonGroup->addButton( mMiddleRightRadioButton );
376 buttonGroup->addButton( mLowerLeftRadioButton );
377 buttonGroup->addButton( mLowerMiddleRadioButton );
378 buttonGroup->addButton( mLowerRightRadioButton );
379 buttonGroup->setExclusive(
true );
389 if ( !mBlockVariableUpdates )
390 QgsLayoutItemPropertiesWidget::variablesChanged();
407 mBackgroundGroupBox->setVisible( showGroup );
412 mFrameGroupBox->setVisible( showGroup );
420 disconnect( mItem, &
QgsLayoutObject::changed,
this, &QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements );
426 connect( mItem, &
QgsLayoutObject::changed,
this, &QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements );
429 mConfigObject->setObject( mItem );
431 setValuesForGuiElements();
445void QgsLayoutItemPropertiesWidget::mFrameColorButton_colorChanged(
const QColor &newFrameColor )
452 mItem->setFrameStrokeColor( newFrameColor );
453 mItem->layout()->undoStack()->endCommand();
457void QgsLayoutItemPropertiesWidget::mBackgroundColorButton_colorChanged(
const QColor &newBackgroundColor )
464 mItem->setBackgroundColor( newBackgroundColor );
465 mItem->layout()->undoStack()->endCommand();
466 mItem->invalidateCache();
469void QgsLayoutItemPropertiesWidget::changeItemPosition()
476 const QgsLayoutPoint point( mXPosSpin->value(), mYPosSpin->value(), mPosUnitsComboBox->unit() );
477 mItem->attemptMove( point,
true,
false, mPageSpinBox->value() - 1 );
479 mItem->layout()->undoStack()->endCommand();
487 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Item Reference" ) );
488 mItem->setReferencePoint( point );
489 mItem->layout()->undoStack()->endCommand();
492void QgsLayoutItemPropertiesWidget::changeItemSize()
499 const QgsLayoutSize size( mWidthSpin->value(), mHeightSpin->value(), mSizeUnitsComboBox->unit() );
500 mItem->attemptResize( size );
502 mItem->layout()->undoStack()->endCommand();
505void QgsLayoutItemPropertiesWidget::variablesChanged()
510 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Item Variables" ) );
512 if ( QgsLayoutFrame *frame = qobject_cast<QgsLayoutFrame *>( mItem ) )
514 if ( QgsLayoutMultiFrame *mf = frame->multiFrame() )
523 mItem->layout()->undoStack()->endCommand();
528 if ( mUpperLeftRadioButton->isChecked() )
532 else if ( mUpperMiddleRadioButton->isChecked() )
536 else if ( mUpperRightRadioButton->isChecked() )
540 else if ( mMiddleLeftRadioButton->isChecked() )
544 else if ( mMiddleRadioButton->isChecked() )
548 else if ( mMiddleRightRadioButton->isChecked() )
552 else if ( mLowerLeftRadioButton->isChecked() )
556 else if ( mLowerMiddleRadioButton->isChecked() )
560 else if ( mLowerRightRadioButton->isChecked() )
567void QgsLayoutItemPropertiesWidget::mStrokeWidthSpinBox_valueChanged(
double d )
575 mItem->setFrameStrokeWidth( QgsLayoutMeasurement( d, mStrokeUnitsComboBox->unit() ) );
576 mItem->layout()->undoStack()->endCommand();
579void QgsLayoutItemPropertiesWidget::strokeUnitChanged(
Qgis::LayoutUnit unit )
587 mItem->setFrameStrokeWidth( QgsLayoutMeasurement( mStrokeWidthSpinBox->value(), unit ) );
588 mItem->layout()->undoStack()->endCommand();
591void QgsLayoutItemPropertiesWidget::mFrameJoinStyleCombo_currentIndexChanged(
int index )
599 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Frame Join Style" ) );
600 mItem->setFrameJoinStyle( mFrameJoinStyleCombo->penJoinStyle() );
601 mItem->layout()->undoStack()->endCommand();
604void QgsLayoutItemPropertiesWidget::mFrameGroupBox_toggled(
bool state )
611 mItem->layout()->undoStack()->beginCommand( mItem, state ? tr(
"Enable Frame" ) : tr(
"Disable Frame" ) );
612 mItem->setFrameEnabled( state );
614 mItem->layout()->undoStack()->endCommand();
617void QgsLayoutItemPropertiesWidget::mBackgroundGroupBox_toggled(
bool state )
624 mItem->layout()->undoStack()->beginCommand( mItem, state ? tr(
"Enable Background" ) : tr(
"Disable Background" ) );
625 mItem->setBackgroundEnabled( state );
626 mItem->layout()->undoStack()->endCommand();
627 mItem->invalidateCache();
631void QgsLayoutItemPropertiesWidget::setValuesForGuiPositionElements()
638 auto block = [
this](
bool blocked ) {
639 mXPosSpin->blockSignals( blocked );
640 mYPosSpin->blockSignals( blocked );
641 mPosUnitsComboBox->blockSignals( blocked );
642 mWidthSpin->blockSignals( blocked );
643 mHeightSpin->blockSignals( blocked );
644 mSizeUnitsComboBox->blockSignals( blocked );
645 mUpperLeftRadioButton->blockSignals( blocked );
646 mUpperMiddleRadioButton->blockSignals( blocked );
647 mUpperRightRadioButton->blockSignals( blocked );
648 mMiddleLeftRadioButton->blockSignals( blocked );
649 mMiddleRadioButton->blockSignals( blocked );
650 mMiddleRightRadioButton->blockSignals( blocked );
651 mLowerLeftRadioButton->blockSignals( blocked );
652 mLowerMiddleRadioButton->blockSignals( blocked );
653 mLowerRightRadioButton->blockSignals( blocked );
654 mPageSpinBox->blockSignals( blocked );
658 const QgsLayoutPoint point = mItem->pagePositionWithUnits();
660 if ( !mFreezeXPosSpin )
661 mXPosSpin->setValue( point.
x() );
662 if ( !mFreezeYPosSpin )
663 mYPosSpin->setValue( point.
y() );
664 mPosUnitsComboBox->setUnit( point.
units() );
666 switch ( mItem->referencePoint() )
670 mUpperLeftRadioButton->setChecked(
true );
676 mUpperMiddleRadioButton->setChecked(
true );
682 mUpperRightRadioButton->setChecked(
true );
688 mMiddleLeftRadioButton->setChecked(
true );
694 mMiddleRadioButton->setChecked(
true );
700 mMiddleRightRadioButton->setChecked(
true );
706 mLowerLeftRadioButton->setChecked(
true );
712 mLowerMiddleRadioButton->setChecked(
true );
718 mLowerRightRadioButton->setChecked(
true );
723 const QgsLayoutSize size = mItem->sizeWithUnits();
724 if ( !mFreezeWidthSpin )
725 mWidthSpin->setValue( size.
width() );
726 if ( !mFreezeHeightSpin )
727 mHeightSpin->setValue( size.
height() );
729 mSizeUnitsComboBox->setUnit( size.
units() );
731 mSizeLockAspectRatio->resetRatio();
732 mPosLockAspectRatio->resetRatio();
734 if ( !mFreezePageSpin )
735 mPageSpinBox->setValue( mItem->page() + 1 );
740void QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements()
747 whileBlocking( mBackgroundColorButton )->setColor( mItem->backgroundColor(
false ) );
748 whileBlocking( mFrameColorButton )->setColor( mItem->frameStrokeColor() );
749 whileBlocking( mStrokeUnitsComboBox )->setUnit( mItem->frameStrokeWidth().units() );
750 whileBlocking( mStrokeWidthSpinBox )->setValue( mItem->frameStrokeWidth().length() );
751 whileBlocking( mFrameJoinStyleCombo )->setPenJoinStyle( mItem->frameJoinStyle() );
753 whileBlocking( mFrameGroupBox )->setChecked( mItem->frameEnabled() );
754 whileBlocking( mBackgroundGroupBox )->setChecked( mItem->hasBackground() );
755 whileBlocking( mBlendModeCombo )->setBlendMode( mItem->blendMode() );
756 whileBlocking( mOpacityWidget )->setOpacity( mItem->itemOpacity() );
757 whileBlocking( mItemRotationSpinBox )->setValue( mItem->itemRotation() );
758 whileBlocking( mExcludeFromPrintsCheckBox )->setChecked( mItem->excludeFromExports() );
759 whileBlocking( mExportGroupNameCombo )->setCurrentText( mItem->customProperty( u
"pdfExportGroup"_s ).toString() );
778 const QList<QgsPropertyOverrideButton *> buttons = findChildren<QgsPropertyOverrideButton *>();
781 mConfigObject->updateDataDefinedButton( button );
785void QgsLayoutItemPropertiesWidget::setValuesForGuiElements()
792 mBackgroundColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
793 mBackgroundColorButton->setAllowOpacity(
true );
794 mBackgroundColorButton->setContext( u
"composer"_s );
795 mFrameColorButton->setColorDialogTitle( tr(
"Select Frame Color" ) );
796 mFrameColorButton->setAllowOpacity(
true );
797 mFrameColorButton->setContext( u
"composer"_s );
799 if ( QgsLayout *layout = mItem->layout() )
802 QList<QgsLayoutItem *> items;
803 layout->layoutItems( items );
804 QStringList existingGroups;
805 for (
const QgsLayoutItem *item : std::as_const( items ) )
807 const QString groupName = item->customProperty( u
"pdfExportGroup"_s ).toString();
808 if ( !groupName.isEmpty() && !existingGroups.contains( groupName ) )
809 existingGroups.append( groupName );
812 std::sort( existingGroups.begin(), existingGroups.end(), [](
const QString &a,
const QString &b ) ->
bool { return a.localeAwareCompare( b ) < 0; } );
815 whileBlocking( mExportGroupNameCombo )->addItems( existingGroups );
818 setValuesForGuiPositionElements();
819 setValuesForGuiNonPositionElements();
825void QgsLayoutItemPropertiesWidget::mBlendModeCombo_currentIndexChanged(
int index )
830 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Blend Mode" ) );
831 mItem->setBlendMode( mBlendModeCombo->blendMode() );
832 mItem->layout()->undoStack()->endCommand();
836void QgsLayoutItemPropertiesWidget::opacityChanged(
double value )
841 mItem->setItemOpacity( value );
842 mItem->layout()->undoStack()->endCommand();
846void QgsLayoutItemPropertiesWidget::mItemIdLineEdit_editingFinished()
851 mItem->setId( mItemIdLineEdit->text() );
852 mItemIdLineEdit->setText( mItem->id() );
853 mItem->layout()->undoStack()->endCommand();
857void QgsLayoutItemPropertiesWidget::exportGroupNameEditingFinished()
862 mItem->setCustomProperty( u
"pdfExportGroup"_s, mExportGroupNameCombo->currentText() );
863 mItem->layout()->undoStack()->endCommand();
867void QgsLayoutItemPropertiesWidget::mPageSpinBox_valueChanged(
int )
869 mFreezePageSpin =
true;
870 changeItemPosition();
871 mFreezePageSpin =
false;
874void QgsLayoutItemPropertiesWidget::mXPosSpin_valueChanged(
double )
876 mFreezeXPosSpin =
true;
877 changeItemPosition();
878 mFreezeXPosSpin =
false;
881void QgsLayoutItemPropertiesWidget::mYPosSpin_valueChanged(
double )
883 mFreezeYPosSpin =
true;
884 changeItemPosition();
885 mFreezeYPosSpin =
false;
890 changeItemPosition();
893void QgsLayoutItemPropertiesWidget::mWidthSpin_valueChanged(
double )
895 mFreezeWidthSpin =
true;
897 mFreezeWidthSpin =
false;
900void QgsLayoutItemPropertiesWidget::mHeightSpin_valueChanged(
double )
902 mFreezeHeightSpin =
true;
904 mFreezeHeightSpin =
false;
912void QgsLayoutItemPropertiesWidget::mUpperLeftCheckBox_stateChanged(
bool state )
921 setValuesForGuiPositionElements();
924void QgsLayoutItemPropertiesWidget::mUpperMiddleCheckBox_stateChanged(
bool state )
932 setValuesForGuiPositionElements();
935void QgsLayoutItemPropertiesWidget::mUpperRightCheckBox_stateChanged(
bool state )
943 setValuesForGuiPositionElements();
946void QgsLayoutItemPropertiesWidget::mMiddleLeftCheckBox_stateChanged(
bool state )
954 setValuesForGuiPositionElements();
957void QgsLayoutItemPropertiesWidget::mMiddleCheckBox_stateChanged(
bool state )
965 setValuesForGuiPositionElements();
968void QgsLayoutItemPropertiesWidget::mMiddleRightCheckBox_stateChanged(
bool state )
976 setValuesForGuiPositionElements();
979void QgsLayoutItemPropertiesWidget::mLowerLeftCheckBox_stateChanged(
bool state )
987 setValuesForGuiPositionElements();
990void QgsLayoutItemPropertiesWidget::mLowerMiddleCheckBox_stateChanged(
bool state )
998 setValuesForGuiPositionElements();
1001void QgsLayoutItemPropertiesWidget::mLowerRightCheckBox_stateChanged(
bool state )
1009 setValuesForGuiPositionElements();
1012void QgsLayoutItemPropertiesWidget::mItemRotationSpinBox_valueChanged(
double val )
1017 mItem->setItemRotation( val,
true );
1019 mItem->layout()->undoStack()->endCommand();
1023void QgsLayoutItemPropertiesWidget::mExcludeFromPrintsCheckBox_toggled(
bool checked )
1027 mItem->layout()->undoStack()->beginCommand( mItem, checked ? tr(
"Exclude from Exports" ) : tr(
"Include in Exports" ) );
1028 mItem->setExcludeFromExports( checked );
1029 mItem->layout()->undoStack()->endCommand();
LayoutUnit
Layout measurement units.
void customVariablesChanged()
Emitted whenever a custom global variable changes.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
static void setLayoutItemVariables(QgsLayoutItem *item, const QVariantMap &variables)
Sets all layout item context variables for an item.
static void setLayoutMultiFrameVariables(QgsLayoutMultiFrame *frame, const QVariantMap &variables)
Sets all layout multiframe context variables for an frame.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
int indexOfScope(QgsExpressionContextScope *scope) const
Returns the index of the specified scope if it exists within the context.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
void setShowClearButton(bool visible)
Sets whether the widget's clear button is visible.
Used to render QgsLayout as an atlas, by iterating over the features from an associated vector layer.
void toggled(bool enabled)
Emitted when atlas is enabled or disabled.
void coverageLayerChanged(QgsVectorLayer *layer)
Emitted when the coverage layer for the atlas changes.
An object for property widgets for layout items.
QgsLayoutAtlas * layoutAtlas() const
Returns the atlas for the layout, if available.
void setObject(QgsLayoutObject *object) SIP_SKIP
Links a new layout object to this QgsLayoutConfigObject.
void initializeDataDefinedButton(QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty key)
Registers a data defined button, setting up its initial value, connections and description.
QgsVectorLayer * coverageLayer() const
Returns the current layout context coverage layer (if set).
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Updates a data defined button to reflect the item's current properties.
QgsLayoutConfigObject(QWidget *parent SIP_TRANSFERTHIS, QgsLayoutObject *layoutObject)
Constructor for QgsLayoutConfigObject, linked with the specified layoutObject.
A common interface for layout designer dialogs and widgets.
virtual QgsMessageBar * messageBar()=0
Returns the designer's message bar.
Base class for frame items, which form a layout multiframe item.
Base class for graphical items within a QgsLayout.
@ UndoIncrementalMove
Layout item incremental movement, e.g. as a result of a keypress.
@ UndoBackgroundColor
Background color adjustment.
@ UndoOpacity
Opacity adjustment.
@ UndoIncrementalResize
Incremental resize.
@ UndoRotation
Rotation adjustment.
@ UndoStrokeWidth
Stroke width adjustment.
@ UndoExportLayerName
Export layer name.
@ UndoSetId
Change item ID.
@ UndoStrokeColor
Stroke color adjustment.
ReferencePoint
Fixed position reference point.
@ LowerMiddle
Lower center of item.
@ MiddleLeft
Middle left of item.
@ UpperRight
Upper right corner of item.
@ LowerLeft
Lower left corner of item.
@ UpperLeft
Upper left corner of item.
@ UpperMiddle
Upper center of item.
@ MiddleRight
Middle right of item.
@ LowerRight
Lower right corner of item.
void sizePositionChanged()
Emitted when the item's size or position changes.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
A base class for objects which belong to a layout.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the layout object property definitions.
const QgsLayout * layout() const
Returns the layout the object is attached to.
void changed()
Emitted when the object's properties change.
DataDefinedProperty
Data defined properties for different item types.
@ PositionX
X position on page.
@ ItemWidth
Width of item.
@ ExcludeFromExports
Exclude item from exports.
@ ItemRotation
Rotation of item.
@ PositionY
Y position on page.
@ ItemHeight
Height of item.
@ BackgroundColor
Item background color.
@ BlendMode
Item blend mode.
@ FrameColor
Item frame color.
static bool propertyAssociatesWithParentMultiframe(DataDefinedProperty property)
Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame...
void changed()
Emitted when pages are added or removed from the collection.
double x() const
Returns x coordinate of point.
double y() const
Returns y coordinate of point.
Qgis::LayoutUnit units() const
Returns the units for the point.
void dpiChanged()
Emitted when the context's DPI is changed.
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in the layout.
QgsVectorLayer * layer() const
Returns the vector layer associated with the layout's context.
double height() const
Returns the height of the size.
Qgis::LayoutUnit units() const
Returns the units for the size.
double width() const
Returns the width of the size.
void unitChanged(Qgis::LayoutUnit unit)
Emitted when the unit is changed.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout.
void variablesChanged()
Emitted whenever the expression variables stored in the layout have been changed.
QgsLayoutReportContext & reportContext()
Returns a reference to the layout's report context, which stores information relating to the current ...
QgsProject * project() const
The project associated with the layout.
Interface for master layout type objects, such as print layouts and reports.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
QgsLayoutAtlas * atlas()
Returns the print layout's atlas.
void nameChanged(const QString &name)
Emitted when the layout's name is changed.
void metadataChanged()
Emitted when the project's metadata is changed.
void customVariablesChanged()
Emitted whenever the expression variables stored in the project have been changed.
Represents a vector layer which manages a vector based dataset.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.