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 if ( QgsLayoutFrame *frame = qobject_cast<QgsLayoutFrame *>( mItem ) )
512 if ( QgsLayoutMultiFrame *mf = frame->multiFrame() )
525 if ( mUpperLeftRadioButton->isChecked() )
529 else if ( mUpperMiddleRadioButton->isChecked() )
533 else if ( mUpperRightRadioButton->isChecked() )
537 else if ( mMiddleLeftRadioButton->isChecked() )
541 else if ( mMiddleRadioButton->isChecked() )
545 else if ( mMiddleRightRadioButton->isChecked() )
549 else if ( mLowerLeftRadioButton->isChecked() )
553 else if ( mLowerMiddleRadioButton->isChecked() )
557 else if ( mLowerRightRadioButton->isChecked() )
564void QgsLayoutItemPropertiesWidget::mStrokeWidthSpinBox_valueChanged(
double d )
572 mItem->setFrameStrokeWidth( QgsLayoutMeasurement( d, mStrokeUnitsComboBox->unit() ) );
573 mItem->layout()->undoStack()->endCommand();
576void QgsLayoutItemPropertiesWidget::strokeUnitChanged(
Qgis::LayoutUnit unit )
584 mItem->setFrameStrokeWidth( QgsLayoutMeasurement( mStrokeWidthSpinBox->value(), unit ) );
585 mItem->layout()->undoStack()->endCommand();
588void QgsLayoutItemPropertiesWidget::mFrameJoinStyleCombo_currentIndexChanged(
int index )
596 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Frame Join Style" ) );
597 mItem->setFrameJoinStyle( mFrameJoinStyleCombo->penJoinStyle() );
598 mItem->layout()->undoStack()->endCommand();
601void QgsLayoutItemPropertiesWidget::mFrameGroupBox_toggled(
bool state )
608 mItem->layout()->undoStack()->beginCommand( mItem, state ? tr(
"Enable Frame" ) : tr(
"Disable Frame" ) );
609 mItem->setFrameEnabled( state );
611 mItem->layout()->undoStack()->endCommand();
614void QgsLayoutItemPropertiesWidget::mBackgroundGroupBox_toggled(
bool state )
621 mItem->layout()->undoStack()->beginCommand( mItem, state ? tr(
"Enable Background" ) : tr(
"Disable Background" ) );
622 mItem->setBackgroundEnabled( state );
623 mItem->layout()->undoStack()->endCommand();
624 mItem->invalidateCache();
628void QgsLayoutItemPropertiesWidget::setValuesForGuiPositionElements()
635 auto block = [
this](
bool blocked ) {
636 mXPosSpin->blockSignals( blocked );
637 mYPosSpin->blockSignals( blocked );
638 mPosUnitsComboBox->blockSignals( blocked );
639 mWidthSpin->blockSignals( blocked );
640 mHeightSpin->blockSignals( blocked );
641 mSizeUnitsComboBox->blockSignals( blocked );
642 mUpperLeftRadioButton->blockSignals( blocked );
643 mUpperMiddleRadioButton->blockSignals( blocked );
644 mUpperRightRadioButton->blockSignals( blocked );
645 mMiddleLeftRadioButton->blockSignals( blocked );
646 mMiddleRadioButton->blockSignals( blocked );
647 mMiddleRightRadioButton->blockSignals( blocked );
648 mLowerLeftRadioButton->blockSignals( blocked );
649 mLowerMiddleRadioButton->blockSignals( blocked );
650 mLowerRightRadioButton->blockSignals( blocked );
651 mPageSpinBox->blockSignals( blocked );
655 const QgsLayoutPoint point = mItem->pagePositionWithUnits();
657 if ( !mFreezeXPosSpin )
658 mXPosSpin->setValue( point.
x() );
659 if ( !mFreezeYPosSpin )
660 mYPosSpin->setValue( point.
y() );
661 mPosUnitsComboBox->setUnit( point.
units() );
663 switch ( mItem->referencePoint() )
667 mUpperLeftRadioButton->setChecked(
true );
673 mUpperMiddleRadioButton->setChecked(
true );
679 mUpperRightRadioButton->setChecked(
true );
685 mMiddleLeftRadioButton->setChecked(
true );
691 mMiddleRadioButton->setChecked(
true );
697 mMiddleRightRadioButton->setChecked(
true );
703 mLowerLeftRadioButton->setChecked(
true );
709 mLowerMiddleRadioButton->setChecked(
true );
715 mLowerRightRadioButton->setChecked(
true );
720 const QgsLayoutSize size = mItem->sizeWithUnits();
721 if ( !mFreezeWidthSpin )
722 mWidthSpin->setValue( size.
width() );
723 if ( !mFreezeHeightSpin )
724 mHeightSpin->setValue( size.
height() );
726 mSizeUnitsComboBox->setUnit( size.
units() );
728 mSizeLockAspectRatio->resetRatio();
729 mPosLockAspectRatio->resetRatio();
731 if ( !mFreezePageSpin )
732 mPageSpinBox->setValue( mItem->page() + 1 );
737void QgsLayoutItemPropertiesWidget::setValuesForGuiNonPositionElements()
744 whileBlocking( mBackgroundColorButton )->setColor( mItem->backgroundColor(
false ) );
745 whileBlocking( mFrameColorButton )->setColor( mItem->frameStrokeColor() );
746 whileBlocking( mStrokeUnitsComboBox )->setUnit( mItem->frameStrokeWidth().units() );
747 whileBlocking( mStrokeWidthSpinBox )->setValue( mItem->frameStrokeWidth().length() );
748 whileBlocking( mFrameJoinStyleCombo )->setPenJoinStyle( mItem->frameJoinStyle() );
750 whileBlocking( mFrameGroupBox )->setChecked( mItem->frameEnabled() );
751 whileBlocking( mBackgroundGroupBox )->setChecked( mItem->hasBackground() );
752 whileBlocking( mBlendModeCombo )->setBlendMode( mItem->blendMode() );
753 whileBlocking( mOpacityWidget )->setOpacity( mItem->itemOpacity() );
754 whileBlocking( mItemRotationSpinBox )->setValue( mItem->itemRotation() );
755 whileBlocking( mExcludeFromPrintsCheckBox )->setChecked( mItem->excludeFromExports() );
756 whileBlocking( mExportGroupNameCombo )->setCurrentText( mItem->customProperty( u
"pdfExportGroup"_s ).toString() );
775 const QList<QgsPropertyOverrideButton *> buttons = findChildren<QgsPropertyOverrideButton *>();
778 mConfigObject->updateDataDefinedButton( button );
782void QgsLayoutItemPropertiesWidget::setValuesForGuiElements()
789 mBackgroundColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
790 mBackgroundColorButton->setAllowOpacity(
true );
791 mBackgroundColorButton->setContext( u
"composer"_s );
792 mFrameColorButton->setColorDialogTitle( tr(
"Select Frame Color" ) );
793 mFrameColorButton->setAllowOpacity(
true );
794 mFrameColorButton->setContext( u
"composer"_s );
796 if ( QgsLayout *layout = mItem->layout() )
799 QList<QgsLayoutItem *> items;
800 layout->layoutItems( items );
801 QStringList existingGroups;
802 for (
const QgsLayoutItem *item : std::as_const( items ) )
804 const QString groupName = item->customProperty( u
"pdfExportGroup"_s ).toString();
805 if ( !groupName.isEmpty() && !existingGroups.contains( groupName ) )
806 existingGroups.append( groupName );
809 std::sort( existingGroups.begin(), existingGroups.end(), [](
const QString &a,
const QString &b ) ->
bool { return a.localeAwareCompare( b ) < 0; } );
812 whileBlocking( mExportGroupNameCombo )->addItems( existingGroups );
815 setValuesForGuiPositionElements();
816 setValuesForGuiNonPositionElements();
822void QgsLayoutItemPropertiesWidget::mBlendModeCombo_currentIndexChanged(
int index )
827 mItem->layout()->undoStack()->beginCommand( mItem, tr(
"Change Blend Mode" ) );
828 mItem->setBlendMode( mBlendModeCombo->blendMode() );
829 mItem->layout()->undoStack()->endCommand();
833void QgsLayoutItemPropertiesWidget::opacityChanged(
double value )
838 mItem->setItemOpacity( value );
839 mItem->layout()->undoStack()->endCommand();
843void QgsLayoutItemPropertiesWidget::mItemIdLineEdit_editingFinished()
848 mItem->setId( mItemIdLineEdit->text() );
849 mItemIdLineEdit->setText( mItem->id() );
850 mItem->layout()->undoStack()->endCommand();
854void QgsLayoutItemPropertiesWidget::exportGroupNameEditingFinished()
859 mItem->setCustomProperty( u
"pdfExportGroup"_s, mExportGroupNameCombo->currentText() );
860 mItem->layout()->undoStack()->endCommand();
864void QgsLayoutItemPropertiesWidget::mPageSpinBox_valueChanged(
int )
866 mFreezePageSpin =
true;
867 changeItemPosition();
868 mFreezePageSpin =
false;
871void QgsLayoutItemPropertiesWidget::mXPosSpin_valueChanged(
double )
873 mFreezeXPosSpin =
true;
874 changeItemPosition();
875 mFreezeXPosSpin =
false;
878void QgsLayoutItemPropertiesWidget::mYPosSpin_valueChanged(
double )
880 mFreezeYPosSpin =
true;
881 changeItemPosition();
882 mFreezeYPosSpin =
false;
887 changeItemPosition();
890void QgsLayoutItemPropertiesWidget::mWidthSpin_valueChanged(
double )
892 mFreezeWidthSpin =
true;
894 mFreezeWidthSpin =
false;
897void QgsLayoutItemPropertiesWidget::mHeightSpin_valueChanged(
double )
899 mFreezeHeightSpin =
true;
901 mFreezeHeightSpin =
false;
909void QgsLayoutItemPropertiesWidget::mUpperLeftCheckBox_stateChanged(
bool state )
918 setValuesForGuiPositionElements();
921void QgsLayoutItemPropertiesWidget::mUpperMiddleCheckBox_stateChanged(
bool state )
929 setValuesForGuiPositionElements();
932void QgsLayoutItemPropertiesWidget::mUpperRightCheckBox_stateChanged(
bool state )
940 setValuesForGuiPositionElements();
943void QgsLayoutItemPropertiesWidget::mMiddleLeftCheckBox_stateChanged(
bool state )
951 setValuesForGuiPositionElements();
954void QgsLayoutItemPropertiesWidget::mMiddleCheckBox_stateChanged(
bool state )
962 setValuesForGuiPositionElements();
965void QgsLayoutItemPropertiesWidget::mMiddleRightCheckBox_stateChanged(
bool state )
973 setValuesForGuiPositionElements();
976void QgsLayoutItemPropertiesWidget::mLowerLeftCheckBox_stateChanged(
bool state )
984 setValuesForGuiPositionElements();
987void QgsLayoutItemPropertiesWidget::mLowerMiddleCheckBox_stateChanged(
bool state )
995 setValuesForGuiPositionElements();
998void QgsLayoutItemPropertiesWidget::mLowerRightCheckBox_stateChanged(
bool state )
1006 setValuesForGuiPositionElements();
1009void QgsLayoutItemPropertiesWidget::mItemRotationSpinBox_valueChanged(
double val )
1014 mItem->setItemRotation( val,
true );
1016 mItem->layout()->undoStack()->endCommand();
1020void QgsLayoutItemPropertiesWidget::mExcludeFromPrintsCheckBox_toggled(
bool checked )
1024 mItem->layout()->undoStack()->beginCommand( mItem, checked ? tr(
"Exclude from Exports" ) : tr(
"Include in Exports" ) );
1025 mItem->setExcludeFromExports( checked );
1026 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.