19#include "moc_qgslayoutattributetablewidget.cpp" 
   41  connect( mRefreshPushButton, &QPushButton::clicked, 
this, &QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked );
 
   42  connect( mAttributesPushButton, &QPushButton::clicked, 
this, &QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked );
 
   43  connect( mMaximumRowsSpinBox, 
static_cast<void ( QSpinBox::* )( 
int )
>( &QSpinBox::valueChanged ), 
this, &QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged );
 
   44  connect( mMarginSpinBox, 
static_cast<void ( QDoubleSpinBox::* )( 
double )
>( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged );
 
   45  connect( mGridStrokeWidthSpinBox, 
static_cast<void ( QDoubleSpinBox::* )( 
double )
>( &QDoubleSpinBox::valueChanged ), 
this, &QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged );
 
   47  connect( mBackgroundColorButton, &
QgsColorButton::colorChanged, 
this, &QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged );
 
   48  connect( mDrawHorizontalGrid, &QCheckBox::toggled, 
this, &QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled );
 
   49  connect( mDrawVerticalGrid, &QCheckBox::toggled, 
this, &QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled );
 
   50  connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled, 
this, &QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled );
 
   51  connect( mShowOnlyVisibleFeaturesCheckBox, &QCheckBox::stateChanged, 
this, &QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged );
 
   52  connect( mFeatureFilterCheckBox, &QCheckBox::stateChanged, 
this, &QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged );
 
   53  connect( mFeatureFilterEdit, &QLineEdit::editingFinished, 
this, &QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished );
 
   54  connect( mFeatureFilterButton, &QToolButton::clicked, 
this, &QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked );
 
   55  connect( mHeaderHAlignmentComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
 
   56  connect( mHeaderModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged );
 
   57  connect( mWrapStringLineEdit, &QLineEdit::editingFinished, 
this, &QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished );
 
   58  connect( mAddFramePushButton, &QPushButton::clicked, 
this, &QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked );
 
   59  connect( mResizeModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged );
 
   60  connect( mSourceComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged );
 
   61  connect( mRelationsComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged );
 
   62  connect( mEmptyModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged );
 
   63  connect( mDrawEmptyCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled );
 
   64  connect( mEmptyMessageLineEdit, &QLineEdit::editingFinished, 
this, &QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished );
 
   65  connect( mIntersectAtlasCheckBox, &QCheckBox::stateChanged, 
this, &QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged );
 
   66  connect( mUniqueOnlyCheckBox, &QCheckBox::stateChanged, 
this, &QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged );
 
   67  connect( mEmptyFrameCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled );
 
   68  connect( mHideEmptyBgCheckBox, &QCheckBox::toggled, 
this, &QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled );
 
   69  connect( mWrapBehaviorComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
 
   70  connect( mAdvancedCustomizationButton, &QPushButton::clicked, 
this, &QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked );
 
   71  connect( mUseConditionalStylingCheckBox, &QCheckBox::stateChanged, 
this, &QgsLayoutAttributeTableWidget::useConditionalStylingChanged );
 
   77  mContentFontToolButton->registerExpressionContextGenerator( 
this );
 
   78  mContentFontToolButton->setLayer( mTable->sourceLayer() );
 
   79  mHeaderFontToolButton->registerExpressionContextGenerator( 
this );
 
   80  mHeaderFontToolButton->setLayer( mTable->sourceLayer() );
 
   82  blockAllSignals( 
true );
 
  105  toggleAtlasSpecificControls( 
static_cast<bool>( 
coverageLayer() ) );
 
  113  mComposerMapComboBox->setCurrentLayout( mTable->layout() );
 
  117  mGridColorButton->setColorDialogTitle( tr( 
"Select Grid Color" ) );
 
  118  mGridColorButton->setAllowOpacity( 
true );
 
  119  mGridColorButton->setContext( QStringLiteral( 
"composer" ) );
 
  120  mGridColorButton->setDefaultColor( Qt::black );
 
  121  mBackgroundColorButton->setColorDialogTitle( tr( 
"Select Background Color" ) );
 
  122  mBackgroundColorButton->setAllowOpacity( 
true );
 
  123  mBackgroundColorButton->setContext( QStringLiteral( 
"composer" ) );
 
  124  mBackgroundColorButton->setShowNoColor( 
true );
 
  125  mBackgroundColorButton->setNoColorString( tr( 
"No Background" ) );
 
  142    mLayerSourceDDBtn->registerExpressionContextGenerator( mTable );
 
  152    mainLayout->addWidget( mItemPropertiesWidget );
 
  155  connect( mHeaderFontToolButton, &
QgsFontButton::changed, 
this, &QgsLayoutAttributeTableWidget::headerFontChanged );
 
  156  connect( mContentFontToolButton, &
QgsFontButton::changed, 
this, &QgsLayoutAttributeTableWidget::contentFontChanged );
 
 
  161  mIntersectAtlasCheckBox->setText( tr( 
"Show only features intersecting %1 feature" ).arg( 
string ) );
 
  163  if ( atlasFeatureIndex != -1 )
 
  165    mSourceComboBox->setItemText( atlasFeatureIndex, tr( 
"Current %1 Feature" ).arg( 
string ) );
 
 
  171  if ( mItemPropertiesWidget )
 
 
  181    context = mFrame->createExpressionContext();
 
  183    context = mTable->createExpressionContext();
 
  185  auto cellScope = std::make_unique<QgsExpressionContextScope>();
 
  186  cellScope->setVariable( QStringLiteral( 
"row_number" ), 1, 
true );
 
  187  cellScope->setVariable( QStringLiteral( 
"column_number" ), 1, 
true );
 
 
  213  mTable = qobject_cast<QgsLayoutItemAttributeTable *>( multiFrame );
 
  215  mItemPropertiesWidget->
setItem( frame );
 
 
  228void QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked()
 
  235  mTable->refreshAttributes();
 
  238void QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked()
 
  246  QVector<QgsLayoutTableColumn> currentColumns = mTable->columns();
 
  247  QVector<QgsLayoutTableColumn> currentSortColumns = mTable->sortColumns();
 
  249  mTable->beginCommand( tr( 
"Change Table Attributes" ) );
 
  252  window()->setUpdatesEnabled( 
false );
 
  255  if ( d.exec() == QDialog::Accepted )
 
  257    mTable->refreshAttributes();
 
  259    window()->setUpdatesEnabled( 
true );
 
  261    mTable->endCommand();
 
  264    currentColumns.clear();
 
  265    currentSortColumns.clear();
 
  270    mTable->setColumns( currentColumns );
 
  271    mTable->setSortColumns( currentSortColumns );
 
  272    window()->setUpdatesEnabled( 
true );
 
  273    mTable->cancelCommand();
 
  277void QgsLayoutAttributeTableWidget::composerMapChanged( 
QgsLayoutItem *item )
 
  284  mTable->beginCommand( tr( 
"Change Table Map" ) );
 
  285  mTable->setMap( qobject_cast<QgsLayoutItemMap *>( item ) );
 
  287  mTable->endCommand();
 
  290void QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged( 
int i )
 
  298  mTable->setMaximumNumberOfFeatures( i );
 
  300  mTable->endCommand();
 
  303void QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged( 
double d )
 
  311  mTable->setCellMargin( d );
 
  312  mTable->endCommand();
 
  315void QgsLayoutAttributeTableWidget::headerFontChanged()
 
  320  mTable->beginCommand( tr( 
"Change Table Text Format" ) );
 
  321  mTable->setHeaderTextFormat( mHeaderFontToolButton->textFormat() );
 
  322  mTable->endCommand();
 
  325void QgsLayoutAttributeTableWidget::contentFontChanged()
 
  332  mTable->beginCommand( tr( 
"Change Table Text Format" ) );
 
  333  mTable->setContentTextFormat( mContentFontToolButton->textFormat() );
 
  334  mTable->endCommand();
 
  337void QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged( 
double d )
 
  345  mTable->setGridStrokeWidth( d );
 
  346  mTable->endCommand();
 
  349void QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged( 
const QColor &newColor )
 
  357  mTable->setGridColor( newColor );
 
  358  mTable->endCommand();
 
  361void QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled( 
bool state )
 
  368  mTable->beginCommand( tr( 
"Toggle Table Grid" ) );
 
  369  mTable->setHorizontalGrid( state );
 
  370  mTable->endCommand();
 
  373void QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled( 
bool state )
 
  380  mTable->beginCommand( tr( 
"Toggled Table Grid" ) );
 
  381  mTable->setVerticalGrid( state );
 
  382  mTable->endCommand();
 
  385void QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled( 
bool state )
 
  392  mTable->beginCommand( tr( 
"Toggle Table Grid" ) );
 
  393  mTable->setShowGrid( state );
 
  394  mTable->endCommand();
 
  397void QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged( 
const QColor &newColor )
 
  405  mTable->setBackgroundColor( newColor );
 
  406  mTable->endCommand();
 
  409void QgsLayoutAttributeTableWidget::updateGuiElements()
 
  411  if ( !mTable || !mFrame )
 
  416  blockAllSignals( 
true );
 
  418  mSourceComboBox->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
 
  419  mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
 
  422  if ( mTable->vectorLayer() )
 
  424    mLayerComboBox->setLayer( mTable->vectorLayer() );
 
  428      mShowOnlyVisibleFeaturesCheckBox->setChecked( 
false );
 
  429      mShowOnlyVisibleFeaturesCheckBox->setEnabled( 
false );
 
  430      mComposerMapComboBox->setEnabled( 
false );
 
  431      mComposerMapLabel->setEnabled( 
false );
 
  432      mIntersectAtlasCheckBox->setEnabled( 
false );
 
  436      mShowOnlyVisibleFeaturesCheckBox->setEnabled( 
true );
 
  437      mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  438      mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  443  mComposerMapComboBox->setItem( mTable->map() );
 
  444  mMaximumRowsSpinBox->setValue( mTable->maximumNumberOfFeatures() );
 
  445  mMarginSpinBox->setValue( mTable->cellMargin() );
 
  446  mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
 
  447  mGridColorButton->setColor( mTable->gridColor() );
 
  448  mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
 
  449  mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
 
  450  if ( mTable->showGrid() )
 
  452    mShowGridGroupCheckBox->setChecked( 
true );
 
  456    mShowGridGroupCheckBox->setChecked( 
false );
 
  458  mBackgroundColorButton->setColor( mTable->backgroundColor() );
 
  460  mHeaderFontToolButton->setTextFormat( mTable->headerTextFormat() );
 
  461  mContentFontToolButton->setTextFormat( mTable->contentTextFormat() );
 
  463  if ( mTable->displayOnlyVisibleFeatures() && mShowOnlyVisibleFeaturesCheckBox->isEnabled() )
 
  465    mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
 
  466    mComposerMapComboBox->setEnabled( 
true );
 
  467    mComposerMapLabel->setEnabled( 
true );
 
  471    mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
 
  472    mComposerMapComboBox->setEnabled( 
false );
 
  473    mComposerMapLabel->setEnabled( 
false );
 
  476  mUniqueOnlyCheckBox->setChecked( mTable->uniqueRowsOnly() );
 
  477  mIntersectAtlasCheckBox->setChecked( mTable->filterToAtlasFeature() );
 
  478  mFeatureFilterEdit->setText( mTable->featureFilter() );
 
  479  mFeatureFilterCheckBox->setCheckState( mTable->filterFeatures() ? Qt::Checked : Qt::Unchecked );
 
  480  mFeatureFilterEdit->setEnabled( mTable->filterFeatures() );
 
  481  mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
 
  482  mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );
 
  484  mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
 
  485  mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
 
  487  mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
 
  488  mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
 
  491  mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
 
  492  mWrapStringLineEdit->setText( mTable->wrapString() );
 
  493  mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
 
  495  mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
 
  498  mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
 
  499  mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
 
  503  toggleSourceControls();
 
  505  blockAllSignals( 
false );
 
  508void QgsLayoutAttributeTableWidget::atlasToggled()
 
  515  toggleAtlasSpecificControls( atlasEnabled );
 
  520  whileBlocking( mSourceComboBox )->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
 
  522  if ( !atlasEnabled && mTable->filterToAtlasFeature() )
 
  524    mTable->setFilterToAtlasFeature( 
false );
 
  528void QgsLayoutAttributeTableWidget::updateRelationsCombo()
 
  530  mRelationsComboBox->blockSignals( 
true );
 
  531  mRelationsComboBox->clear();
 
  539      mRelationsComboBox->addItem( relation.name(), relation.id() );
 
  543      mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
 
  547  mRelationsComboBox->blockSignals( 
false );
 
  550void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls( 
const bool atlasEnabled )
 
  560    mRelationsComboBox->blockSignals( 
true );
 
  561    mRelationsComboBox->setEnabled( 
false );
 
  562    mRelationsComboBox->clear();
 
  563    mRelationsComboBox->blockSignals( 
false );
 
  564    mIntersectAtlasCheckBox->setEnabled( 
false );
 
  580    updateRelationsCombo();
 
  581    mRelationsComboBox->setEnabled( 
true );
 
  582    mIntersectAtlasCheckBox->setEnabled( mTable->layout()->reportContext().layer() && mTable->layout()->reportContext().layer()->geometryType() != 
Qgis::GeometryType::Null );
 
  586void QgsLayoutAttributeTableWidget::blockAllSignals( 
bool b )
 
  588  mSourceComboBox->blockSignals( b );
 
  589  mLayerComboBox->blockSignals( b );
 
  590  mComposerMapComboBox->blockSignals( b );
 
  591  mMaximumRowsSpinBox->blockSignals( b );
 
  592  mMarginSpinBox->blockSignals( b );
 
  593  mGridColorButton->blockSignals( b );
 
  594  mGridStrokeWidthSpinBox->blockSignals( b );
 
  595  mBackgroundColorButton->blockSignals( b );
 
  596  mDrawHorizontalGrid->blockSignals( b );
 
  597  mDrawVerticalGrid->blockSignals( b );
 
  598  mShowGridGroupCheckBox->blockSignals( b );
 
  599  mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
 
  600  mUniqueOnlyCheckBox->blockSignals( b );
 
  601  mIntersectAtlasCheckBox->blockSignals( b );
 
  602  mFeatureFilterEdit->blockSignals( b );
 
  603  mFeatureFilterCheckBox->blockSignals( b );
 
  604  mHeaderHAlignmentComboBox->blockSignals( b );
 
  605  mHeaderModeComboBox->blockSignals( b );
 
  606  mResizeModeComboBox->blockSignals( b );
 
  607  mRelationsComboBox->blockSignals( b );
 
  608  mEmptyModeComboBox->blockSignals( b );
 
  609  mEmptyMessageLineEdit->blockSignals( b );
 
  610  mEmptyFrameCheckBox->blockSignals( b );
 
  611  mHideEmptyBgCheckBox->blockSignals( b );
 
  612  mDrawEmptyCheckBox->blockSignals( b );
 
  613  mWrapStringLineEdit->blockSignals( b );
 
  614  mWrapBehaviorComboBox->blockSignals( b );
 
  615  mContentFontToolButton->blockSignals( b );
 
  616  mHeaderFontToolButton->blockSignals( b );
 
  619void QgsLayoutAttributeTableWidget::setMaximumNumberOfFeatures( 
int n )
 
  624void QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged( 
int state )
 
  631  mTable->beginCommand( tr( 
"Toggle Visible Features Only" ) );
 
  632  const bool showOnlyVisibleFeatures = ( state == Qt::Checked );
 
  633  mTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
 
  635  mTable->endCommand();
 
  638  mComposerMapComboBox->setEnabled( state == Qt::Checked );
 
  639  mComposerMapLabel->setEnabled( state == Qt::Checked );
 
  642void QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged( 
int state )
 
  649  mTable->beginCommand( tr( 
"Toggle Table Filter Duplicates" ) );
 
  650  mTable->setUniqueRowsOnly( state == Qt::Checked );
 
  652  mTable->endCommand();
 
  655void QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled( 
bool checked )
 
  662  mFrame->beginCommand( tr( 
"Toggle Empty Frame Mode" ) );
 
  663  mFrame->setHidePageIfEmpty( checked );
 
  664  mFrame->endCommand();
 
  667void QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled( 
bool checked )
 
  674  mFrame->beginCommand( tr( 
"Toggle Background Display" ) );
 
  675  mFrame->setHideBackgroundIfEmpty( checked );
 
  676  mFrame->endCommand();
 
  679void QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged( 
int state )
 
  686  mTable->beginCommand( tr( 
"Toggle Table Atlas Filter" ) );
 
  687  const bool filterToAtlas = ( state == Qt::Checked );
 
  688  mTable->setFilterToAtlasFeature( filterToAtlas );
 
  690  mTable->endCommand();
 
  693void QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged( 
int state )
 
  700  if ( state == Qt::Checked )
 
  702    mFeatureFilterEdit->setEnabled( 
true );
 
  703    mFeatureFilterButton->setEnabled( 
true );
 
  707    mFeatureFilterEdit->setEnabled( 
false );
 
  708    mFeatureFilterButton->setEnabled( 
false );
 
  711  mTable->beginCommand( tr( 
"Toggle Table Feature Filter" ) );
 
  712  mTable->setFilterFeatures( state == Qt::Checked );
 
  714  mTable->endCommand();
 
  717void QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished()
 
  724  mTable->beginCommand( tr( 
"Change Table Feature Filter" ) );
 
  725  mTable->setFeatureFilter( mFeatureFilterEdit->text() );
 
  727  mTable->endCommand();
 
  730void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
 
  738  QgsExpressionBuilderDialog exprDlg( mTable->sourceLayer(), mFeatureFilterEdit->text(), 
this, QStringLiteral( 
"generic" ), context );
 
  739  exprDlg.setWindowTitle( tr( 
"Expression Based Filter" ) );
 
  740  if ( exprDlg.exec() == QDialog::Accepted )
 
  742    const QString expression = exprDlg.expressionText();
 
  743    if ( !expression.isEmpty() )
 
  745      mFeatureFilterEdit->setText( expression );
 
  746      mTable->beginCommand( tr( 
"Change Table Feature Filter" ) );
 
  747      mTable->setFeatureFilter( mFeatureFilterEdit->text() );
 
  749      mTable->endCommand();
 
  754void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( 
int )
 
  761  mTable->beginCommand( tr( 
"Change Table Alignment" ) );
 
  763  mTable->endCommand();
 
  766void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged( 
int )
 
  773  mTable->beginCommand( tr( 
"Change Table Header Mode" ) );
 
  775  mTable->endCommand();
 
  778void QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished()
 
  785  mTable->beginCommand( tr( 
"Change Table Wrap String" ) );
 
  786  mTable->setWrapString( mWrapStringLineEdit->text() );
 
  787  mTable->endCommand();
 
  790void QgsLayoutAttributeTableWidget::changeLayer( 
QgsMapLayer *layer )
 
  803  mTable->beginCommand( tr( 
"Change Table Layer" ) );
 
  804  mTable->setVectorLayer( vl );
 
  806  mTable->endCommand();
 
  808  mContentFontToolButton->setLayer( vl );
 
  809  mHeaderFontToolButton->setLayer( vl );
 
  814    mShowOnlyVisibleFeaturesCheckBox->setChecked( 
false );
 
  815    mShowOnlyVisibleFeaturesCheckBox->setEnabled( 
false );
 
  816    mComposerMapComboBox->setEnabled( 
false );
 
  817    mComposerMapLabel->setEnabled( 
false );
 
  818    mIntersectAtlasCheckBox->setEnabled( 
false );
 
  822    mShowOnlyVisibleFeaturesCheckBox->setEnabled( 
true );
 
  823    mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  824    mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  829void 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 );
 
  851void QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged( 
int index )
 
  858  mTable->beginCommand( tr( 
"Change Resize Mode" ) );
 
  860  mTable->endCommand();
 
  865void QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged( 
int index )
 
  872  mTable->beginCommand( tr( 
"Change Table Source" ) );
 
  874  mTable->endCommand();
 
  876  toggleSourceControls();
 
  879void QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged( 
int index )
 
  886  mTable->beginCommand( tr( 
"Change Table Source Relation" ) );
 
  887  mTable->setRelationId( mRelationsComboBox->itemData( index ).toString() );
 
  888  mTable->endCommand();
 
  891void QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged( 
int index )
 
  898  mTable->beginCommand( tr( 
"Change Empty Table Behavior" ) );
 
  900  mTable->endCommand();
 
  905void QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged( 
int index )
 
  912  mTable->beginCommand( tr( 
"Change Table Wrap Mode" ) );
 
  914  mTable->endCommand();
 
  917void QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked()
 
  928void QgsLayoutAttributeTableWidget::useConditionalStylingChanged( 
bool checked )
 
  935  mTable->beginCommand( tr( 
"Toggle Table Conditional Styling" ) );
 
  936  mTable->setUseConditionalStyling( checked );
 
  938  mTable->endCommand();
 
  941void QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled( 
bool checked )
 
  948  mTable->beginCommand( tr( 
"Change Show Empty Rows" ) );
 
  949  mTable->setShowEmptyRows( checked );
 
  950  mTable->endCommand();
 
  953void QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished()
 
  960  mTable->beginCommand( tr( 
"Change Empty Table Message" ) );
 
  961  mTable->setEmptyTableMessage( mEmptyMessageLineEdit->text() );
 
  962  mTable->endCommand();
 
  965void 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( mTable->vectorLayer() && mTable->vectorLayer()->geometryType() != 
Qgis::GeometryType::Null );
 
  980      mShowOnlyVisibleFeaturesCheckBox->setChecked( mTable->vectorLayer() && mTable->vectorLayer()->geometryType() != 
Qgis::GeometryType::Null && mTable->displayOnlyVisibleFeatures() );
 
  981      mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  982      mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  986      mLayerComboBox->setEnabled( 
false );
 
  987      mLayerComboBox->setVisible( 
false );
 
  988      mLayerSourceDDBtn->setVisible( 
false );
 
  989      mLayerLabel->setVisible( 
false );
 
  990      mRelationsComboBox->setEnabled( 
false );
 
  991      mRelationsComboBox->setVisible( 
false );
 
  992      mRelationLabel->setVisible( 
false );
 
  993      mMaximumRowsSpinBox->setEnabled( 
false );
 
  994      mMaxNumFeaturesLabel->setEnabled( 
false );
 
  995      mShowOnlyVisibleFeaturesCheckBox->setEnabled( mTable->sourceLayer() && mTable->sourceLayer()->geometryType() != 
Qgis::GeometryType::Null );
 
  996      mShowOnlyVisibleFeaturesCheckBox->setChecked( mTable->sourceLayer() && mTable->sourceLayer()->geometryType() != 
Qgis::GeometryType::Null && mTable->displayOnlyVisibleFeatures() );
 
  997      mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  998      mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
  999      mIntersectAtlasCheckBox->setEnabled( 
false );
 
 1002      mLayerComboBox->setEnabled( 
false );
 
 1003      mLayerComboBox->setVisible( 
false );
 
 1004      mLayerLabel->setVisible( 
false );
 
 1005      mLayerSourceDDBtn->setVisible( 
false );
 
 1006      mRelationsComboBox->setEnabled( 
true );
 
 1007      mRelationsComboBox->setVisible( 
true );
 
 1008      mRelationLabel->setVisible( 
true );
 
 1009      mMaximumRowsSpinBox->setEnabled( 
true );
 
 1010      mMaxNumFeaturesLabel->setEnabled( 
true );
 
 1012      mShowOnlyVisibleFeaturesCheckBox->setEnabled( 
true );
 
 1013      mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
 1014      mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
 
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.
 
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.
 
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 relationship between two vector layers.
 
Represents a vector layer which manages a vector based dataset.
 
Q_INVOKABLE Qgis::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.