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( mHeaderFontColorButton, &
QgsColorButton::colorChanged,
this, &QgsLayoutAttributeTableWidget::mHeaderFontColorButton_colorChanged );
48 connect( mContentFontColorButton, &
QgsColorButton::colorChanged,
this, &QgsLayoutAttributeTableWidget::mContentFontColorButton_colorChanged );
49 connect( mDrawHorizontalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled );
50 connect( mDrawVerticalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled );
51 connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled );
52 connect( mShowOnlyVisibleFeaturesCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged );
53 connect( mFeatureFilterCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged );
54 connect( mFeatureFilterEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished );
55 connect( mFeatureFilterButton, &QToolButton::clicked,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked );
56 connect( mHeaderHAlignmentComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
57 connect( mHeaderModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged );
58 connect( mWrapStringLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished );
59 connect( mAddFramePushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked );
60 connect( mResizeModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged );
61 connect( mSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged );
62 connect( mRelationsComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged );
63 connect( mEmptyModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged );
64 connect( mDrawEmptyCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled );
65 connect( mEmptyMessageLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished );
66 connect( mIntersectAtlasCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged );
67 connect( mUniqueOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged );
68 connect( mEmptyFrameCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled );
69 connect( mHideEmptyBgCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled );
70 connect( mWrapBehaviorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
71 connect( mAdvancedCustomizationButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked );
72 connect( mUseConditionalStylingCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::useConditionalStylingChanged );
78 blockAllSignals(
true );
101 toggleAtlasSpecificControls( static_cast< bool >(
coverageLayer() ) );
109 mComposerMapComboBox->setCurrentLayout( mTable->layout() );
113 mHeaderFontColorButton->setColorDialogTitle( tr(
"Select Header Font Color" ) );
114 mHeaderFontColorButton->setAllowOpacity(
true );
115 mHeaderFontColorButton->setContext( QStringLiteral(
"composer" ) );
116 mContentFontColorButton->setColorDialogTitle( tr(
"Select Content Font Color" ) );
117 mContentFontColorButton->setAllowOpacity(
true );
118 mContentFontColorButton->setContext( QStringLiteral(
"composer" ) );
119 mGridColorButton->setColorDialogTitle( tr(
"Select Grid Color" ) );
120 mGridColorButton->setAllowOpacity(
true );
121 mGridColorButton->setContext( QStringLiteral(
"composer" ) );
122 mGridColorButton->setDefaultColor( Qt::black );
123 mBackgroundColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
124 mBackgroundColorButton->setAllowOpacity(
true );
125 mBackgroundColorButton->setContext( QStringLiteral(
"composer" ) );
126 mBackgroundColorButton->setShowNoColor(
true );
127 mBackgroundColorButton->setNoColorString( tr(
"No Background" ) );
137 this, &QgsLayoutAttributeTableWidget::atlasToggled );
145 mLayerSourceDDBtn->registerExpressionContextGenerator( mTable );
155 mainLayout->addWidget( mItemPropertiesWidget );
158 connect( mHeaderFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::headerFontChanged );
159 connect( mContentFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::contentFontChanged );
164 mIntersectAtlasCheckBox->setText( tr(
"Show only features intersecting %1 feature" ).arg(
string ) );
166 if ( atlasFeatureIndex != -1 )
168 mSourceComboBox->setItemText( atlasFeatureIndex, tr(
"Current %1 Feature" ).arg(
string ) );
174 if ( mItemPropertiesWidget )
198 mItemPropertiesWidget->
setItem( frame );
211 void QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked()
218 mTable->refreshAttributes();
221 void QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked()
229 QVector<QgsLayoutTableColumn *> currentColumns;
230 auto it = mTable->columns().constBegin();
231 for ( ; it != mTable->columns().constEnd() ; ++it )
234 currentColumns.append( copy );
237 mTable->beginCommand( tr(
"Change Table Attributes" ) );
240 window()->setUpdatesEnabled(
false );
243 if ( d.exec() == QDialog::Accepted )
245 mTable->refreshAttributes();
247 window()->setUpdatesEnabled(
true );
249 mTable->endCommand();
252 qDeleteAll( currentColumns );
253 currentColumns.clear();
258 mTable->setColumns( currentColumns );
259 window()->setUpdatesEnabled(
true );
260 mTable->cancelCommand();
264 void QgsLayoutAttributeTableWidget::composerMapChanged(
QgsLayoutItem *item )
271 mTable->beginCommand( tr(
"Change Table Map" ) );
272 mTable->setMap( qobject_cast< QgsLayoutItemMap * >( item ) );
274 mTable->endCommand();
277 void QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged(
int i )
285 mTable->setMaximumNumberOfFeatures( i );
287 mTable->endCommand();
290 void QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged(
double d )
298 mTable->setCellMargin( d );
299 mTable->endCommand();
302 void QgsLayoutAttributeTableWidget::headerFontChanged()
307 mTable->beginCommand( tr(
"Change Table Font" ) );
308 mTable->setHeaderFont( mHeaderFontToolButton->currentFont() );
309 mTable->endCommand();
312 void QgsLayoutAttributeTableWidget::mHeaderFontColorButton_colorChanged(
const QColor &newColor )
320 mTable->setHeaderFontColor( newColor );
321 mTable->endCommand();
324 void QgsLayoutAttributeTableWidget::contentFontChanged()
331 mTable->beginCommand( tr(
"Change Table Font" ) );
332 mTable->setContentFont( mContentFontToolButton->currentFont() );
333 mTable->endCommand();
336 void QgsLayoutAttributeTableWidget::mContentFontColorButton_colorChanged(
const QColor &newColor )
344 mTable->setContentFontColor( newColor );
345 mTable->endCommand();
348 void QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged(
double d )
356 mTable->setGridStrokeWidth( d );
357 mTable->endCommand();
360 void QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged(
const QColor &newColor )
368 mTable->setGridColor( newColor );
369 mTable->endCommand();
372 void QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled(
bool state )
379 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
380 mTable->setHorizontalGrid( state );
381 mTable->endCommand();
384 void QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled(
bool state )
391 mTable->beginCommand( tr(
"Toggled Table Grid" ) );
392 mTable->setVerticalGrid( state );
393 mTable->endCommand();
396 void QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled(
bool state )
403 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
404 mTable->setShowGrid( state );
405 mTable->endCommand();
408 void QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged(
const QColor &newColor )
416 mTable->setBackgroundColor( newColor );
417 mTable->endCommand();
420 void QgsLayoutAttributeTableWidget::updateGuiElements()
422 if ( !mTable || !mFrame )
427 blockAllSignals(
true );
429 mSourceComboBox->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
430 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
433 if ( mTable->vectorLayer() )
435 mLayerComboBox->setLayer( mTable->vectorLayer() );
439 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
440 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
444 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
448 mComposerMapComboBox->setItem( mTable->map() );
449 mMaximumRowsSpinBox->setValue( mTable->maximumNumberOfFeatures() );
450 mMarginSpinBox->setValue( mTable->cellMargin() );
451 mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
452 mGridColorButton->setColor( mTable->gridColor() );
453 mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
454 mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
455 if ( mTable->showGrid() )
457 mShowGridGroupCheckBox->setChecked(
true );
461 mShowGridGroupCheckBox->setChecked(
false );
463 mBackgroundColorButton->setColor( mTable->backgroundColor() );
465 mHeaderFontColorButton->setColor( mTable->headerFontColor() );
466 mContentFontColorButton->setColor( mTable->contentFontColor() );
467 mHeaderFontToolButton->setCurrentFont( mTable->headerFont() );
468 mContentFontToolButton->setCurrentFont( mTable->contentFont() );
470 if ( mTable->displayOnlyVisibleFeatures() && mShowOnlyVisibleFeaturesCheckBox->isEnabled() )
472 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
473 mComposerMapComboBox->setEnabled(
true );
474 mComposerMapLabel->setEnabled(
true );
478 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
479 mComposerMapComboBox->setEnabled(
false );
480 mComposerMapLabel->setEnabled(
false );
483 mUniqueOnlyCheckBox->setChecked( mTable->uniqueRowsOnly() );
484 mIntersectAtlasCheckBox->setChecked( mTable->filterToAtlasFeature() );
485 mFeatureFilterEdit->setText( mTable->featureFilter() );
486 mFeatureFilterCheckBox->setCheckState( mTable->filterFeatures() ? Qt::Checked : Qt::Unchecked );
487 mFeatureFilterEdit->setEnabled( mTable->filterFeatures() );
488 mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
489 mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );
491 mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
492 mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
494 mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
495 mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
498 mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
499 mWrapStringLineEdit->setText( mTable->wrapString() );
500 mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
502 mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
505 mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
506 mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
510 toggleSourceControls();
512 blockAllSignals(
false );
515 void QgsLayoutAttributeTableWidget::atlasToggled()
522 toggleAtlasSpecificControls( atlasEnabled );
527 whileBlocking( mSourceComboBox )->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
529 if ( !atlasEnabled && mTable->filterToAtlasFeature() )
531 mTable->setFilterToAtlasFeature(
false );
535 void QgsLayoutAttributeTableWidget::updateRelationsCombo()
537 mRelationsComboBox->blockSignals(
true );
538 mRelationsComboBox->clear();
546 mRelationsComboBox->addItem( relation.name(), relation.id() );
550 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
554 mRelationsComboBox->blockSignals(
false );
557 void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls(
const bool atlasEnabled )
567 mRelationsComboBox->blockSignals(
true );
568 mRelationsComboBox->setEnabled(
false );
569 mRelationsComboBox->clear();
570 mRelationsComboBox->blockSignals(
false );
571 mIntersectAtlasCheckBox->setEnabled(
false );
587 updateRelationsCombo();
588 mRelationsComboBox->setEnabled(
true );
589 mIntersectAtlasCheckBox->setEnabled(
true );
593 void QgsLayoutAttributeTableWidget::blockAllSignals(
bool b )
595 mSourceComboBox->blockSignals( b );
596 mLayerComboBox->blockSignals( b );
597 mComposerMapComboBox->blockSignals( b );
598 mMaximumRowsSpinBox->blockSignals( b );
599 mMarginSpinBox->blockSignals( b );
600 mGridColorButton->blockSignals( b );
601 mGridStrokeWidthSpinBox->blockSignals( b );
602 mBackgroundColorButton->blockSignals( b );
603 mDrawHorizontalGrid->blockSignals( b );
604 mDrawVerticalGrid->blockSignals( b );
605 mShowGridGroupCheckBox->blockSignals( b );
606 mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
607 mUniqueOnlyCheckBox->blockSignals( b );
608 mIntersectAtlasCheckBox->blockSignals( b );
609 mFeatureFilterEdit->blockSignals( b );
610 mFeatureFilterCheckBox->blockSignals( b );
611 mHeaderHAlignmentComboBox->blockSignals( b );
612 mHeaderModeComboBox->blockSignals( b );
613 mHeaderFontColorButton->blockSignals( b );
614 mContentFontColorButton->blockSignals( b );
615 mResizeModeComboBox->blockSignals( b );
616 mRelationsComboBox->blockSignals( b );
617 mEmptyModeComboBox->blockSignals( b );
618 mEmptyMessageLineEdit->blockSignals( b );
619 mEmptyFrameCheckBox->blockSignals( b );
620 mHideEmptyBgCheckBox->blockSignals( b );
621 mDrawEmptyCheckBox->blockSignals( b );
622 mWrapStringLineEdit->blockSignals( b );
623 mWrapBehaviorComboBox->blockSignals( b );
624 mContentFontToolButton->blockSignals( b );
625 mHeaderFontToolButton->blockSignals( b );
628 void QgsLayoutAttributeTableWidget::setMaximumNumberOfFeatures(
int n )
633 void QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged(
int state )
640 mTable->beginCommand( tr(
"Toggle Visible Features Only" ) );
641 bool showOnlyVisibleFeatures = ( state == Qt::Checked );
642 mTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
644 mTable->endCommand();
647 mComposerMapComboBox->setEnabled( state == Qt::Checked );
648 mComposerMapLabel->setEnabled( state == Qt::Checked );
651 void QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged(
int state )
658 mTable->beginCommand( tr(
"Toggle Table Filter Duplicates" ) );
659 mTable->setUniqueRowsOnly( state == Qt::Checked );
661 mTable->endCommand();
664 void QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled(
bool checked )
671 mFrame->beginCommand( tr(
"Toggle Empty Frame Mode" ) );
672 mFrame->setHidePageIfEmpty( checked );
673 mFrame->endCommand();
676 void QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled(
bool checked )
683 mFrame->beginCommand( tr(
"Toggle Background Display" ) );
684 mFrame->setHideBackgroundIfEmpty( checked );
685 mFrame->endCommand();
688 void QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged(
int state )
695 mTable->beginCommand( tr(
"Toggle Table Atlas Filter" ) );
696 bool filterToAtlas = ( state == Qt::Checked );
697 mTable->setFilterToAtlasFeature( filterToAtlas );
699 mTable->endCommand();
702 void QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged(
int state )
709 if ( state == Qt::Checked )
711 mFeatureFilterEdit->setEnabled(
true );
712 mFeatureFilterButton->setEnabled(
true );
716 mFeatureFilterEdit->setEnabled(
false );
717 mFeatureFilterButton->setEnabled(
false );
720 mTable->beginCommand( tr(
"Toggle Table Feature Filter" ) );
721 mTable->setFilterFeatures( state == Qt::Checked );
723 mTable->endCommand();
726 void QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished()
733 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
734 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
736 mTable->endCommand();
739 void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
747 QgsExpressionBuilderDialog exprDlg( mTable->sourceLayer(), mFeatureFilterEdit->text(),
this, QStringLiteral(
"generic" ), context );
748 exprDlg.setWindowTitle( tr(
"Expression Based Filter" ) );
749 if ( exprDlg.exec() == QDialog::Accepted )
752 if ( !expression.isEmpty() )
754 mFeatureFilterEdit->setText( expression );
755 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
756 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
758 mTable->endCommand();
763 void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged(
int )
770 mTable->beginCommand( tr(
"Change Table Alignment" ) );
771 mTable->setHeaderHAlignment( static_cast< QgsLayoutTable::HeaderHAlignment >( mHeaderHAlignmentComboBox->currentData().toInt() ) );
772 mTable->endCommand();
775 void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged(
int )
782 mTable->beginCommand( tr(
"Change Table Header Mode" ) );
783 mTable->setHeaderMode( static_cast< QgsLayoutTable::HeaderMode >( mHeaderModeComboBox->currentData().toInt() ) );
784 mTable->endCommand();
787 void QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished()
794 mTable->beginCommand( tr(
"Change Table Wrap String" ) );
795 mTable->setWrapString( mWrapStringLineEdit->text() );
796 mTable->endCommand();
799 void QgsLayoutAttributeTableWidget::changeLayer(
QgsMapLayer *layer )
812 mTable->beginCommand( tr(
"Change Table Layer" ) );
813 mTable->setVectorLayer( vl );
815 mTable->endCommand();
820 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
821 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
825 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
829 void QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked()
831 if ( !mTable || !mFrame )
837 QPointF pos = mFrame->pos();
839 pos.ry() += mFrame->rect().height() + 10;
841 QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
842 mTable->recalculateFrameSizes();
845 if (
QgsLayout *layout = mTable->layout() )
847 layout->setSelectedItem( newFrame );
851 void QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged(
int index )
858 mTable->beginCommand( tr(
"Change Resize Mode" ) );
859 mTable->setResizeMode( static_cast< QgsLayoutMultiFrame::ResizeMode >( mResizeModeComboBox->itemData( index ).toInt() ) );
860 mTable->endCommand();
865 void QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged(
int index )
872 mTable->beginCommand( tr(
"Change Table Source" ) );
873 mTable->setSource( static_cast< QgsLayoutItemAttributeTable::ContentSource >( mSourceComboBox->itemData( index ).toInt() ) );
874 mTable->endCommand();
876 toggleSourceControls();
879 void QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged(
int index )
886 mTable->beginCommand( tr(
"Change Table Source Relation" ) );
887 mTable->setRelationId( mRelationsComboBox->itemData( index ).toString() );
888 mTable->endCommand();
891 void QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged(
int index )
898 mTable->beginCommand( tr(
"Change Empty Table Behavior" ) );
899 mTable->setEmptyTableBehavior( static_cast< QgsLayoutTable::EmptyTableMode >( mEmptyModeComboBox->itemData( index ).toInt() ) );
900 mTable->endCommand();
905 void QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged(
int index )
912 mTable->beginCommand( tr(
"Change Table Wrap Mode" ) );
913 mTable->setWrapBehavior( static_cast< QgsLayoutTable::WrapBehavior >( mWrapBehaviorComboBox->itemData( index ).toInt() ) );
914 mTable->endCommand();
917 void QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked()
928 void QgsLayoutAttributeTableWidget::useConditionalStylingChanged(
bool checked )
935 mTable->beginCommand( tr(
"Toggle Table Conditional Styling" ) );
936 mTable->setUseConditionalStyling( checked );
938 mTable->endCommand();
941 void QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled(
bool checked )
948 mTable->beginCommand( tr(
"Change Show Empty Rows" ) );
949 mTable->setShowEmptyRows( checked );
950 mTable->endCommand();
953 void QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished()
960 mTable->beginCommand( tr(
"Change Empty Table Message" ) );
961 mTable->setEmptyTableMessage( mEmptyMessageLineEdit->text() );
962 mTable->endCommand();
965 void QgsLayoutAttributeTableWidget::toggleSourceControls()
967 switch ( mTable->source() )
970 mLayerComboBox->setEnabled(
true );
971 mLayerComboBox->setVisible(
true );
972 mLayerSourceDDBtn->setVisible(
true );
973 mLayerLabel->setVisible(
true );
974 mRelationsComboBox->setEnabled(
false );
975 mRelationsComboBox->setVisible(
false );
976 mRelationLabel->setVisible(
false );
977 mMaximumRowsSpinBox->setEnabled(
true );
978 mMaxNumFeaturesLabel->setEnabled(
true );
979 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
980 mComposerMapComboBox->setEnabled( mTable->displayOnlyVisibleFeatures() );
981 mComposerMapLabel->setEnabled( mTable->displayOnlyVisibleFeatures() );
984 mLayerComboBox->setEnabled(
false );
985 mLayerComboBox->setVisible(
false );
986 mLayerSourceDDBtn->setVisible(
false );
987 mLayerLabel->setVisible(
false );
988 mRelationsComboBox->setEnabled(
false );
989 mRelationsComboBox->setVisible(
false );
990 mRelationLabel->setVisible(
false );
991 mMaximumRowsSpinBox->setEnabled(
false );
992 mMaxNumFeaturesLabel->setEnabled(
false );
993 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
994 mComposerMapComboBox->setEnabled(
false );
995 mComposerMapLabel->setEnabled(
false );
998 mLayerComboBox->setEnabled(
false );
999 mLayerComboBox->setVisible(
false );
1000 mLayerLabel->setVisible(
false );
1001 mLayerSourceDDBtn->setVisible(
false );
1002 mRelationsComboBox->setEnabled(
true );
1003 mRelationsComboBox->setVisible(
true );
1004 mRelationLabel->setVisible(
true );
1005 mMaximumRowsSpinBox->setEnabled(
true );
1006 mMaxNumFeaturesLabel->setEnabled(
true );
1007 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
1008 mComposerMapComboBox->setEnabled(
true );
1009 mComposerMapLabel->setEnabled(
true );
Base class for all map layer types.
Base class for graphical items within a QgsLayout.
Header uses the same alignment as the column.
Don't automatically create new frames, just use existing frames.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
Text which doesn't fit inside the cell is truncated.
Table shows attributes from related child features.
void toggled(bool)
Emitted when atlas is enabled or disabled.
Shows preset message instead of table contents.
void layerChanged(QgsMapLayer *layer)
Emitted whenever the currently selected layer changes.
Text which doesn't fit inside the cell is wrapped. Note that this only applies to text in columns wit...
Table shows attributes from features in a vector layer.
QList< QgsRelation > referencedRelations(const QgsVectorLayer *layer=nullptr) const
Gets all relations where this layer is the referenced part (i.e.
Creates new full page frames on the following page(s) until the entire multiframe content is visible...
A dialog for customization of the cell background colors for a QgsLayoutTable.
Stores properties of a column for a QgsLayoutTable.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
Attribute table source layer.
No headers shown for table.
Maximum features in table.
Table content font color.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
QgsLayoutMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
A layout table subclass that displays attributes from a vector layer.
Header shown on first frame only.
Table shows attributes from the current atlas feature.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
QgsRelationManager relationManager
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A dialog to select what attributes to display (in the table item), set the column properties and spec...
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
void changed()
Emitted when relations are added or removed to the manager.
virtual int type() const =0
Returns unique multiframe type id.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Headers shown on all frames.
bool enabled() const
Returns whether the atlas generation is enabled.
QgsLayoutTableColumn * clone()
Creates a duplicate column which is a deep copy of this column.
Interface for master layout type objects, such as print layouts and reports.
void changed()
Emitted when the object's properties change.
Represents a vector layer which manages a vector based data sets.
Base class for frame items, which form a layout multiframe item.
A generic dialog for building expression strings.
Hides entire table if empty.