40 connect( mRefreshPushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked );
41 connect( mAttributesPushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked );
42 connect( mMaximumRowsSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged );
43 connect( mMarginSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged );
44 connect( mGridStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged );
46 connect( mBackgroundColorButton, &
QgsColorButton::colorChanged,
this, &QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged );
47 connect( mDrawHorizontalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled );
48 connect( mDrawVerticalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled );
49 connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled );
50 connect( mShowOnlyVisibleFeaturesCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged );
51 connect( mFeatureFilterCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged );
52 connect( mFeatureFilterEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished );
53 connect( mFeatureFilterButton, &QToolButton::clicked,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked );
54 connect( mHeaderHAlignmentComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
55 connect( mHeaderModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged );
56 connect( mWrapStringLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished );
57 connect( mAddFramePushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked );
58 connect( mResizeModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged );
59 connect( mSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged );
60 connect( mRelationsComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged );
61 connect( mEmptyModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged );
62 connect( mDrawEmptyCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled );
63 connect( mEmptyMessageLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished );
64 connect( mIntersectAtlasCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged );
65 connect( mUniqueOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged );
66 connect( mEmptyFrameCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled );
67 connect( mHideEmptyBgCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled );
68 connect( mWrapBehaviorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
69 connect( mAdvancedCustomizationButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked );
70 connect( mUseConditionalStylingCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::useConditionalStylingChanged );
76 mContentFontToolButton->registerExpressionContextGenerator(
this );
77 mHeaderFontToolButton->registerExpressionContextGenerator(
this );
79 blockAllSignals(
true );
102 toggleAtlasSpecificControls(
static_cast< bool >(
coverageLayer() ) );
110 mComposerMapComboBox->setCurrentLayout( mTable->layout() );
114 mGridColorButton->setColorDialogTitle( tr(
"Select Grid Color" ) );
115 mGridColorButton->setAllowOpacity(
true );
116 mGridColorButton->setContext( QStringLiteral(
"composer" ) );
117 mGridColorButton->setDefaultColor( Qt::black );
118 mBackgroundColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
119 mBackgroundColorButton->setAllowOpacity(
true );
120 mBackgroundColorButton->setContext( QStringLiteral(
"composer" ) );
121 mBackgroundColorButton->setShowNoColor(
true );
122 mBackgroundColorButton->setNoColorString( tr(
"No Background" ) );
132 this, &QgsLayoutAttributeTableWidget::atlasToggled );
140 mLayerSourceDDBtn->registerExpressionContextGenerator( mTable );
150 mainLayout->addWidget( mItemPropertiesWidget );
153 connect( mHeaderFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::headerFontChanged );
154 connect( mContentFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::contentFontChanged );
159 mIntersectAtlasCheckBox->setText( tr(
"Show only features intersecting %1 feature" ).arg(
string ) );
161 if ( atlasFeatureIndex != -1 )
163 mSourceComboBox->setItemText( atlasFeatureIndex, tr(
"Current %1 Feature" ).arg(
string ) );
169 if ( mItemPropertiesWidget )
179 context = mFrame->createExpressionContext();
181 context = mTable->createExpressionContext();
183 std::unique_ptr< QgsExpressionContextScope > cellScope = qgis::make_unique< QgsExpressionContextScope >();
184 cellScope->setVariable( QStringLiteral(
"row_number" ), 1,
true );
185 cellScope->setVariable( QStringLiteral(
"column_number" ), 1,
true );
189 QStringLiteral(
"column_number" )} );
212 mTable = qobject_cast< QgsLayoutItemAttributeTable * >( multiFrame );
214 mItemPropertiesWidget->
setItem( frame );
227 void QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked()
234 mTable->refreshAttributes();
237 void QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked()
245 QVector<QgsLayoutTableColumn> currentColumns = mTable->columns();
246 QVector<QgsLayoutTableColumn> currentSortColumns = mTable->sortColumns();
248 mTable->beginCommand( tr(
"Change Table Attributes" ) );
251 window()->setUpdatesEnabled(
false );
254 if ( d.exec() == QDialog::Accepted )
256 mTable->refreshAttributes();
258 window()->setUpdatesEnabled(
true );
260 mTable->endCommand();
263 currentColumns.clear();
264 currentSortColumns.clear();
269 mTable->setColumns( currentColumns );
270 mTable->setSortColumns( currentSortColumns );
271 window()->setUpdatesEnabled(
true );
272 mTable->cancelCommand();
276 void QgsLayoutAttributeTableWidget::composerMapChanged(
QgsLayoutItem *item )
283 mTable->beginCommand( tr(
"Change Table Map" ) );
284 mTable->setMap( qobject_cast< QgsLayoutItemMap * >( item ) );
286 mTable->endCommand();
289 void QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged(
int i )
297 mTable->setMaximumNumberOfFeatures( i );
299 mTable->endCommand();
302 void QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged(
double d )
310 mTable->setCellMargin( d );
311 mTable->endCommand();
314 void QgsLayoutAttributeTableWidget::headerFontChanged()
319 mTable->beginCommand( tr(
"Change Table Text Format" ) );
320 mTable->setHeaderTextFormat( mHeaderFontToolButton->textFormat() );
321 mTable->endCommand();
324 void QgsLayoutAttributeTableWidget::contentFontChanged()
331 mTable->beginCommand( tr(
"Change Table Text Format" ) );
332 mTable->setContentTextFormat( mContentFontToolButton->textFormat() );
333 mTable->endCommand();
336 void QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged(
double d )
344 mTable->setGridStrokeWidth( d );
345 mTable->endCommand();
348 void QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged(
const QColor &newColor )
356 mTable->setGridColor( newColor );
357 mTable->endCommand();
360 void QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled(
bool state )
367 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
368 mTable->setHorizontalGrid( state );
369 mTable->endCommand();
372 void QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled(
bool state )
379 mTable->beginCommand( tr(
"Toggled Table Grid" ) );
380 mTable->setVerticalGrid( state );
381 mTable->endCommand();
384 void QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled(
bool state )
391 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
392 mTable->setShowGrid( state );
393 mTable->endCommand();
396 void QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged(
const QColor &newColor )
404 mTable->setBackgroundColor( newColor );
405 mTable->endCommand();
408 void QgsLayoutAttributeTableWidget::updateGuiElements()
410 if ( !mTable || !mFrame )
415 blockAllSignals(
true );
417 mSourceComboBox->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
418 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
421 if ( mTable->vectorLayer() )
423 mLayerComboBox->setLayer( mTable->vectorLayer() );
427 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
428 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
432 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
436 mComposerMapComboBox->setItem( mTable->map() );
437 mMaximumRowsSpinBox->setValue( mTable->maximumNumberOfFeatures() );
438 mMarginSpinBox->setValue( mTable->cellMargin() );
439 mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
440 mGridColorButton->setColor( mTable->gridColor() );
441 mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
442 mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
443 if ( mTable->showGrid() )
445 mShowGridGroupCheckBox->setChecked(
true );
449 mShowGridGroupCheckBox->setChecked(
false );
451 mBackgroundColorButton->setColor( mTable->backgroundColor() );
453 mHeaderFontToolButton->setTextFormat( mTable->headerTextFormat() );
454 mContentFontToolButton->setTextFormat( mTable->contentTextFormat() );
456 if ( mTable->displayOnlyVisibleFeatures() && mShowOnlyVisibleFeaturesCheckBox->isEnabled() )
458 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
459 mComposerMapComboBox->setEnabled(
true );
460 mComposerMapLabel->setEnabled(
true );
464 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
465 mComposerMapComboBox->setEnabled(
false );
466 mComposerMapLabel->setEnabled(
false );
469 mUniqueOnlyCheckBox->setChecked( mTable->uniqueRowsOnly() );
470 mIntersectAtlasCheckBox->setChecked( mTable->filterToAtlasFeature() );
471 mFeatureFilterEdit->setText( mTable->featureFilter() );
472 mFeatureFilterCheckBox->setCheckState( mTable->filterFeatures() ? Qt::Checked : Qt::Unchecked );
473 mFeatureFilterEdit->setEnabled( mTable->filterFeatures() );
474 mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
475 mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );
477 mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
478 mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
480 mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
481 mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
484 mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
485 mWrapStringLineEdit->setText( mTable->wrapString() );
486 mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
488 mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
491 mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
492 mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
496 toggleSourceControls();
498 blockAllSignals(
false );
501 void QgsLayoutAttributeTableWidget::atlasToggled()
508 toggleAtlasSpecificControls( atlasEnabled );
513 whileBlocking( mSourceComboBox )->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
515 if ( !atlasEnabled && mTable->filterToAtlasFeature() )
517 mTable->setFilterToAtlasFeature(
false );
521 void QgsLayoutAttributeTableWidget::updateRelationsCombo()
523 mRelationsComboBox->blockSignals(
true );
524 mRelationsComboBox->clear();
532 mRelationsComboBox->addItem( relation.name(), relation.id() );
536 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
540 mRelationsComboBox->blockSignals(
false );
543 void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls(
const bool atlasEnabled )
553 mRelationsComboBox->blockSignals(
true );
554 mRelationsComboBox->setEnabled(
false );
555 mRelationsComboBox->clear();
556 mRelationsComboBox->blockSignals(
false );
557 mIntersectAtlasCheckBox->setEnabled(
false );
573 updateRelationsCombo();
574 mRelationsComboBox->setEnabled(
true );
575 mIntersectAtlasCheckBox->setEnabled(
true );
579 void QgsLayoutAttributeTableWidget::blockAllSignals(
bool b )
581 mSourceComboBox->blockSignals( b );
582 mLayerComboBox->blockSignals( b );
583 mComposerMapComboBox->blockSignals( b );
584 mMaximumRowsSpinBox->blockSignals( b );
585 mMarginSpinBox->blockSignals( b );
586 mGridColorButton->blockSignals( b );
587 mGridStrokeWidthSpinBox->blockSignals( b );
588 mBackgroundColorButton->blockSignals( b );
589 mDrawHorizontalGrid->blockSignals( b );
590 mDrawVerticalGrid->blockSignals( b );
591 mShowGridGroupCheckBox->blockSignals( b );
592 mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
593 mUniqueOnlyCheckBox->blockSignals( b );
594 mIntersectAtlasCheckBox->blockSignals( b );
595 mFeatureFilterEdit->blockSignals( b );
596 mFeatureFilterCheckBox->blockSignals( b );
597 mHeaderHAlignmentComboBox->blockSignals( b );
598 mHeaderModeComboBox->blockSignals( b );
599 mResizeModeComboBox->blockSignals( b );
600 mRelationsComboBox->blockSignals( b );
601 mEmptyModeComboBox->blockSignals( b );
602 mEmptyMessageLineEdit->blockSignals( b );
603 mEmptyFrameCheckBox->blockSignals( b );
604 mHideEmptyBgCheckBox->blockSignals( b );
605 mDrawEmptyCheckBox->blockSignals( b );
606 mWrapStringLineEdit->blockSignals( b );
607 mWrapBehaviorComboBox->blockSignals( b );
608 mContentFontToolButton->blockSignals( b );
609 mHeaderFontToolButton->blockSignals( b );
612 void QgsLayoutAttributeTableWidget::setMaximumNumberOfFeatures(
int n )
617 void QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged(
int state )
624 mTable->beginCommand( tr(
"Toggle Visible Features Only" ) );
625 bool showOnlyVisibleFeatures = ( state == Qt::Checked );
626 mTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
628 mTable->endCommand();
631 mComposerMapComboBox->setEnabled( state == Qt::Checked );
632 mComposerMapLabel->setEnabled( state == Qt::Checked );
635 void QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged(
int state )
642 mTable->beginCommand( tr(
"Toggle Table Filter Duplicates" ) );
643 mTable->setUniqueRowsOnly( state == Qt::Checked );
645 mTable->endCommand();
648 void QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled(
bool checked )
655 mFrame->beginCommand( tr(
"Toggle Empty Frame Mode" ) );
656 mFrame->setHidePageIfEmpty( checked );
657 mFrame->endCommand();
660 void QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled(
bool checked )
667 mFrame->beginCommand( tr(
"Toggle Background Display" ) );
668 mFrame->setHideBackgroundIfEmpty( checked );
669 mFrame->endCommand();
672 void QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged(
int state )
679 mTable->beginCommand( tr(
"Toggle Table Atlas Filter" ) );
680 bool filterToAtlas = ( state == Qt::Checked );
681 mTable->setFilterToAtlasFeature( filterToAtlas );
683 mTable->endCommand();
686 void QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged(
int state )
693 if ( state == Qt::Checked )
695 mFeatureFilterEdit->setEnabled(
true );
696 mFeatureFilterButton->setEnabled(
true );
700 mFeatureFilterEdit->setEnabled(
false );
701 mFeatureFilterButton->setEnabled(
false );
704 mTable->beginCommand( tr(
"Toggle Table Feature Filter" ) );
705 mTable->setFilterFeatures( state == Qt::Checked );
707 mTable->endCommand();
710 void QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished()
717 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
718 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
720 mTable->endCommand();
723 void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
731 QgsExpressionBuilderDialog exprDlg( mTable->sourceLayer(), mFeatureFilterEdit->text(),
this, QStringLiteral(
"generic" ), context );
732 exprDlg.setWindowTitle( tr(
"Expression Based Filter" ) );
733 if ( exprDlg.exec() == QDialog::Accepted )
735 QString expression = exprDlg.expressionText();
736 if ( !expression.isEmpty() )
738 mFeatureFilterEdit->setText( expression );
739 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
740 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
742 mTable->endCommand();
747 void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged(
int )
754 mTable->beginCommand( tr(
"Change Table Alignment" ) );
756 mTable->endCommand();
759 void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged(
int )
766 mTable->beginCommand( tr(
"Change Table Header Mode" ) );
768 mTable->endCommand();
771 void QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished()
778 mTable->beginCommand( tr(
"Change Table Wrap String" ) );
779 mTable->setWrapString( mWrapStringLineEdit->text() );
780 mTable->endCommand();
783 void QgsLayoutAttributeTableWidget::changeLayer(
QgsMapLayer *layer )
796 mTable->beginCommand( tr(
"Change Table Layer" ) );
797 mTable->setVectorLayer( vl );
799 mTable->endCommand();
804 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
805 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
809 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
813 void QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked()
815 if ( !mTable || !mFrame )
821 QPointF pos = mFrame->pos();
823 pos.ry() += mFrame->rect().height() + 10;
825 QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
826 mTable->recalculateFrameSizes();
829 if (
QgsLayout *layout = mTable->layout() )
831 layout->setSelectedItem( newFrame );
835 void QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged(
int index )
842 mTable->beginCommand( tr(
"Change Resize Mode" ) );
844 mTable->endCommand();
849 void QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged(
int index )
856 mTable->beginCommand( tr(
"Change Table Source" ) );
858 mTable->endCommand();
860 toggleSourceControls();
863 void QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged(
int index )
870 mTable->beginCommand( tr(
"Change Table Source Relation" ) );
871 mTable->setRelationId( mRelationsComboBox->itemData( index ).toString() );
872 mTable->endCommand();
875 void QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged(
int index )
882 mTable->beginCommand( tr(
"Change Empty Table Behavior" ) );
884 mTable->endCommand();
889 void QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged(
int index )
896 mTable->beginCommand( tr(
"Change Table Wrap Mode" ) );
898 mTable->endCommand();
901 void QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked()
912 void QgsLayoutAttributeTableWidget::useConditionalStylingChanged(
bool checked )
919 mTable->beginCommand( tr(
"Toggle Table Conditional Styling" ) );
920 mTable->setUseConditionalStyling( checked );
922 mTable->endCommand();
925 void QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled(
bool checked )
932 mTable->beginCommand( tr(
"Change Show Empty Rows" ) );
933 mTable->setShowEmptyRows( checked );
934 mTable->endCommand();
937 void QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished()
944 mTable->beginCommand( tr(
"Change Empty Table Message" ) );
945 mTable->setEmptyTableMessage( mEmptyMessageLineEdit->text() );
946 mTable->endCommand();
949 void QgsLayoutAttributeTableWidget::toggleSourceControls()
951 switch ( mTable->source() )
954 mLayerComboBox->setEnabled(
true );
955 mLayerComboBox->setVisible(
true );
956 mLayerSourceDDBtn->setVisible(
true );
957 mLayerLabel->setVisible(
true );
958 mRelationsComboBox->setEnabled(
false );
959 mRelationsComboBox->setVisible(
false );
960 mRelationLabel->setVisible(
false );
961 mMaximumRowsSpinBox->setEnabled(
true );
962 mMaxNumFeaturesLabel->setEnabled(
true );
963 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
964 mComposerMapComboBox->setEnabled( mTable->displayOnlyVisibleFeatures() );
965 mComposerMapLabel->setEnabled( mTable->displayOnlyVisibleFeatures() );
968 mLayerComboBox->setEnabled(
false );
969 mLayerComboBox->setVisible(
false );
970 mLayerSourceDDBtn->setVisible(
false );
971 mLayerLabel->setVisible(
false );
972 mRelationsComboBox->setEnabled(
false );
973 mRelationsComboBox->setVisible(
false );
974 mRelationLabel->setVisible(
false );
975 mMaximumRowsSpinBox->setEnabled(
false );
976 mMaxNumFeaturesLabel->setEnabled(
false );
977 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
978 mComposerMapComboBox->setEnabled(
false );
979 mComposerMapLabel->setEnabled(
false );
982 mLayerComboBox->setEnabled(
false );
983 mLayerComboBox->setVisible(
false );
984 mLayerLabel->setVisible(
false );
985 mLayerSourceDDBtn->setVisible(
false );
986 mRelationsComboBox->setEnabled(
true );
987 mRelationsComboBox->setVisible(
true );
988 mRelationLabel->setVisible(
true );
989 mMaximumRowsSpinBox->setEnabled(
true );
990 mMaxNumFeaturesLabel->setEnabled(
true );
991 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
992 mComposerMapComboBox->setEnabled(
true );
993 mComposerMapLabel->setEnabled(
true );
A generic dialog for building expression strings.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
void toggled(bool)
Emitted when atlas is enabled or disabled.
bool enabled() const
Returns whether the atlas generation is enabled.
A dialog to select what attributes to display (in the table item), set the column properties and spec...
Base class for frame items, which form a layout multiframe item.
QgsLayoutMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
A layout table subclass that displays attributes from a vector layer.
ContentSource
Specifies the content source for the attribute table.
@ AtlasFeature
Table shows attributes from the current atlas feature.
@ RelationChildren
Table shows attributes from related child features.
@ LayerAttributes
Table shows attributes from features in a vector layer.
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
@ LayoutAttributeTable
Attribute table.
Base class for graphical items within a QgsLayout.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
virtual int type() const =0
Returns unique multiframe type id.
ResizeMode
Specifies the behavior for creating new frames to fit the multiframe's content.
@ UseExistingFrames
Don't automatically create new frames, just use existing frames.
@ ExtendToNextPage
Creates new full page frames on the following page(s) until the entire multiframe content is visible.
@ UndoTableMaximumFeatures
Maximum features in table.
@ UndoTableBackgroundColor
Table background color.
@ UndoTableGridStrokeWidth
Table grid stroke width.
@ UndoTableGridColor
Table grid color.
@ UndoTableMargin
Table margins.
void changed()
Emitted when the object's properties change.
@ AttributeTableSourceLayer
Attribute table source layer.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
A dialog for customization of the cell background colors for a QgsLayoutTable.
HeaderMode
Controls where headers are shown in the table.
@ FirstFrame
Header shown on first frame only.
@ AllFrames
Headers shown on all frames.
@ NoHeaders
No headers shown for table.
WrapBehavior
Controls how long strings in the table are handled.
@ WrapText
Text which doesn't fit inside the cell is wrapped. Note that this only applies to text in columns wit...
@ TruncateText
Text which doesn't fit inside the cell is truncated.
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
@ HeaderRight
Align headers right.
@ HeaderLeft
Align headers left.
@ HeaderCenter
Align headers to center.
@ FollowColumn
Header uses the same alignment as the column.
EmptyTableMode
Controls how empty tables are displayed.
@ HideTable
Hides entire table if empty.
@ ShowMessage
Shows preset message instead of table contents.
@ HeadersOnly
Show header rows only.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
void layerChanged(QgsMapLayer *layer)
Emitted whenever the currently selected layer changes.
Base class for all map layer types.
Interface for master layout type objects, such as print layouts and reports.
QgsRelationManager * relationManager
static QgsProject * instance()
Returns the QgsProject singleton instance.
QList< QgsRelation > referencedRelations(const QgsVectorLayer *layer=nullptr) const
Gets all relations where this layer is the referenced part (i.e.
void changed()
Emitted when relations are added or removed to the manager.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.